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

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

Issue 397313003: DevTools: Remove target function from TimelineModel (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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 84954d5d440a58dbfe096780f4487caff0d55de5..2f122e0523d50e6b3b288484d342c83f24752e69 100644
--- a/Source/devtools/front_end/timeline/TimelinePanel.js
+++ b/Source/devtools/front_end/timeline/TimelinePanel.js
@@ -61,6 +61,7 @@ importScript("PaintProfilerView.js");
* @extends {WebInspector.Panel}
* @implements {WebInspector.TimelineModeViewDelegate}
* @implements {WebInspector.Searchable}
+ * @implements {WebInspector.TargetManager.Observer}
*/
WebInspector.TimelinePanel = function()
{
@@ -95,8 +96,6 @@ WebInspector.TimelinePanel = function()
this._model.addEventListener(WebInspector.TimelineModel.Events.RecordFilterChanged, this._refreshViews, this);
this._model.addEventListener(WebInspector.TimelineModel.Events.RecordAdded, this._onRecordAdded, this);
- this._model.target().profilingLock.addEventListener(WebInspector.Lock.Events.StateChanged, this._onProfilingStateChanged, this);
-
this._categoryFilter = new WebInspector.TimelineCategoryFilter(this._uiUtils);
this._durationFilter = new WebInspector.TimelineIsLongFilter();
this._textFilter = new WebInspector.TimelineTextFilter(this._uiUtils);
@@ -172,6 +171,22 @@ WebInspector.TimelinePanel.durationFilterPresetsMs = [0, 1, 15];
WebInspector.TimelinePanel.prototype = {
/**
+ * @param {!WebInspector.Target} target
+ */
+ targetAdded: function(target)
+ {
+ target.profilingLock.addEventListener(WebInspector.Lock.Events.StateChanged, this._onProfilingStateChanged, this);
+ },
+
+ /**
+ * @param {!WebInspector.Target} target
+ */
+ targetRemoved: function(target)
+ {
+ target.profilingLock.removeEventListener(WebInspector.Lock.Events.StateChanged, this._onProfilingStateChanged, this);
+ },
+
+ /**
* @return {?WebInspector.SearchableView}
*/
searchableView: function()
@@ -738,6 +753,7 @@ WebInspector.TimelinePanel.prototype = {
*/
_updateToggleTimelineButton: function(toggled)
{
+ var isAcquiredInSomeTarget = WebInspector.targetManager.targets().some(function(target) { return target.profilingLock.isAcquired(); });
this.toggleTimelineButton.toggled = toggled;
if (toggled) {
this.toggleTimelineButton.title = WebInspector.UIString("Stop");
@@ -745,7 +761,7 @@ WebInspector.TimelinePanel.prototype = {
} else if (this._stopPending) {
this.toggleTimelineButton.title = WebInspector.UIString("Stop pending");
this.toggleTimelineButton.setEnabled(false);
- } else if (this._model.target().profilingLock.isAcquired()) {
+ } else if (isAcquiredInSomeTarget) {
this.toggleTimelineButton.title = WebInspector.anotherProfilerActiveLabel();
this.toggleTimelineButton.setEnabled(false);
} else {
@@ -1040,7 +1056,7 @@ WebInspector.TimelinePanel.prototype = {
break;
case WebInspector.TimelineSelection.Type.TraceEvent:
var event = /** @type {!WebInspector.TracingModel.Event} */ (this._selection.object());
- WebInspector.TracingTimelineUIUtils.buildTraceEventDetails(event, this._tracingTimelineModel, this._detailsLinkifier, this._appendDetailsTabsForTraceEventAndShowDetails.bind(this, event), false, this._model.target());
+ WebInspector.TracingTimelineUIUtils.buildTraceEventDetails(event, this._tracingTimelineModel, this._detailsLinkifier, this._appendDetailsTabsForTraceEventAndShowDetails.bind(this, event), false);
break;
case WebInspector.TimelineSelection.Type.Frame:
var frame = /** @type {!WebInspector.TimelineFrame} */ (this._selection.object());
@@ -1064,7 +1080,7 @@ WebInspector.TimelinePanel.prototype = {
this.showInDetails(title, content);
if (event.picture) {
var paintProfilerView = this._paintProfilerView();
- paintProfilerView.setPicture(this._model.target().weakReference(), event.picture);
+ paintProfilerView.setPicture(event.thread.target(), event.picture);
this._detailsView.appendTab("paintProfiler", WebInspector.UIString("Paint Profiler"), paintProfilerView);
}
},

Powered by Google App Engine
This is Rietveld 408576698