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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sdk/TracingModel.js

Issue 2378843003: Timeline: fix screenshots for headless shell (Closed)
Patch Set: Created 4 years, 2 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2014 The Chromium Authors. All rights reserved. 2 * Copyright 2014 The Chromium Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 6
7 /** 7 /**
8 * @constructor 8 * @constructor
9 * @param {!WebInspector.BackingStorage} backingStorage 9 * @param {!WebInspector.BackingStorage} backingStorage
10 */ 10 */
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 var scope = payload.scope || ""; 110 var scope = payload.scope || "";
111 if (typeof payload.id2 === "undefined") 111 if (typeof payload.id2 === "undefined")
112 return scope && payload.id ? `${scope}@${payload.id}` : payload.id; 112 return scope && payload.id ? `${scope}@${payload.id}` : payload.id;
113 var id2 = payload.id2; 113 var id2 = payload.id2;
114 if (typeof id2 === "object" && ("global" in id2) !== ("local" in id2)) 114 if (typeof id2 === "object" && ("global" in id2) !== ("local" in id2))
115 return typeof id2["global"] !== "undefined" ? `:${scope}:${id2["global"] }` : `:${scope}:${payload.pid}:${id2["local"]}`; 115 return typeof id2["global"] !== "undefined" ? `:${scope}:${id2["global"] }` : `:${scope}:${payload.pid}:${id2["local"]}`;
116 console.error(`Unexpected id2 field at ${payload.ts / 1000}, one and only on e of 'local' and 'global' should be present.`); 116 console.error(`Unexpected id2 field at ${payload.ts / 1000}, one and only on e of 'local' and 'global' should be present.`);
117 } 117 }
118 118
119 /** 119 /**
120 * @param {!WebInspector.TracingModel} tracingModel
121 * @return {?WebInspector.TracingModel.Thread}
122 *
123 * FIXME: this is here just for convenience of re-use between modules.
alph 2016/09/29 00:12:53 TODO
124 * This really belongs to a higher level, since it is specific to chrome's
125 * usage of tracing.
126 */
127 WebInspector.TracingModel.browserMainThread = function(tracingModel)
128 {
129 var processes = tracingModel.sortedProcesses();
130 var browserProcess = [];
alph 2016/09/29 00:12:53 nit: browserProcesses
131 var crRendererMainThreads = [];
132 for (var process of processes) {
133 if (process.name().toLowerCase().endsWith("Browser"))
alph 2016/09/29 00:12:53 browser
134 browserProcess.push(process);
135 crRendererMainThreads.push(...process.sortedThreads().filter(t => t.name () === "CrBrowserMain"));
136 }
137 if (crRendererMainThreads.length === 1)
138 return crRendererMainThreads[0];
139 if (browserProcess.length === 1)
140 return browserProcess[0].threadByName("CrBrowserMain");
141 var tracingStartedInBrowser = tracingModel.devToolsMetadataEvents().filter(e => e.name === "TracingStartedInBrowser");
142 if (tracingStartedInBrowser.length === 1)
143 return tracingStartedInBrowser[0].thread;
144 WebInspector.console.error("Failed to find browser main thread in trace, som e timeline features may be unavailable");
145 return null;
146 }
147
148 /**
120 * @interface 149 * @interface
121 */ 150 */
122 WebInspector.BackingStorage = function() 151 WebInspector.BackingStorage = function()
123 { 152 {
124 } 153 }
125 154
126 WebInspector.BackingStorage.prototype = { 155 WebInspector.BackingStorage.prototype = {
127 /** 156 /**
128 * @param {string} string 157 * @param {string} string
129 */ 158 */
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after
947 /** 976 /**
948 * @return {!Array.<!WebInspector.TracingModel.AsyncEvent>} 977 * @return {!Array.<!WebInspector.TracingModel.AsyncEvent>}
949 */ 978 */
950 asyncEvents: function() 979 asyncEvents: function()
951 { 980 {
952 return this._asyncEvents; 981 return this._asyncEvents;
953 }, 982 },
954 983
955 __proto__: WebInspector.TracingModel.NamedObject.prototype 984 __proto__: WebInspector.TracingModel.NamedObject.prototype
956 } 985 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698