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

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

Issue 717243002: Timeline: do not imply event.thread.target is the main target (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove test expectation from moved test Created 6 years, 1 month 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/TimelineFrameModel.js
diff --git a/Source/devtools/front_end/timeline/TimelineFrameModel.js b/Source/devtools/front_end/timeline/TimelineFrameModel.js
index 13383635664f49c37353dba8fe66709e141ef267..b907544ae50610072d4ddb572a6059b12c82477a 100644
--- a/Source/devtools/front_end/timeline/TimelineFrameModel.js
+++ b/Source/devtools/front_end/timeline/TimelineFrameModel.js
@@ -215,11 +215,13 @@ WebInspector.TimelineFrameModelBase.prototype = {
/**
* @constructor
+ * @param {?WebInspector.Target} target
* @extends {WebInspector.TimelineFrameModelBase}
*/
-WebInspector.TracingTimelineFrameModel = function()
+WebInspector.TracingTimelineFrameModel = function(target)
{
WebInspector.TimelineFrameModelBase.call(this);
+ this._target = target;
}
WebInspector.TracingTimelineFrameModel._mainFrameMarkers = [
@@ -255,16 +257,17 @@ WebInspector.TracingTimelineFrameModel.prototype = {
if (event.name === eventNames.SetLayerTreeId) {
if (this._sessionId === event.args["sessionId"])
this._layerTreeId = event.args["layerTreeId"];
- return;
- }
- if (event.name === eventNames.TracingStartedInPage) {
+ } else if (event.name === eventNames.TracingStartedInPage) {
this._mainThread = event.thread;
- return;
- }
- if (event.thread === this._mainThread)
+ } else if (event.phase === WebInspector.TracingModel.Phase.SnapshotObject && event.name === eventNames.LayerTreeHostImplSnapshot && parseInt(event.id, 0) === this._layerTreeId) {
+ var snapshot = /** @type {!WebInspector.TracingModel.ObjectSnapshot} */ (event);
+ this.handleLayerTreeSnapshot(new WebInspector.DeferredTracingLayerTree(snapshot, this._target));
+ } else if (event.thread === this._mainThread) {
this._addMainThreadTraceEvent(event);
- else
+ }
+ else {
alph 2014/11/13 11:11:40 should be on the previous line
this._addBackgroundTraceEvent(event);
+ }
},
/**
@@ -273,11 +276,6 @@ WebInspector.TracingTimelineFrameModel.prototype = {
_addBackgroundTraceEvent: function(event)
{
var eventNames = WebInspector.TimelineModel.RecordType;
- if (event.phase === WebInspector.TracingModel.Phase.SnapshotObject && event.name === eventNames.LayerTreeHostImplSnapshot && parseInt(event.id, 0) === this._layerTreeId) {
- var snapshot = /** @type {!WebInspector.TracingModel.ObjectSnapshot} */ (event);
- this.handleLayerTreeSnapshot(new WebInspector.DeferredTracingLayerTree(snapshot));
- return;
- }
if (this._lastFrame && event.selfTime)
this._lastFrame._addTimeForCategory(WebInspector.TimelineUIUtils.eventStyle(event).category.name, event.selfTime);
@@ -321,8 +319,8 @@ WebInspector.TracingTimelineFrameModel.prototype = {
this._framePendingCommit = new WebInspector.PendingFrame();
if (!this._framePendingCommit)
return;
- if (event.name === eventNames.Paint && event.args["data"]["layerId"] && event.picture)
- this._framePendingCommit.paints.push(new WebInspector.LayerPaintEvent(event));
+ if (event.name === eventNames.Paint && event.args["data"]["layerId"] && event.picture && this._target)
+ this._framePendingCommit.paints.push(new WebInspector.LayerPaintEvent(event, this._target));
if (selfTime) {
var categoryName = WebInspector.TimelineUIUtils.eventStyle(event).category.name;
@@ -339,10 +337,11 @@ WebInspector.TracingTimelineFrameModel.prototype = {
* @constructor
* @extends {WebInspector.DeferredLayerTree}
* @param {!WebInspector.TracingModel.ObjectSnapshot} snapshot
+ * @param {?WebInspector.Target} target
*/
-WebInspector.DeferredTracingLayerTree = function(snapshot)
+WebInspector.DeferredTracingLayerTree = function(snapshot, target)
{
- WebInspector.DeferredLayerTree.call(this, snapshot.thread.target());
+ WebInspector.DeferredLayerTree.call(this, target);
this._snapshot = snapshot;
}
@@ -471,10 +470,12 @@ WebInspector.TimelineFrame.prototype = {
/**
* @constructor
* @param {!WebInspector.TracingModel.Event} event
+ * @param {!WebInspector.Target} target
*/
-WebInspector.LayerPaintEvent = function(event)
+WebInspector.LayerPaintEvent = function(event, target)
{
this._event = event;
+ this._target = target;
}
WebInspector.LayerPaintEvent.prototype = {
@@ -499,19 +500,19 @@ WebInspector.LayerPaintEvent.prototype = {
*/
loadPicture: function(callback)
{
- var target = this._event.thread.target();
- this._event.picture.requestObject(onGotObject);
+ this._event.picture.requestObject(onGotObject.bind(this));
/**
* @param {?Object} result
+ * @this {WebInspector.LayerPaintEvent}
*/
function onGotObject(result)
{
- if (!result || !result["skp64"] || !target) {
+ if (!result || !result["skp64"]) {
callback(null, null);
return;
}
var rect = result["params"] && result["params"]["layer_rect"];
- WebInspector.PaintProfilerSnapshot.load(target, result["skp64"], callback.bind(null, rect));
+ WebInspector.PaintProfilerSnapshot.load(this._target, result["skp64"], callback.bind(null, rect));
}
}
};
« no previous file with comments | « Source/devtools/front_end/timeline/TimelineFlameChart.js ('k') | Source/devtools/front_end/timeline/TimelineModel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698