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

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

Issue 311113002: Move inspected target events calculation into TracingTimelineModel (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase 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/TracingModel.js
diff --git a/Source/devtools/front_end/timeline/TracingModel.js b/Source/devtools/front_end/timeline/TracingModel.js
index 4300cdf73fe6cf31e5b34e333d5635f146aa9926..05a45036f538e4f305d34eee3235e55076591355 100644
--- a/Source/devtools/front_end/timeline/TracingModel.js
+++ b/Source/devtools/front_end/timeline/TracingModel.js
@@ -77,9 +77,9 @@ WebInspector.TracingModel.prototype = {
/**
* @return {!Array.<!WebInspector.TracingModel.Event>}
*/
- inspectedTargetEvents: function()
+ devtoolsMetadataEvents: function()
{
- return this._inspectedTargetEvents;
+ return this._devtoolsMetadataEvents;
},
/**
@@ -155,17 +155,6 @@ WebInspector.TracingModel.prototype = {
_tracingComplete: function()
{
this._active = false;
-
- /**
- * @param {!WebInspector.TracingModel.Event} a
- * @param {!WebInspector.TracingModel.Event} b
- */
- function compareStartTime(a, b)
- {
- return a.startTime - b.startTime;
- }
-
- this._inspectedTargetEvents.sort(compareStartTime);
if (!this._pendingStopCallback)
return;
this._pendingStopCallback();
@@ -178,8 +167,7 @@ WebInspector.TracingModel.prototype = {
this._minimumRecordTime = null;
this._maximumRecordTime = null;
this._sessionId = null;
- this._inspectedTargetProcessId = null;
- this._inspectedTargetEvents = [];
+ this._devtoolsMetadataEvents = [];
},
/**
@@ -194,10 +182,8 @@ WebInspector.TracingModel.prototype = {
}
var thread = process.threadById(payload.tid);
if (payload.ph === WebInspector.TracingModel.Phase.SnapshotObject) {
- var event = new WebInspector.TracingModel.Event(payload, 0, thread);
+ var event = thread.addEvent(payload);
process.addObject(event);
- if (payload.pid === this._inspectedTargetProcessId)
- this._inspectedTargetEvents.push(event);
return;
}
if (payload.ph !== WebInspector.TracingModel.Phase.Metadata) {
@@ -208,11 +194,11 @@ WebInspector.TracingModel.prototype = {
this._minimumRecordTime = timestamp;
if (!this._maximumRecordTime || timestamp > this._maximumRecordTime)
this._maximumRecordTime = timestamp;
- if (payload.cat === WebInspector.TracingModel.DevToolsMetadataEventCategory)
- this._processDevToolsMetadataEvent(payload);
var event = thread.addEvent(payload);
- if (event && payload.pid === this._inspectedTargetProcessId)
- this._inspectedTargetEvents.push(event);
+ if (event && event.name === WebInspector.TracingModel.DevToolsMetadataEvent.TracingStartedInPage &&
+ event.category === WebInspector.TracingModel.DevToolsMetadataEventCategory &&
+ event.args["sessionId"] === this._sessionId)
+ this._devtoolsMetadataEvents.push(event);
return;
}
switch (payload.name) {
@@ -231,16 +217,6 @@ WebInspector.TracingModel.prototype = {
}
},
- /**
- * @param {!WebInspector.TracingModel.EventPayload} payload
- */
- _processDevToolsMetadataEvent: function(payload)
- {
- if (payload.args["sessionId"] !== this._sessionId || payload.name !== WebInspector.TracingModel.DevToolsMetadataEvent.TracingStartedInPage)
- return;
- this._inspectedTargetProcessId = payload.pid;
- },
-
/**
* @return {?number}
*/
@@ -341,6 +317,16 @@ WebInspector.TracingModel.Event.prototype = {
}
/**
+ * @param {!WebInspector.TracingModel.Event} a
+ * @param {!WebInspector.TracingModel.Event} b
+ * @return {number}
+ */
+WebInspector.TracingModel.Event.compareStartTime = function (a, b)
+{
+ return a.startTime - b.startTime;
+}
+
+/**
* @constructor
*/
WebInspector.TracingModel.NamedObject = function()
@@ -412,7 +398,7 @@ WebInspector.TracingModel.Process.prototype = {
{
var thread = this._threads[id];
if (!thread) {
- thread = new WebInspector.TracingModel.Thread(id);
+ thread = new WebInspector.TracingModel.Thread(this, id);
this._threads[id] = thread;
}
return thread;
@@ -462,11 +448,13 @@ WebInspector.TracingModel.Process.prototype = {
/**
* @constructor
* @extends {WebInspector.TracingModel.NamedObject}
+ * @param {!WebInspector.TracingModel.Process} process
* @param {number} id
*/
-WebInspector.TracingModel.Thread = function(id)
+WebInspector.TracingModel.Thread = function(process, id)
{
WebInspector.TracingModel.NamedObject.call(this);
+ this._process = process;
this._setName("Thread " + id);
this._events = [];
this._stack = [];
@@ -507,6 +495,14 @@ WebInspector.TracingModel.Thread.prototype = {
},
/**
+ * @return {!WebInspector.TracingModel.Process}
+ */
+ process: function()
+ {
+ return this._process;
+ },
+
+ /**
* @return {!Array.<!WebInspector.TracingModel.Event>}
*/
events: function()
« no previous file with comments | « Source/devtools/front_end/timeline/TimelinePanel.js ('k') | Source/devtools/front_end/timeline/TracingTimelineModel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698