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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/timeline/TimelinePanel.js

Issue 2073343002: Timeline addTraceProvider API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: checkbox prototype Created 4 years, 6 months 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 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2012 Intel Inc. All rights reserved. 3 * Copyright (C) 2012 Intel Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 // Create models. 60 // Create models.
61 this._tracingModelBackingStorage = new WebInspector.TempFileBackingStorage(" tracing"); 61 this._tracingModelBackingStorage = new WebInspector.TempFileBackingStorage(" tracing");
62 this._tracingModel = new WebInspector.TracingModel(this._tracingModelBacking Storage); 62 this._tracingModel = new WebInspector.TracingModel(this._tracingModelBacking Storage);
63 this._model = new WebInspector.TimelineModel(WebInspector.TimelineUIUtils.vi sibleEventsFilter()); 63 this._model = new WebInspector.TimelineModel(WebInspector.TimelineUIUtils.vi sibleEventsFilter());
64 this._frameModel = new WebInspector.TimelineFrameModel(event => WebInspector .TimelineUIUtils.eventStyle(event).category.name); 64 this._frameModel = new WebInspector.TimelineFrameModel(event => WebInspector .TimelineUIUtils.eventStyle(event).category.name);
65 this._irModel = new WebInspector.TimelineIRModel(); 65 this._irModel = new WebInspector.TimelineIRModel();
66 66
67 if (Runtime.experiments.isEnabled("cpuThrottling")) 67 if (Runtime.experiments.isEnabled("cpuThrottling"))
68 this._cpuThrottlingManager = new WebInspector.CPUThrottlingManager(); 68 this._cpuThrottlingManager = new WebInspector.CPUThrottlingManager();
69 69
70 // Create extension trace providers.
71 this._traceProvidersById = {};
caseq 2016/06/21 07:29:51 We prefer using maps in the new code, i.e. /**
72 this._captureExtensionSettings = {};
caseq 2016/06/21 07:29:51 ditto.
73 var extensionTraceProviders = WebInspector.extensionServer.traceProviders();
74 for (var i = 0; i < extensionTraceProviders.length; ++i) {
75 var provider = extensionTraceProviders[i];
caseq 2016/06/21 07:29:51 nit: for (var provider of extensionTraceProviders)
76 this.addTraceProvider(provider);
77 this._captureExtensionSettings[provider.id] = WebInspector.settings.crea teSetting(provider.categoryName, false);
78 }
79
70 /** @type {!Array.<!WebInspector.TimelineModeView>} */ 80 /** @type {!Array.<!WebInspector.TimelineModeView>} */
71 this._currentViews = []; 81 this._currentViews = [];
72 82
73 this._captureNetworkSetting = WebInspector.settings.createSetting("timelineC aptureNetwork", false); 83 this._captureNetworkSetting = WebInspector.settings.createSetting("timelineC aptureNetwork", false);
74 this._captureJSProfileSetting = WebInspector.settings.createSetting("timelin eEnableJSSampling", true); 84 this._captureJSProfileSetting = WebInspector.settings.createSetting("timelin eEnableJSSampling", true);
75 this._captureMemorySetting = WebInspector.settings.createSetting("timelineCa ptureMemory", false); 85 this._captureMemorySetting = WebInspector.settings.createSetting("timelineCa ptureMemory", false);
76 this._captureLayersAndPicturesSetting = WebInspector.settings.createSetting( "timelineCaptureLayersAndPictures", false); 86 this._captureLayersAndPicturesSetting = WebInspector.settings.createSetting( "timelineCaptureLayersAndPictures", false);
77 this._captureFilmStripSetting = WebInspector.settings.createSetting("timelin eCaptureFilmStrip", false); 87 this._captureFilmStripSetting = WebInspector.settings.createSetting("timelin eCaptureFilmStrip", false);
78 88
79 this._panelToolbar = new WebInspector.Toolbar("", this.element); 89 this._panelToolbar = new WebInspector.Toolbar("", this.element);
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 StopPending: Symbol("StopPending"), 165 StopPending: Symbol("StopPending"),
156 Loading: Symbol("Loading") 166 Loading: Symbol("Loading")
157 } 167 }
158 168
159 // Define row and header height, should be in sync with styles for timeline grap hs. 169 // Define row and header height, should be in sync with styles for timeline grap hs.
160 WebInspector.TimelinePanel.rowHeight = 18; 170 WebInspector.TimelinePanel.rowHeight = 18;
161 WebInspector.TimelinePanel.headerHeight = 20; 171 WebInspector.TimelinePanel.headerHeight = 20;
162 172
163 WebInspector.TimelinePanel.prototype = { 173 WebInspector.TimelinePanel.prototype = {
164 /** 174 /**
175 * @return {!Object.<string, !WebInspector.ExtensionTraceProvider>}
176 */
177 get traceProvidersById()
caseq 2016/06/21 07:29:51 do you need to expose this? Also, we avoid getters
178 {
179 return this._traceProvidersById;
180 },
181
182 addTraceProvider: function(provider)
183 {
184 this._traceProvidersById[provider.id] = provider;
185 },
186
187 /**
188 * @param {string} id
189 * @return {!WebInspector.ExtensionTraceProvider}
190 */
191 getTraceProvider: function(id)
caseq 2016/06/21 07:29:51 not sure you need to expose any of these (also: pl
192 {
193 return this.traceProvidersById[id];
194 },
195
196 /**
165 * @override 197 * @override
166 * @return {?WebInspector.SearchableView} 198 * @return {?WebInspector.SearchableView}
167 */ 199 */
168 searchableView: function() 200 searchableView: function()
169 { 201 {
170 return this._searchableView; 202 return this._searchableView;
171 }, 203 },
172 204
173 wasShown: function() 205 wasShown: function()
174 { 206 {
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 if (!Runtime.experiments.isEnabled("timelineRecordingPerspectives") || p erspectiveSetting.get() === WebInspector.TimelinePanel.Perspectives.Custom) { 415 if (!Runtime.experiments.isEnabled("timelineRecordingPerspectives") || p erspectiveSetting.get() === WebInspector.TimelinePanel.Perspectives.Custom) {
384 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox( 416 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox(
385 WebInspector.UIString("Network"), this._captureNetworkSetting, W ebInspector.UIString("Show network requests information"))); 417 WebInspector.UIString("Network"), this._captureNetworkSetting, W ebInspector.UIString("Show network requests information")));
386 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox( 418 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox(
387 WebInspector.UIString("JS Profile"), this._captureJSProfileSetti ng, WebInspector.UIString("Capture JavaScript stacks with sampling profiler. (Ha s small performance overhead)"))); 419 WebInspector.UIString("JS Profile"), this._captureJSProfileSetti ng, WebInspector.UIString("Capture JavaScript stacks with sampling profiler. (Ha s small performance overhead)")));
388 this._panelToolbar.appendToolbarItem(screenshotCheckbox); 420 this._panelToolbar.appendToolbarItem(screenshotCheckbox);
389 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox( 421 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox(
390 WebInspector.UIString("Memory"), this._captureMemorySetting, Web Inspector.UIString("Capture memory information on every timeline event."))); 422 WebInspector.UIString("Memory"), this._captureMemorySetting, Web Inspector.UIString("Capture memory information on every timeline event.")));
391 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox( 423 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox(
392 WebInspector.UIString("Paint"), this._captureLayersAndPicturesSe tting, WebInspector.UIString("Capture graphics layer positions and rasterization draw calls. (Has large performance overhead)"))); 424 WebInspector.UIString("Paint"), this._captureLayersAndPicturesSe tting, WebInspector.UIString("Capture graphics layer positions and rasterization draw calls. (Has large performance overhead)")));
425 for (var s in this._captureExtensionSettings) {
caseq 2016/06/21 07:29:51 I guess you also want to handle TraceProviderAdded
426 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox (
427 WebInspector.UIString(this._traceProvidersById[s].categoryNa me), this._captureExtensionSettings[s], WebInspector.UIString(this._traceProvide rsById[s].categoryTooltip)));
428 }
429
393 } else { 430 } else {
394 this._panelToolbar.appendToolbarItem(screenshotCheckbox); 431 this._panelToolbar.appendToolbarItem(screenshotCheckbox);
395 } 432 }
396 433
397 this._captureNetworkSetting.addChangeListener(this._onNetworkChanged, th is); 434 this._captureNetworkSetting.addChangeListener(this._onNetworkChanged, th is);
398 this._captureMemorySetting.addChangeListener(this._onModeChanged, this); 435 this._captureMemorySetting.addChangeListener(this._onModeChanged, this);
399 this._captureFilmStripSetting.addChangeListener(this._onModeChanged, thi s); 436 this._captureFilmStripSetting.addChangeListener(this._onModeChanged, thi s);
400 437
401 this._panelToolbar.appendSeparator(); 438 this._panelToolbar.appendSeparator();
402 var garbageCollectButton = new WebInspector.ToolbarButton(WebInspector.U IString("Collect garbage"), "garbage-collect-toolbar-item"); 439 var garbageCollectButton = new WebInspector.ToolbarButton(WebInspector.U IString("Collect garbage"), "garbage-collect-toolbar-item");
(...skipping 1634 matching lines...) Expand 10 before | Expand all | Expand 10 after
2037 * @override 2074 * @override
2038 * @param {!WebInspector.Target} target 2075 * @param {!WebInspector.Target} target
2039 */ 2076 */
2040 targetRemoved: function(target) 2077 targetRemoved: function(target)
2041 { 2078 {
2042 this._targets.remove(target, true); 2079 this._targets.remove(target, true);
2043 }, 2080 },
2044 2081
2045 __proto__: WebInspector.Object.prototype 2082 __proto__: WebInspector.Object.prototype
2046 } 2083 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698