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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/extensions/ExtensionTraceProvider.js

Issue 2563383003: DevTools: add extension API to contribute trace events to timeline (Closed)
Patch Set: Review comments + better test 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 unified diff | Download patch
OLDNEW
1 /** 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 * @unrestricted 2 // Use of this source code is governed by a BSD-style license that can be
3 */ 3 // found in the LICENSE file.
4
4 Extensions.ExtensionTraceProvider = class { 5 Extensions.ExtensionTraceProvider = class {
5 /** 6 /**
6 * @param {string} extensionOrigin 7 * @param {string} extensionOrigin
7 * @param {string} id 8 * @param {string} id
8 * @param {string} categoryName 9 * @param {string} categoryName
9 * @param {string} categoryTooltip 10 * @param {string} categoryTooltip
10 */ 11 */
11 constructor(extensionOrigin, id, categoryName, categoryTooltip) { 12 constructor(extensionOrigin, id, categoryName, categoryTooltip) {
12 this._extensionOrigin = extensionOrigin; 13 this._extensionOrigin = extensionOrigin;
13 this._id = id; 14 this._id = id;
14 this._categoryName = categoryName; 15 this._categoryName = categoryName;
15 this._categoryTooltip = categoryTooltip; 16 this._categoryTooltip = categoryTooltip;
16 } 17 }
17 start() { 18
18 Extensions.extensionServer.startTraceRecording(this._id); 19 /**
20 * @param {!Extensions.TracingSession} session
21 */
22 start(session) {
23 var sessionId = String(++Extensions.ExtensionTraceProvider._lastSessionId);
24 Extensions.extensionServer.startTraceRecording(this._id, sessionId, session) ;
19 } 25 }
20 26
21 stop() { 27 stop() {
22 Extensions.extensionServer.stopTraceRecording(this._id); 28 Extensions.extensionServer.stopTraceRecording(this._id);
23 } 29 }
30
31 /**
32 * @return {string}
33 */
34 shortDisplayName() {
35 return this._categoryName;
36 }
37
38 /**
39 * @return {string}
40 */
41 longDisplayName() {
42 return this._categoryTooltip;
43 }
44
45 /**
46 * @return {string}
47 */
48 persistentIdentifier() {
49 return `${this._extensionOrigin}/${this._categoryName}`;
50 }
24 }; 51 };
52
53 Extensions.ExtensionTraceProvider._lastSessionId = 0;
54
55 /**
56 * @interface
57 */
58 Extensions.TracingSession = function() {}
59
60 Extensions.TracingSession.prototype = {
61 /**
62 * @param {string} url
63 * @param {number} timeOffsetMicroseconds
64 */
65 complete: function(url, timeOffsetMicroseconds) { }
66 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698