b=797568 don't create a container just to reset it r=roc
authorKarl Tomlinson <karlt+@karlt.net>
Wed, 31 Oct 2012 15:54:06 +1300
changeset 111995 d7e77004a0d0dd5bd14c23ececf49c60c1231888
parent 111994 caad55e54b0bc1cbb8a095b3bcbd7310b4ae2fef
child 111996 2886e8e67bfdb76c617ae4ecf62c8ed7ad80fa7d
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersroc
bugs797568
milestone19.0a1
b=797568 don't create a container just to reset it r=roc
dom/plugins/ipc/PluginInstanceParent.cpp
--- a/dom/plugins/ipc/PluginInstanceParent.cpp
+++ b/dom/plugins/ipc/PluginInstanceParent.cpp
@@ -90,24 +90,21 @@ PluginInstanceParent::~PluginInstancePar
 #if defined(MOZ_WIDGET_COCOA)
     if (mShWidth != 0 && mShHeight != 0) {
         DeallocShmem(mShSurface);
     }
     if (mShColorSpace)
         ::CGColorSpaceRelease(mShColorSpace);
 #endif
     if (mRemoteImageDataShmem.IsWritable()) {
-        ImageContainer *container =
-            GetImageContainer();
-
-        if (container) {
-            container->SetRemoteImageData(nullptr, nullptr);
-            container->SetCompositionNotifySink(nullptr);
-            DeallocShmem(mRemoteImageDataShmem);
+        if (mImageContainer) {
+            mImageContainer->SetRemoteImageData(nullptr, nullptr);
+            mImageContainer->SetCompositionNotifySink(nullptr);
         }
+        DeallocShmem(mRemoteImageDataShmem);
     }
 }
 
 bool
 PluginInstanceParent::Init()
 {
     mScriptableObjects.Init();
     return true;
@@ -414,29 +411,25 @@ PluginInstanceParent::AnswerNPN_SetValue
 #elif defined(MOZ_X11)
                drawingModel == NPDrawingModelSyncX
 #else
                false
 #endif
                ) {
         *shmem = null_t();
 
-        ImageContainer *container = GetImageContainer();
-        if (!container) {
-            *result = NPERR_GENERIC_ERROR;
-            return true;
-        }
-
         mDrawingModel = drawingModel;
         *result = mNPNIface->setvalue(mNPP, NPPVpluginDrawingModel,
                                       (void*)(intptr_t)drawingModel);
 
         if (mRemoteImageDataShmem.IsWritable()) {
-            container->SetRemoteImageData(nullptr, nullptr);
-            container->SetCompositionNotifySink(nullptr);
+            if (mImageContainer) {
+                mImageContainer->SetRemoteImageData(nullptr, nullptr);
+                mImageContainer->SetCompositionNotifySink(nullptr);
+            }
             DeallocShmem(mRemoteImageDataShmem);
             mRemoteImageDataMutex = NULL;
         }
     } else {
         *result = NPERR_GENERIC_ERROR;
     }
     return true;
 }