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

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: Rebase once more 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 a9c0cff18cead1acc1064564bf724280f83a306b..c77a4bf726adfa80b1666b8f1b428b78affc81ae 100644
--- a/Source/devtools/front_end/timeline/TimelinePanel.js
+++ b/Source/devtools/front_end/timeline/TimelinePanel.js
@@ -60,6 +60,7 @@ importScript("PaintProfilerView.js");
* @extends {WebInspector.Panel}
* @implements {WebInspector.TimelineModeViewDelegate}
* @implements {WebInspector.Searchable}
+ * @implements {WebInspector.TargetManager.Observer}
*/
WebInspector.TimelinePanel = function()
{
@@ -93,8 +94,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);
@@ -170,6 +169,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()
@@ -725,6 +740,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");
@@ -732,7 +748,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 {
@@ -1027,7 +1043,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());
@@ -1051,7 +1067,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