Bug 886219 - Avoid introducing a global constructor with the ImageBridgeParent singleton - r=nical
authorBenoit Jacob <bjacob@mozilla.com>
Fri, 01 Nov 2013 07:34:40 -0400
changeset 153030 51f0577831233136bf07cd17d0c8a67924ea5f23
parent 153029 229f179bd8d7244cd863e90e4d89d9b57f2d7a69
child 153031 93bce3f109dc41be7c5bca1116f2294b02b68f9e
push id25566
push userryanvm@gmail.com
push dateFri, 01 Nov 2013 18:40:05 +0000
treeherdermozilla-central@5bb07c1ae9f5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnical
bugs886219
milestone28.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 886219 - Avoid introducing a global constructor with the ImageBridgeParent singleton - r=nical
gfx/layers/ipc/ImageBridgeChild.cpp
--- a/gfx/layers/ipc/ImageBridgeChild.cpp
+++ b/gfx/layers/ipc/ImageBridgeChild.cpp
@@ -30,16 +30,17 @@
 #include "mozilla/layers/TextureClient.h"  // for TextureClient
 #include "mozilla/mozalloc.h"           // for operator new, etc
 #include "nsAutoPtr.h"                  // for nsRefPtr
 #include "nsISupportsImpl.h"            // for ImageContainer::AddRef, etc
 #include "nsTArray.h"                   // for nsAutoTArray, nsTArray, etc
 #include "nsTArrayForwardDeclare.h"     // for AutoInfallibleTArray
 #include "nsThreadUtils.h"              // for NS_IsMainThread
 #include "nsXULAppAPI.h"                // for XRE_GetIOMessageLoop
+#include "mozilla/StaticPtr.h"          // for StaticRefPtr
 
 struct nsIntRect;
  
 using namespace base;
 using namespace mozilla::ipc;
 
 namespace mozilla {
 namespace ipc {
@@ -194,17 +195,17 @@ void
 ImageBridgeChild::UpdatePictureRect(CompositableClient* aCompositable,
                                     const nsIntRect& aRect)
 {
   mTxn->AddNoSwapEdit(OpUpdatePictureRect(nullptr, aCompositable->GetIPDLActor(), aRect));
 }
 
 // Singleton
 static ImageBridgeChild *sImageBridgeChildSingleton = nullptr;
-static nsRefPtr<ImageBridgeParent> sImageBridgeParentSingleton;
+static StaticRefPtr<ImageBridgeParent> sImageBridgeParentSingleton;
 static Thread *sImageBridgeChildThread = nullptr;
 
 // dispatched function
 static void StopImageBridgeSync(ReentrantMonitor *aBarrier, bool *aDone)
 {
   ReentrantMonitorAutoEnter autoMon(*aBarrier);
 
   NS_ABORT_IF_FALSE(InImageBridgeChildThread(),