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

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: 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..2864956fe19ff27d23a67c639816bca91c2931ca 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() || "");
}
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,15 +614,12 @@ 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;
- }
- if (WebInspector.experimentsSettings.timelineFlameChart.isEnabled() && this._flameChartEnabledSetting.get())
+ if (WebInspector.experimentsSettings.timelineFlameChart.isEnabled() && this._flameChartEnabledSetting.get()) {
+ var tracingTimelineModel = WebInspector.experimentsSettings.timelineOnTraceEvents.isEnabled() ? this._tracingTimelineModel : null;
this._addModeView(new WebInspector.TimelineFlameChart(this, this._model, tracingTimelineModel, this._frameModel()));
- else
+ } else {
this._addModeView(this._timelineView());
+ }
if (this._captureMemorySetting.get()) {
if (!isFrameMode) // Frame mode skews time, don't render aux overviews.
@@ -643,7 +634,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 +651,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 +672,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 +681,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