From 6fe23512c2196e9c65d920e40d0329037b0979f9 Mon Sep 17 00:00:00 2001 From: Dave Huseby Date: Mon, 5 May 2014 16:41:00 -0400 Subject: [PATCH] Bug 972075 - Add profile markers from browser element event synthesis. r=BenWa, r=vingtetun --- dom/browser-element/BrowserElementParent.jsm | 20 +++++++++++++++----- toolkit/modules/Services.jsm | 3 +++ 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/dom/browser-element/BrowserElementParent.jsm b/dom/browser-element/BrowserElementParent.jsm index e24117ac6177..a2f89be4ef3b 100644 --- a/dom/browser-element/BrowserElementParent.jsm +++ b/dom/browser-element/BrowserElementParent.jsm @@ -254,9 +254,9 @@ BrowserElementParent.prototype = { "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, @@ -267,8 +267,8 @@ BrowserElementParent.prototype = { "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, @@ -407,6 +407,16 @@ BrowserElementParent.prototype = { 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|. diff --git a/toolkit/modules/Services.jsm b/toolkit/modules/Services.jsm index ae00961693b2..b2d525d1eea9 100644 --- a/toolkit/modules/Services.jsm +++ b/toolkit/modules/Services.jsm @@ -64,6 +64,9 @@ let initTable = [ ["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