Bug 1398659. P5 - let ChannelMediaResource::Open() set mListener without calling OpenChannel(). r=gerald
authorJW Wang <jwwang@mozilla.com>
Tue, 05 Sep 2017 17:51:22 +0800
changeset 429488 aae0f0941029a26fd24661bd629ab8f4182560a1
parent 429487 bd93f2e8986baa83c634612dc013a4d42781b09d
child 429489 020a6054e22840ec66c1f0e0a0bfa3a83040cc7c
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgerald
bugs1398659
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1398659. P5 - let ChannelMediaResource::Open() set mListener without calling OpenChannel(). r=gerald This is more efficient because aStreamListener won't be null. MozReview-Commit-ID: 4b22l7cTK6y
dom/media/MediaResource.cpp
--- a/dom/media/MediaResource.cpp
+++ b/dom/media/MediaResource.cpp
@@ -531,17 +531,20 @@ ChannelMediaResource::Open(nsIStreamList
   }
 
   nsresult rv = mCacheStream.Init(cl);
   if (NS_FAILED(rv)) {
     return rv;
   }
 
   MOZ_ASSERT(mOffset == 0, "Who set mOffset already?");
-  return OpenChannel(aStreamListener);
+  mListener = new Listener(this);
+  *aStreamListener = mListener;
+  NS_ADDREF(*aStreamListener);
+  return NS_OK;
 }
 
 nsresult ChannelMediaResource::OpenChannel(nsIStreamListener** aStreamListener)
 {
   NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
   NS_ENSURE_TRUE(mChannel, NS_ERROR_NULL_POINTER);
   NS_ASSERTION(!mListener, "Listener should have been removed by now");