Backed out changeset 8feb113aaba7 (bug 1277075)
authorIris Hsiao <ihsiao@mozilla.com>
Wed, 20 Jul 2016 14:13:35 +0800
changeset 330612 df92a916d7ad13c2f2db267ac79d9c69b2bfb3ec
parent 330611 b4ddb57e3e2c59cce70132156e82d6cfd314c026
child 330613 3383b0da1a14340ec6096aca542eb73b0f7341d5
child 330865 cc98fa9758625dad454895ee1206451464ca1a58
push id9858
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 14:37:10 +0000
treeherdermozilla-aurora@203106ef6cb6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1277075
milestone50.0a1
backs out8feb113aaba70ddc53811a9ffc2a1c597767128c
Backed out changeset 8feb113aaba7 (bug 1277075)
dom/ipc/ContentProcess.h
dom/plugins/ipc/PluginProcessChild.cpp
dom/plugins/ipc/PluginProcessChild.h
toolkit/xre/nsAppRunner.cpp
--- a/dom/ipc/ContentProcess.h
+++ b/dom/ipc/ContentProcess.h
@@ -6,20 +6,16 @@
 
 #ifndef dom_tabs_ContentThread_h
 #define dom_tabs_ContentThread_h 1
 
 #include "mozilla/ipc/ProcessChild.h"
 #include "mozilla/ipc/ScopedXREEmbed.h"
 #include "ContentChild.h"
 
-#if defined(XP_WIN)
-#include "mozilla/mscom/MainThreadRuntime.h"
-#endif
-
 namespace mozilla {
 namespace dom {
 
 /**
  * ContentProcess is a singleton on the content process which represents
  * the main thread where tab instances live.
  */
 class ContentProcess : public mozilla::ipc::ProcessChild
@@ -37,20 +33,16 @@ public:
   virtual bool Init() override;
   virtual void CleanUp() override;
 
   void SetAppDir(const nsACString& aPath);
 
 private:
   ContentChild mContent;
   mozilla::ipc::ScopedXREEmbed mXREEmbed;
-#if defined(XP_WIN)
-  // This object initializes and configures COM.
-  mozilla::mscom::MainThreadRuntime mCOMRuntime;
-#endif
 
   DISALLOW_EVIL_CONSTRUCTORS(ContentProcess);
 };
 
 } // namespace dom
 } // namespace mozilla
 
 #endif  // ifndef dom_tabs_ContentThread_h
--- a/dom/plugins/ipc/PluginProcessChild.cpp
+++ b/dom/plugins/ipc/PluginProcessChild.cpp
@@ -16,16 +16,17 @@
 #if defined(XP_MACOSX)
 #include "nsCocoaFeatures.h"
 // An undocumented CoreGraphics framework method, present in the same form
 // since at least OS X 10.5.
 extern "C" CGError CGSSetDebugOptions(int options);
 #endif
 
 #ifdef XP_WIN
+#include <objbase.h>
 bool ShouldProtectPluginCurrentDirectory(char16ptr_t pluginFilePath);
 #if defined(MOZ_SANDBOX)
 #define TARGET_SANDBOX_EXPORTS
 #include "mozilla/sandboxTarget.h"
 #endif
 #endif
 
 using mozilla::ipc::IOThreadChild;
@@ -75,16 +76,22 @@ PluginProcessChild::Init()
             }
             // Values passed to PR_SetEnv() must be seperately allocated.
             char* setInterposePtr = strdup(setInterpose.get());
             PR_SetEnv(setInterposePtr);
         }
     }
 #endif
 
+#ifdef XP_WIN
+    // Drag-and-drop needs OleInitialize to be called, and Silverlight depends
+    // on the host calling CoInitialize (which is called by OleInitialize).
+    ::OleInitialize(nullptr);
+#endif
+
     // Certain plugins, such as flash, steal the unhandled exception filter
     // thus we never get crash reports when they fault. This call fixes it.
     message_loop()->set_exception_restoration(true);
 
     std::string pluginFilename;
 
 #if defined(OS_POSIX)
     // NB: need to be very careful in ensuring that the first arg
@@ -137,13 +144,16 @@ PluginProcessChild::Init()
     }
 #endif
     return retval;
 }
 
 void
 PluginProcessChild::CleanUp()
 {
+#ifdef XP_WIN
+    ::OleUninitialize();
+#endif
     nsRegion::ShutdownStatic();
 }
 
 } // namespace plugins
 } // namespace mozilla
--- a/dom/plugins/ipc/PluginProcessChild.h
+++ b/dom/plugins/ipc/PluginProcessChild.h
@@ -5,20 +5,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef dom_plugins_PluginProcessChild_h
 #define dom_plugins_PluginProcessChild_h 1
 
 #include "mozilla/ipc/ProcessChild.h"
 #include "mozilla/plugins/PluginModuleChild.h"
 
-#if defined(XP_WIN)
-#include "mozilla/mscom/MainThreadRuntime.h"
-#endif
-
 namespace mozilla {
 namespace plugins {
 //-----------------------------------------------------------------------------
 
 class PluginProcessChild : public mozilla::ipc::ProcessChild {
 protected:
     typedef mozilla::ipc::ProcessChild ProcessChild;
 
@@ -34,21 +30,16 @@ public:
     virtual void CleanUp() override;
 
 protected:
     static PluginProcessChild* current() {
         return static_cast<PluginProcessChild*>(ProcessChild::current());
     }
 
 private:
-#if defined(XP_WIN)
-    /* Drag-and-drop and Silverlight depend on the host initializing COM.
-     * This object initializes and configures COM. */
-    mozilla::mscom::MainThreadRuntime mCOMRuntime;
-#endif
     PluginModuleChild mPlugin;
 
     DISALLOW_EVIL_CONSTRUCTORS(PluginProcessChild);
 };
 
 } // namespace plugins
 } // namespace mozilla
 
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -92,17 +92,16 @@
 
 #ifdef XP_WIN
 #include "nsIWinAppHelper.h"
 #include <windows.h>
 #include <intrin.h>
 #include <math.h>
 #include "cairo/cairo-features.h"
 #include "mozilla/WindowsVersion.h"
-#include "mozilla/mscom/MainThreadRuntime.h"
 #include "mozilla/widget/AudioSession.h"
 
 #ifndef PROCESS_DEP_ENABLE
 #define PROCESS_DEP_ENABLE 0x1
 #endif
 #endif
 
 #if (defined(XP_WIN) || defined(XP_MACOSX)) && defined(MOZ_CONTENT_SANDBOX)
@@ -4299,24 +4298,16 @@ XREMain::XRE_main(int argc, char* argv[]
   rv = XRE_GetBinaryPath(argv[0], getter_AddRefs(binFile));
   NS_ENSURE_SUCCESS(rv, 1);
 
   rv = binFile->GetPath(gAbsoluteArgv0Path);
   NS_ENSURE_SUCCESS(rv, 1);
 
   mozilla::IOInterposerInit ioInterposerGuard;
 
-#if defined(XP_WIN)
-  // Some COM settings are global to the process and must be set before any non-
-  // trivial COM is run in the application. Since these settings may affect
-  // stability, we should instantiate COM ASAP so that we can ensure that these
-  // global settings are configured before anything can interfere.
-  mozilla::mscom::MainThreadRuntime msCOMRuntime;
-#endif
-
 #if MOZ_WIDGET_GTK == 2
   XRE_GlibInit();
 #endif
 
   // init
   bool exit = false;
   int result = XRE_mainInit(&exit);
   if (result != 0 || exit)