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

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

@ -444,8 +444,6 @@ private:
// These fields are main-thread-only. // These fields are main-thread-only.
ChannelMediaResource* mClient; ChannelMediaResource* mClient;
nsCOMPtr<nsIPrincipal> mPrincipal; 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 // Set to true when MediaCache::Update() has finished while this stream
// was present. // was present.
bool mHasHadUpdate; bool mHasHadUpdate;