Backout bug 1099410 for increasing crash rate
authorBill McCloskey <wmccloskey@mozilla.com>
Thu, 11 Dec 2014 10:09:44 -0800
changeset 219216 5b55317fb623543926cfe228068906c3d16bcff2
parent 219215 a84e8a69915936889b58c9f564ff93a1b0e8f9d7
child 219217 d1172575c996ab0639036d959c7cc091fe52a88d
push id52792
push userwmccloskey@mozilla.com
push dateThu, 11 Dec 2014 18:11:45 +0000
treeherdermozilla-inbound@5b55317fb623 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1099410
milestone37.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
Backout bug 1099410 for increasing crash rate
dom/plugins/ipc/PluginModuleParent.cpp
dom/plugins/ipc/PluginModuleParent.h
--- a/dom/plugins/ipc/PluginModuleParent.cpp
+++ b/dom/plugins/ipc/PluginModuleParent.cpp
@@ -92,108 +92,56 @@ mozilla::plugins::SetupBridge(uint32_t a
     nsresult rv = host->GetPluginForContentProcess(aPluginId, getter_AddRefs(plugin));
     if (NS_FAILED(rv)) {
         return false;
     }
     PluginModuleParent* chromeParent = static_cast<PluginModuleParent*>(plugin->GetLibrary());
     return PPluginModule::Bridge(aContentParent, chromeParent);
 }
 
-// A linked list used to fetch newly created PluginModuleContentParent instances
-// for LoadModule. Each pending LoadModule call owns an element in this list.
-// The element's mModule field is filled in when the new
-// PluginModuleContentParent arrives from chrome.
-struct MOZ_STACK_CLASS SavedPluginModule
-{
-    SavedPluginModule() : mModule(nullptr), mNext(sSavedModuleStack)
-    {
-        sSavedModuleStack = this;
-    }
-    ~SavedPluginModule()
-    {
-        MOZ_ASSERT(sSavedModuleStack == this);
-        sSavedModuleStack = mNext;
-    }
-
-    PluginModuleContentParent* GetModule() { return mModule; }
-
-    // LoadModule can be on the stack multiple times since the intr message it
-    // sends will dispatch arbitrary incoming messages from the chrome process,
-    // which can include new HTTP data. This makes it somewhat tricky to match
-    // up the object created in PluginModuleContentParent::Create with the
-    // LoadModule call that asked for it.
-    //
-    // Each invocation of LoadModule pushes a new SavedPluginModule object on
-    // the sSavedModuleStack stack, with the most recent invocation at the
-    // front. LoadModule messages are always processed by the chrome process in
-    // order, and PluginModuleContentParent allocation messages will also be
-    // received in order. Therefore, we need to match up the first received
-    // PluginModuleContentParent creation message with the first sent LoadModule
-    // call. This call will be the last one in the list that doesn't already
-    // have a module attached to it.
-    static void SaveModule(PluginModuleContentParent* module)
-    {
-        SavedPluginModule* saved = sSavedModuleStack;
-        SavedPluginModule* prev = nullptr;
-        while (saved && !saved->mModule) {
-            prev = saved;
-            saved = saved->mNext;
-        }
-        MOZ_ASSERT(prev);
-        MOZ_ASSERT(!prev->mModule);
-        prev->mModule = module;
-    }
-
-private:
-    PluginModuleContentParent* mModule;
-    SavedPluginModule* mNext;
-
-    static SavedPluginModule* sSavedModuleStack;
-};
-
-SavedPluginModule* SavedPluginModule::sSavedModuleStack;
+PluginModuleContentParent* PluginModuleContentParent::sSavedModuleParent;
 
 /* static */ PluginLibrary*
 PluginModuleContentParent::LoadModule(uint32_t aPluginId)
 {
-    SavedPluginModule saved;
-
+    MOZ_ASSERT(!sSavedModuleParent);
     MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Content);
 
     /*
      * We send a LoadPlugin message to the chrome process using an intr
-     * message. Before it sends its response, it sends a message to create a
-     * PluginModuleContentParent instance. That message is handled by
-     * PluginModuleContentParent::Create. See SavedPluginModule for details
-     * about how we match up the result of PluginModuleContentParent::Create
-     * with the LoadModule call that requested it.
+     * message. Before it sends its response, it sends a message to create
+     * PluginModuleParent instance. That message is handled by
+     * PluginModuleContentParent::Create, which saves the instance in
+     * sSavedModuleParent. We fetch it from there after LoadPlugin finishes.
      */
     dom::ContentChild* cp = dom::ContentChild::GetSingleton();
     if (!cp->CallLoadPlugin(aPluginId)) {
         return nullptr;
     }
 
-    PluginModuleContentParent* parent = saved.GetModule();
+    PluginModuleContentParent* parent = sSavedModuleParent;
     MOZ_ASSERT(parent);
+    sSavedModuleParent = nullptr;
 
     return parent;
 }
 
 /* static */ PluginModuleContentParent*
 PluginModuleContentParent::Create(mozilla::ipc::Transport* aTransport,
                                   base::ProcessId aOtherProcess)
 {
     nsAutoPtr<PluginModuleContentParent> parent(new PluginModuleContentParent());
     ProcessHandle handle;
     if (!base::OpenProcessHandle(aOtherProcess, &handle)) {
         // Bug 1090578 - need to kill |aOtherProcess|, it's boned.
         return nullptr;
     }
 
-    SavedPluginModule::SaveModule(parent);
+    MOZ_ASSERT(!sSavedModuleParent);
+    sSavedModuleParent = parent;
 
     DebugOnly<bool> ok = parent->Open(aTransport, handle, XRE_GetIOMessageLoop(),
                                       mozilla::ipc::ParentSide);
     MOZ_ASSERT(ok);
 
     // Request Windows message deferral behavior on our channel. This
     // applies to the top level and all sub plugin protocols since they
     // all share the same channel.
--- a/dom/plugins/ipc/PluginModuleParent.h
+++ b/dom/plugins/ipc/PluginModuleParent.h
@@ -269,16 +269,18 @@ class PluginModuleContentParent : public
                                              base::ProcessId aOtherProcess);
 
   private:
     explicit PluginModuleContentParent();
 
 #ifdef MOZ_CRASHREPORTER_INJECTOR
     void OnCrash(DWORD processID) MOZ_OVERRIDE {}
 #endif
+
+    static PluginModuleContentParent* sSavedModuleParent;
 };
 
 class PluginModuleChromeParent
     : public PluginModuleParent
     , public mozilla::HangMonitor::Annotator
 {
   public:
     /**