Bug 1492894 - part 4 - eliminate already_AddRefed variables in dom/; r=mccr8
authorNathan Froyd <froydnj@mozilla.com>
Fri, 21 Sep 2018 16:45:49 -0400
changeset 493513 b186c66999208b603108ded28b0e22fade0b7739
parent 493512 0088198b811d115eaa4957ce8b2c9ecee32a4537
child 493514 be7d67d74770825ae80c8b0fd40585cf1ced575e
push id9984
push userffxbld-merge
push dateMon, 15 Oct 2018 21:07:35 +0000
treeherdermozilla-beta@183d27ea8570 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmccr8
bugs1492894
milestone64.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 1492894 - part 4 - eliminate already_AddRefed variables in dom/; r=mccr8 We need to disallow these to fix our static analysis, which should have already been disallowing them.
dom/canvas/OffscreenCanvas.cpp
dom/media/webaudio/PannerNode.cpp
--- a/dom/canvas/OffscreenCanvas.cpp
+++ b/dom/canvas/OffscreenCanvas.cpp
@@ -123,17 +123,17 @@ OffscreenCanvas::GetContext(JSContext* a
   if (!(contextType == CanvasContextType::WebGL1 ||
         contextType == CanvasContextType::WebGL2 ||
         contextType == CanvasContextType::ImageBitmap))
   {
     aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
     return nullptr;
   }
 
-  already_AddRefed<nsISupports> result =
+  RefPtr<nsISupports> result =
     CanvasRenderingContextHelper::GetContext(aCx,
                                              aContextId,
                                              aContextOptions,
                                              aRv);
 
   if (!mCurrentContext) {
     return nullptr;
   }
@@ -161,17 +161,17 @@ OffscreenCanvas::GetContext(JSContext* a
           gl::GLScreenBuffer::CreateFactory(gl, caps, forwarder, flags);
 
         if (factory)
           screen->Morph(std::move(factory));
       }
     }
   }
 
-  return result;
+  return result.forget();
 }
 
 already_AddRefed<nsICanvasRenderingContextInternal>
 OffscreenCanvas::CreateContext(CanvasContextType aContextType)
 {
   RefPtr<nsICanvasRenderingContextInternal> ret =
     CanvasRenderingContextHelper::CreateContext(aContextType);
 
--- a/dom/media/webaudio/PannerNode.cpp
+++ b/dom/media/webaudio/PannerNode.cpp
@@ -99,19 +99,19 @@ public:
 
   void CreateHRTFPanner()
   {
     MOZ_ASSERT(NS_IsMainThread());
     if (mHRTFPanner) {
       return;
     }
     // HRTFDatabaseLoader needs to be fetched on the main thread.
-    already_AddRefed<HRTFDatabaseLoader> loader =
+    RefPtr<HRTFDatabaseLoader> loader =
       HRTFDatabaseLoader::createAndLoadAsynchronouslyIfNecessary(NodeMainThread()->Context()->SampleRate());
-    mHRTFPanner = new HRTFPanner(NodeMainThread()->Context()->SampleRate(), std::move(loader));
+    mHRTFPanner = new HRTFPanner(NodeMainThread()->Context()->SampleRate(), loader.forget());
   }
 
   void SetInt32Parameter(uint32_t aIndex, int32_t aParam) override
   {
     switch (aIndex) {
     case PannerNode::PANNING_MODEL:
       switch (PanningModelType(aParam)) {
         case PanningModelType::Equalpower: