Bug 1371882 - MediaCacheStream::mInitialized is redundant, mMediaCache is non-null after initialization - r=cpearce

MozReview-Commit-ID: 6VIPMLmzuEP

--HG--
extra : rebase_source : 80df4e3bda168660812d420e26c6117c7ccc4b88
This commit is contained in:
Gerald Squelart 2017-06-09 13:48:06 +12:00
Родитель fc0f5efec9
Коммит d63ca8dd12
2 изменённых файлов: 6 добавлений и 7 удалений

Просмотреть файл

@ -441,7 +441,6 @@ MediaCacheStream::MediaCacheStream(ChannelMediaResource* aClient,
bool aIsPrivateBrowsing)
: mMediaCache(nullptr)
, mClient(aClient)
, mInitialized(false)
, mHasHadUpdate(false)
, mClosed(false)
, mDidNotifyDataEnded(false)
@ -2072,8 +2071,9 @@ MediaCacheStream::Close()
{
NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
if (!mInitialized)
if (!mMediaCache) {
return;
}
ReentrantMonitorAutoEnter mon(mMediaCache->GetReentrantMonitor());
CloseInternal(mon);
@ -2500,15 +2500,15 @@ MediaCacheStream::Init()
{
NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
if (mInitialized)
if (mMediaCache) {
return NS_OK;
}
mMediaCache = MediaCache::GetMediaCache();
if (!mMediaCache) {
return NS_ERROR_FAILURE;
}
mMediaCache->OpenStream(this);
mInitialized = true;
return NS_OK;
}
@ -2518,8 +2518,9 @@ MediaCacheStream::InitAsClone(MediaCacheStream* aOriginal)
if (!aOriginal->IsAvailableForSharing())
return NS_ERROR_FAILURE;
if (mInitialized)
if (mMediaCache) {
return NS_OK;
}
nsresult rv = Init();
if (NS_FAILED(rv))

Просмотреть файл

@ -444,8 +444,6 @@ private:
// These fields are main-thread-only.
ChannelMediaResource* mClient;
nsCOMPtr<nsIPrincipal> mPrincipal;
// Set to true when Init or InitAsClone has been called
bool mInitialized;
// Set to true when MediaCache::Update() has finished while this stream
// was present.
bool mHasHadUpdate;