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

Unified Diff: Source/devtools/front_end/timeline/TimelinePanel.js

Issue 317273004: Create Tracing{Timeline}Model in TimelinePanel constructor (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 6 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 side-by-side diff with in-line comments
Download patch
Index: Source/devtools/front_end/timeline/TimelinePanel.js
diff --git a/Source/devtools/front_end/timeline/TimelinePanel.js b/Source/devtools/front_end/timeline/TimelinePanel.js
index f677fac77737468be65cea8fb37929874c1961d8..60538f22fb7c4a13925f817bde1fb3c76b5676b9 100644
--- a/Source/devtools/front_end/timeline/TimelinePanel.js
+++ b/Source/devtools/front_end/timeline/TimelinePanel.js
@@ -92,6 +92,15 @@ WebInspector.TimelinePanel = function()
this._model.addFilter(this._durationFilter);
this._model.addFilter(this._textFilter);
+ if (WebInspector.experimentsSettings.timelineTracingMode.isEnabled() ||
+ WebInspector.experimentsSettings.timelineOnTraceEvents.isEnabled()) {
+ this._tracingModel = new WebInspector.TracingModel(WebInspector.targetManager.activeTarget());
+ this._tracingModel.addEventListener(WebInspector.TracingModel.Events.BufferUsage, this._onTracingBufferUsage, this);
+
+ this._tracingTimelineModel = new WebInspector.TracingTimelineModel(this._tracingModel);
+ this._tracingTimelineModel.addEventListener(WebInspector.TracingTimelineModel.Events.TracingComplete, this._onTracingComplete, this);
+ }
+
/** @type {!Array.<!WebInspector.TimelineModeView>} */
this._currentViews = [];
@@ -153,8 +162,6 @@ WebInspector.TimelinePanel.headerHeight = 20;
WebInspector.TimelinePanel.durationFilterPresetsMs = [0, 1, 15];
-WebInspector.TimelinePanel.defaultTracingCategoryFilter = "*,disabled-by-default-cc.debug,disabled-by-default-devtools.timeline";
-
WebInspector.TimelinePanel.prototype = {
/**
* @return {?WebInspector.SearchableView}
@@ -253,26 +260,13 @@ WebInspector.TimelinePanel.prototype = {
this._lazyFrameModel = new WebInspector.TimelineFrameModel(this._model.target());
this._lazyFrameModel.setMergeRecords(!WebInspector.experimentsSettings.timelineNoLiveUpdate.isEnabled() || !this._recordingInProgress);
this._lazyFrameModel.addRecords(this._model.records());
- if (this._lazyTracingModel)
- this._lazyFrameModel.addTraceEvents(this._tracingTimelineModel.inspectedTargetEvents(), this._lazyTracingModel.sessionId());
+ if (this._tracingModel)
+ this._lazyFrameModel.addTraceEvents(this._tracingTimelineModel.inspectedTargetEvents(), this._tracingModel.sessionId() || "");
caseq 2014/06/06 09:03:18 nit: this could as well be if (this._tracingModel
yurys 2014/06/06 09:13:56 Done.
yurys 2014/06/06 09:16:51 In fact compiler will keep complaining in that cas
}
return this._lazyFrameModel;
},
/**
- * @return {!WebInspector.TracingModel}
- */
- _tracingModel: function()
- {
- if (!this._lazyTracingModel) {
- this._lazyTracingModel = new WebInspector.TracingModel(WebInspector.targetManager.activeTarget());
- this._lazyTracingModel.addEventListener(WebInspector.TracingModel.Events.BufferUsage, this._onTracingBufferUsage, this);
- this._tracingTimelineModel = new WebInspector.TracingTimelineModel(this._lazyTracingModel);
- }
- return this._lazyTracingModel;
- },
-
- /**
* @return {!WebInspector.TimelineView}
*/
_timelineView: function()
@@ -620,11 +614,7 @@ WebInspector.TimelinePanel.prototype = {
else
this._overviewControls.push(new WebInspector.TimelineEventOverview(this._model));
- var tracingTimelineModel = null;
- if (WebInspector.experimentsSettings.timelineOnTraceEvents.isEnabled()) {
- this._tracingModel();
- tracingTimelineModel = this._tracingTimelineModel;
- }
+ var tracingTimelineModel = WebInspector.experimentsSettings.timelineOnTraceEvents.isEnabled() ? this._tracingTimelineModel : null;
caseq 2014/06/06 09:03:18 nit: put it under the next if, closer to the only
yurys 2014/06/06 09:13:57 Done.
if (WebInspector.experimentsSettings.timelineFlameChart.isEnabled() && this._flameChartEnabledSetting.get())
this._addModeView(new WebInspector.TimelineFlameChart(this, this._model, tracingTimelineModel, this._frameModel()));
else
@@ -643,7 +633,7 @@ WebInspector.TimelinePanel.prototype = {
}
if (this._captureTracingSetting && this._captureTracingSetting.get())
- this._addModeView(new WebInspector.TimelineTracingView(this, this._tracingModel(), this._model));
+ this._addModeView(new WebInspector.TimelineTracingView(this, this._tracingModel, this._model));
this._timelineView().setFrameModel(isFrameMode ? this._frameModel() : null);
this._overviewPane.setOverviewControls(this._overviewControls);
@@ -660,18 +650,12 @@ WebInspector.TimelinePanel.prototype = {
{
this._userInitiatedRecording = userInitiated;
if (WebInspector.experimentsSettings.timelineOnTraceEvents.isEnabled()) {
- var categories = ["disabled-by-default-devtools.timeline", "devtools"];
- if (this._captureStacksSetting.get())
- categories.push("disabled-by-default-devtools.timeline.stack");
this._model.willStartRecordingTraceEvents();
- this._tracingModel().start(categories.join(","), "");
- this._tracingTimelineModel.willStartRecordingTraceEvents();
+ this._tracingTimelineModel.startRecording(this._captureStacksSetting.get(), this._captureMemorySetting.get());
} else {
this._model.startRecording(this._captureStacksSetting.get(), this._captureMemorySetting.get());
- if (WebInspector.experimentsSettings.timelineTracingMode.isEnabled()) {
- this._tracingModel().start(WebInspector.TimelinePanel.defaultTracingCategoryFilter, "");
- this._tracingTimelineModel.willStartRecordingTraceEvents();
- }
+ if (this._captureTracingSetting && this._captureTracingSetting.get())
+ this._tracingTimelineModel.startRecording(this._captureStacksSetting.get(), this._captureMemorySetting.get());
}
if (WebInspector.experimentsSettings.timelineNoLiveUpdate.isEnabled() && this._lazyFrameModel)
this._lazyFrameModel.setMergeRecords(false);
@@ -687,8 +671,8 @@ WebInspector.TimelinePanel.prototype = {
{
this._userInitiatedRecording = false;
this._model.stopRecording();
- if (this._lazyTracingModel)
- this._lazyTracingModel.stop(this._onTracingComplete.bind(this));
+ if (this._tracingTimelineModel)
+ this._tracingTimelineModel.stopRecording()
for (var i = 0; i < this._overviewControls.length; ++i)
this._overviewControls[i].timelineStopped();
@@ -696,10 +680,9 @@ WebInspector.TimelinePanel.prototype = {
_onTracingComplete: function()
{
- this._tracingTimelineModel.didStopRecordingTraceEvents();
if (this._lazyFrameModel) {
this._lazyFrameModel.reset();
- this._lazyFrameModel.addTraceEvents(this._tracingTimelineModel.inspectedTargetEvents(), this._lazyTracingModel.sessionId());
+ this._lazyFrameModel.addTraceEvents(this._tracingTimelineModel.inspectedTargetEvents(), this._tracingModel.sessionId());
this._overviewPane.update();
}
if (WebInspector.experimentsSettings.timelineOnTraceEvents.isEnabled())
« no previous file with comments | « LayoutTests/inspector/layers/tracing-layer-tree.html ('k') | Source/devtools/front_end/timeline/TracingTimelineModel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698