Bug 1454038 - 1. Share EventDispatcher among frame scripts; r=esawin
authorJim Chen <nchen@mozilla.com>
Tue, 17 Apr 2018 16:13:38 -0400
changeset 467663 b572a19f4d5ba377ecd69e1ae6d8cb792cb44e78
parent 467662 a89554c69f614a0ca5f8e9868e4cb4cd15fde1ce
child 467664 e4e4dd6ca0c91437d4bc6d3a91a959150934023a
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersesawin
bugs1454038
milestone61.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 1454038 - 1. Share EventDispatcher among frame scripts; r=esawin In order to be more efficient, use the same EventDispatcher instance among different frame scripts for the same frame. MozReview-Commit-ID: 1jZ3zW7NBeC
mobile/android/modules/geckoview/GeckoViewContentModule.jsm
--- a/mobile/android/modules/geckoview/GeckoViewContentModule.jsm
+++ b/mobile/android/modules/geckoview/GeckoViewContentModule.jsm
@@ -6,34 +6,36 @@
 
 var EXPORTED_SYMBOLS = ["GeckoViewContentModule"];
 
 ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 ChromeUtils.import("resource://gre/modules/GeckoViewUtils.jsm");
 
 GeckoViewUtils.initLogging("GeckoView.Module.[C]", this);
 
-ChromeUtils.defineModuleGetter(this, "EventDispatcher",
-  "resource://gre/modules/Messaging.jsm");
-
 class GeckoViewContentModule {
   static initLogging(aModuleName) {
     this._moduleName = aModuleName;
     const tag = aModuleName.replace("GeckoView", "GeckoView.") + ".[C]";
     return GeckoViewUtils.initLogging(tag, {});
   }
 
   static create(aGlobal, aModuleName) {
     return new this(aModuleName || this._moduleName, aGlobal);
   }
 
-  constructor(aModuleName, aMessageManager) {
+  constructor(aModuleName, aGlobal) {
     this.moduleName = aModuleName;
-    this.messageManager = aMessageManager;
-    this.eventDispatcher = EventDispatcher.forMessageManager(aMessageManager);
+    this.messageManager = aGlobal;
+
+    if (!aGlobal._gvEventDispatcher) {
+      aGlobal._gvEventDispatcher =
+          GeckoViewUtils.getDispatcherForWindow(aGlobal.content);
+    }
+    this.eventDispatcher = aGlobal._gvEventDispatcher;
 
     this.messageManager.addMessageListener(
       "GeckoView:UpdateSettings",
       aMsg => {
         this.settings = aMsg.data;
         this.onSettingsUpdate();
       }
     );