Bug 972075 - Add profile markers from browser element event synthesis. r=BenWa, r=vingtetun
authorDave Huseby <dhuseby@mozilla.com>
Mon, 05 May 2014 16:41:00 -0400
changeset 201404 42c2a08c6f7df29e69d8930eebeb9ad8a3002de0
parent 201403 dde446669ba615e56e80f194d0686a292c1ced13
child 201405 c473e32ea4303aa57ad8d74f93283198e49e0891
push id3741
push userasasaki@mozilla.com
push dateMon, 21 Jul 2014 20:25:18 +0000
treeherdermozilla-beta@4d6f46f5af68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersBenWa, vingtetun
bugs972075
milestone32.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 972075 - Add profile markers from browser element event synthesis. r=BenWa, r=vingtetun
dom/browser-element/BrowserElementParent.jsm
toolkit/modules/Services.jsm
--- a/dom/browser-element/BrowserElementParent.jsm
+++ b/dom/browser-element/BrowserElementParent.jsm
@@ -249,31 +249,31 @@ BrowserElementParent.prototype = {
     // Messages we receive are handed to functions which take a (data) argument,
     // where |data| is the message manager's data object.
     // We use a single message and dispatch to various function based
     // on data.msg_name
     let mmCalls = {
       "hello": this._recvHello,
       "contextmenu": this._fireCtxMenuEvent,
       "locationchange": this._fireEventFromMsg,
-      "loadstart": this._fireEventFromMsg,
-      "loadend": this._fireEventFromMsg,
-      "titlechange": this._fireEventFromMsg,
+      "loadstart": this._fireProfiledEventFromMsg,
+      "loadend": this._fireProfiledEventFromMsg,
+      "titlechange": this._fireProfiledEventFromMsg,
       "iconchange": this._fireEventFromMsg,
       "manifestchange": this._fireEventFromMsg,
       "metachange": this._fireEventFromMsg,
       "close": this._fireEventFromMsg,
       "resize": this._fireEventFromMsg,
       "activitydone": this._fireEventFromMsg,
       "opensearch": this._fireEventFromMsg,
       "securitychange": this._fireEventFromMsg,
       "error": this._fireEventFromMsg,
       "scroll": this._fireEventFromMsg,
-      "firstpaint": this._fireEventFromMsg,
-      "documentfirstpaint": this._fireEventFromMsg,
+      "firstpaint": this._fireProfiledEventFromMsg,
+      "documentfirstpaint": this._fireProfiledEventFromMsg,
       "nextpaint": this._recvNextPaint,
       "keyevent": this._fireKeyEvent,
       "showmodalprompt": this._handleShowModalPrompt,
       "got-purge-history": this._gotDOMRequestResult,
       "got-screenshot": this._gotDOMRequestResult,
       "got-can-go-back": this._gotDOMRequestResult,
       "got-can-go-forward": this._gotDOMRequestResult,
       "fullscreen-origin-change": this._remoteFullscreenOriginChange,
@@ -403,16 +403,26 @@ BrowserElementParent.prototype = {
 
     // The embedder may have default actions on context menu events, so
     // we fire a context menu event even if the child didn't define a
     // custom context menu
     return !this._frameElement.dispatchEvent(evt);
   },
 
   /**
+   * add profiler marker for each event fired.
+   */
+  _fireProfiledEventFromMsg: function(data) {
+    if (Services.profiler !== undefined) {
+      Services.profiler.AddMarker(data.json.msg_name);
+    }
+    this._fireEventFromMsg(data);
+  },
+
+  /**
    * Fire either a vanilla or a custom event, depending on the contents of
    * |data|.
    */
   _fireEventFromMsg: function(data) {
     let detail = data.json;
     let name = detail.msg_name;
 
     // For events that send a "_payload_" property, we just want to transmit
--- a/toolkit/modules/Services.jsm
+++ b/toolkit/modules/Services.jsm
@@ -59,16 +59,19 @@ let initTable = [
   ["droppedLinkHandler", "@mozilla.org/content/dropped-link-handler;1", "nsIDroppedLinkHandler"],
   ["eTLD", "@mozilla.org/network/effective-tld-service;1", "nsIEffectiveTLDService"],
   ["io", "@mozilla.org/network/io-service;1", "nsIIOService2"],
   ["locale", "@mozilla.org/intl/nslocaleservice;1", "nsILocaleService"],
   ["logins", "@mozilla.org/login-manager;1", "nsILoginManager"],
   ["obs", "@mozilla.org/observer-service;1", "nsIObserverService"],
   ["perms", "@mozilla.org/permissionmanager;1", "nsIPermissionManager"],
   ["prompt", "@mozilla.org/embedcomp/prompt-service;1", "nsIPromptService"],
+#ifdef MOZ_ENABLE_PROFILER_SPS
+  ["profiler", "@mozilla.org/tools/profiler;1", "nsIProfiler"],
+#endif
   ["scriptloader", "@mozilla.org/moz/jssubscript-loader;1", "mozIJSSubScriptLoader"],
   ["scriptSecurityManager", "@mozilla.org/scriptsecuritymanager;1", "nsIScriptSecurityManager"],
 #ifdef MOZ_TOOLKIT_SEARCH
   ["search", "@mozilla.org/browser/search-service;1", "nsIBrowserSearchService"],
 #endif
   ["storage", "@mozilla.org/storage/service;1", "mozIStorageService"],
   ["domStorageManager", "@mozilla.org/dom/localStorage-manager;1", "nsIDOMStorageManager"],
   ["strings", "@mozilla.org/intl/stringbundle;1", "nsIStringBundleService"],