Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1033)

Unified Diff: third_party/WebKit/Source/devtools/front_end/extensions/ExtensionAPI.js

Issue 2563383003: DevTools: add extension API to contribute trace events to timeline (Closed)
Patch Set: lint + new compiler warnings Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/extensions/ExtensionAPI.js
diff --git a/third_party/WebKit/Source/devtools/front_end/extensions/ExtensionAPI.js b/third_party/WebKit/Source/devtools/front_end/extensions/ExtensionAPI.js
index 12251bef2af62bec18973cb0600b1fe9e521a33a..0fb007718ff04b28e8ac7fad2249fa4613582bc6 100644
--- a/third_party/WebKit/Source/devtools/front_end/extensions/ExtensionAPI.js
+++ b/third_party/WebKit/Source/devtools/front_end/extensions/ExtensionAPI.js
@@ -67,6 +67,7 @@ function defineCommonExtensionSymbols(apiPrivate) {
AddRequestHeaders: 'addRequestHeaders',
AddTraceProvider: 'addTraceProvider',
ApplyStyleSheet: 'applyStyleSheet',
+ CompleteTraceSession: 'completeTraceSession',
CreatePanel: 'createPanel',
CreateSidebarPane: 'createSidebarPane',
CreateToolbarButton: 'createToolbarButton',
@@ -368,6 +369,7 @@ function injectedExtensionAPI(extensionInfo, inspectedTabId, themeName, testHook
var PanelWithSidebar = declareInterfaceClass(PanelWithSidebarImpl);
var Request = declareInterfaceClass(RequestImpl);
var Resource = declareInterfaceClass(ResourceImpl);
+ var TraceSession = declareInterfaceClass(TraceSessionImpl);
/**
* @constructor
@@ -505,16 +507,43 @@ function injectedExtensionAPI(extensionInfo, inspectedTabId, themeName, testHook
* @constructor
* @param {string} id
*/
+ function TraceSessionImpl(id) {
+ this._id = id;
+ }
+
+ TraceSessionImpl.prototype =
+ {
+ /**
+ * @param {string=} url
+ * @param {number=} timeOffset
+ */
+ complete: function(url, timeOffset) {
+ var request = {command: commands.CompleteTraceSession, id: this._id, url: url || '', timeOffset: timeOffset || 0};
+ extensionServer.sendRequest(request);
+ }
+ };
+
+ /**
+ * @constructor
+ * @param {string} id
+ */
function TraceProvider(id) {
- this.onRecordingStarted = new EventSink(events.RecordingStarted + id);
+ /**
+ * @this {EventSinkImpl}
+ */
+ function dispatchRecordingStarted(message) {
+ var sessionId = message.arguments[0];
+ this._fire(new TraceSession(sessionId));
+ }
+
+ this.onRecordingStarted = new EventSink(events.RecordingStarted + id, dispatchRecordingStarted);
this.onRecordingStopped = new EventSink(events.RecordingStopped + id);
}
/**
* @constructor
*/
- function Audits() {
- }
+ function Audits() {}
Audits.prototype = {
/**

Powered by Google App Engine
This is Rietveld 408576698