Bug 1154876 - Block calls to hooked methods off the plugin thread. r=spohl a=rkothari
authorSteven Michaud <smichaud@pobox.com>
Wed, 27 May 2015 19:04:51 -0500
changeset 266119 c9cc5b1e1b0f
parent 266118 f3259a2d48bc
child 266120 73ab42485315
push id4761
push usersmichaud@pobox.com
push date2015-05-28 00:05 +0000
treeherdermozilla-beta@c9cc5b1e1b0f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersspohl, rkothari
bugs1154876
milestone39.0
Bug 1154876 - Block calls to hooked methods off the plugin thread. r=spohl a=rkothari
dom/plugins/ipc/PluginInterposeOSX.mm
--- a/dom/plugins/ipc/PluginInterposeOSX.mm
+++ b/dom/plugins/ipc/PluginInterposeOSX.mm
@@ -33,18 +33,17 @@
 #include "PluginModuleChild.h"
 #include "nsDebug.h"
 #include "PluginInterposeOSX.h"
 #include <set>
 #import <AppKit/AppKit.h>
 #import <objc/runtime.h>
 #import <Carbon/Carbon.h>
 
-using mozilla::plugins::PluginModuleChild;
-using mozilla::plugins::AssertPluginThread;
+using namespace mozilla::plugins;
 
 namespace mac_plugin_interposing {
 
 int32_t NSCursorInfo::mNativeCursorsSupported = -1;
 
 // This constructor may be called from the browser process or the plugin
 // process.
 NSCursorInfo::NSCursorInfo()
@@ -539,17 +538,17 @@ void NSCursorInfo::SetCustomImageData(ui
   mCustomImageDataLength = aDataLength;
 }
 
 // This should never be called from the browser process -- only from the
 // plugin process.
 bool NSCursorInfo::GetNativeCursorsSupported()
 {
   if (mNativeCursorsSupported == -1) {
-    AssertPluginThread();
+    ENSURE_PLUGIN_THREAD(false);
     PluginModuleChild *pmc = PluginModuleChild::GetChrome();
     if (pmc) {
       bool result = pmc->GetNativeCursorsSupported();
       if (result) {
         mNativeCursorsSupported = 1;
       } else {
         mNativeCursorsSupported = 0;
       }
@@ -684,61 +683,61 @@ void FocusPluginProcess() {
   if ((SameProcess(&this_process, &front_process, &matched) == noErr) &&
       !matched) {
     SetFrontProcess(&this_process);
   }
 }
 
 void NotifyBrowserOfPluginShowWindow(uint32_t window_id, CGRect bounds,
                                      bool modal) {
-  AssertPluginThread();
+  ENSURE_PLUGIN_THREAD_VOID();
 
   PluginModuleChild *pmc = PluginModuleChild::GetChrome();
   if (pmc)
     pmc->PluginShowWindow(window_id, modal, bounds);
 }
 
 void NotifyBrowserOfPluginHideWindow(uint32_t window_id, CGRect bounds) {
-  AssertPluginThread();
+  ENSURE_PLUGIN_THREAD_VOID();
 
   PluginModuleChild *pmc = PluginModuleChild::GetChrome();
   if (pmc)
     pmc->PluginHideWindow(window_id);
 }
 
 void NotifyBrowserOfSetCursor(NSCursorInfo& aCursorInfo)
 {
-  AssertPluginThread();
+  ENSURE_PLUGIN_THREAD_VOID();
   PluginModuleChild *pmc = PluginModuleChild::GetChrome();
   if (pmc) {
     pmc->SetCursor(aCursorInfo);
   }
 }
 
 void NotifyBrowserOfShowCursor(bool show)
 {
-  AssertPluginThread();
+  ENSURE_PLUGIN_THREAD_VOID();
   PluginModuleChild *pmc = PluginModuleChild::GetChrome();
   if (pmc) {
     pmc->ShowCursor(show);
   }
 }
 
 void NotifyBrowserOfPushCursor(NSCursorInfo& aCursorInfo)
 {
-  AssertPluginThread();
+  ENSURE_PLUGIN_THREAD_VOID();
   PluginModuleChild *pmc = PluginModuleChild::GetChrome();
   if (pmc) {
     pmc->PushCursor(aCursorInfo);
   }
 }
 
 void NotifyBrowserOfPopCursor()
 {
-  AssertPluginThread();
+  ENSURE_PLUGIN_THREAD_VOID();
   PluginModuleChild *pmc = PluginModuleChild::GetChrome();
   if (pmc) {
     pmc->PopCursor();
   }
 }
 
 struct WindowInfo {
   uint32_t window_id;