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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/timeline/TimelineUIUtils.js

Issue 2440953003: DevTools: use semicolons after each statement. (Closed)
Patch Set: rebaseline Created 4 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * Copyright (C) 2012 Intel Inc. All rights reserved. 3 * Copyright (C) 2012 Intel Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 14 matching lines...) Expand all
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32 /** 32 /**
33 * @constructor 33 * @constructor
34 */ 34 */
35 WebInspector.TimelineUIUtils = function() { } 35 WebInspector.TimelineUIUtils = function() { };
36 36
37 /** 37 /**
38 * @constructor 38 * @constructor
39 * @param {string} title 39 * @param {string} title
40 * @param {!WebInspector.TimelineCategory} category 40 * @param {!WebInspector.TimelineCategory} category
41 * @param {boolean=} hidden 41 * @param {boolean=} hidden
42 */ 42 */
43 WebInspector.TimelineRecordStyle = function(title, category, hidden) 43 WebInspector.TimelineRecordStyle = function(title, category, hidden)
44 { 44 {
45 this.title = title; 45 this.title = title;
46 this.category = category; 46 this.category = category;
47 this.hidden = !!hidden; 47 this.hidden = !!hidden;
48 } 48 };
49 49
50 /** 50 /**
51 * @return {!Object.<string, !WebInspector.TimelineRecordStyle>} 51 * @return {!Object.<string, !WebInspector.TimelineRecordStyle>}
52 */ 52 */
53 WebInspector.TimelineUIUtils._initEventStyles = function() 53 WebInspector.TimelineUIUtils._initEventStyles = function()
54 { 54 {
55 if (WebInspector.TimelineUIUtils._eventStylesMap) 55 if (WebInspector.TimelineUIUtils._eventStylesMap)
56 return WebInspector.TimelineUIUtils._eventStylesMap; 56 return WebInspector.TimelineUIUtils._eventStylesMap;
57 57
58 var recordTypes = WebInspector.TimelineModel.RecordType; 58 var recordTypes = WebInspector.TimelineModel.RecordType;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 eventStyles[recordTypes.ResizeImage] = new WebInspector.TimelineRecordStyle( WebInspector.UIString("Image Resize"), categories["painting"]); 122 eventStyles[recordTypes.ResizeImage] = new WebInspector.TimelineRecordStyle( WebInspector.UIString("Image Resize"), categories["painting"]);
123 eventStyles[recordTypes.GPUTask] = new WebInspector.TimelineRecordStyle(WebI nspector.UIString("GPU"), categories["gpu"]); 123 eventStyles[recordTypes.GPUTask] = new WebInspector.TimelineRecordStyle(WebI nspector.UIString("GPU"), categories["gpu"]);
124 eventStyles[recordTypes.LatencyInfo] = new WebInspector.TimelineRecordStyle( WebInspector.UIString("Input Latency"), categories["scripting"]); 124 eventStyles[recordTypes.LatencyInfo] = new WebInspector.TimelineRecordStyle( WebInspector.UIString("Input Latency"), categories["scripting"]);
125 125
126 eventStyles[recordTypes.GCIdleLazySweep] = new WebInspector.TimelineRecordSt yle(WebInspector.UIString("DOM GC"), categories["scripting"]); 126 eventStyles[recordTypes.GCIdleLazySweep] = new WebInspector.TimelineRecordSt yle(WebInspector.UIString("DOM GC"), categories["scripting"]);
127 eventStyles[recordTypes.GCCompleteSweep] = new WebInspector.TimelineRecordSt yle(WebInspector.UIString("DOM GC"), categories["scripting"]); 127 eventStyles[recordTypes.GCCompleteSweep] = new WebInspector.TimelineRecordSt yle(WebInspector.UIString("DOM GC"), categories["scripting"]);
128 eventStyles[recordTypes.GCCollectGarbage] = new WebInspector.TimelineRecordS tyle(WebInspector.UIString("DOM GC"), categories["scripting"]); 128 eventStyles[recordTypes.GCCollectGarbage] = new WebInspector.TimelineRecordS tyle(WebInspector.UIString("DOM GC"), categories["scripting"]);
129 129
130 WebInspector.TimelineUIUtils._eventStylesMap = eventStyles; 130 WebInspector.TimelineUIUtils._eventStylesMap = eventStyles;
131 return eventStyles; 131 return eventStyles;
132 } 132 };
133 133
134 /** 134 /**
135 * @param {!WebInspector.TimelineIRModel.InputEvents} inputEventType 135 * @param {!WebInspector.TimelineIRModel.InputEvents} inputEventType
136 * @return {?string} 136 * @return {?string}
137 */ 137 */
138 WebInspector.TimelineUIUtils.inputEventDisplayName = function(inputEventType) 138 WebInspector.TimelineUIUtils.inputEventDisplayName = function(inputEventType)
139 { 139 {
140 if (!WebInspector.TimelineUIUtils._inputEventToDisplayName) { 140 if (!WebInspector.TimelineUIUtils._inputEventToDisplayName) {
141 var inputEvent = WebInspector.TimelineIRModel.InputEvents; 141 var inputEvent = WebInspector.TimelineIRModel.InputEvents;
142 142
(...skipping 21 matching lines...) Expand all
164 [inputEvent.TouchCancel, WebInspector.UIString("Touch Cancel")], 164 [inputEvent.TouchCancel, WebInspector.UIString("Touch Cancel")],
165 [inputEvent.TouchEnd, WebInspector.UIString("Touch End")], 165 [inputEvent.TouchEnd, WebInspector.UIString("Touch End")],
166 [inputEvent.TouchMove, WebInspector.UIString("Touch Move")], 166 [inputEvent.TouchMove, WebInspector.UIString("Touch Move")],
167 [inputEvent.TouchStart, WebInspector.UIString("Touch Start")], 167 [inputEvent.TouchStart, WebInspector.UIString("Touch Start")],
168 [inputEvent.PinchBegin, WebInspector.UIString("Pinch Begin")], 168 [inputEvent.PinchBegin, WebInspector.UIString("Pinch Begin")],
169 [inputEvent.PinchEnd, WebInspector.UIString("Pinch End")], 169 [inputEvent.PinchEnd, WebInspector.UIString("Pinch End")],
170 [inputEvent.PinchUpdate, WebInspector.UIString("Pinch Update")] 170 [inputEvent.PinchUpdate, WebInspector.UIString("Pinch Update")]
171 ]); 171 ]);
172 } 172 }
173 return WebInspector.TimelineUIUtils._inputEventToDisplayName.get(inputEventT ype) || null; 173 return WebInspector.TimelineUIUtils._inputEventToDisplayName.get(inputEventT ype) || null;
174 } 174 };
175 175
176 /** 176 /**
177 * @param {!WebInspector.TracingModel.Event} traceEvent 177 * @param {!WebInspector.TracingModel.Event} traceEvent
178 * @param {!RegExp} regExp 178 * @param {!RegExp} regExp
179 * @return {boolean} 179 * @return {boolean}
180 */ 180 */
181 WebInspector.TimelineUIUtils.testContentMatching = function(traceEvent, regExp) 181 WebInspector.TimelineUIUtils.testContentMatching = function(traceEvent, regExp)
182 { 182 {
183 var title = WebInspector.TimelineUIUtils.eventStyle(traceEvent).title; 183 var title = WebInspector.TimelineUIUtils.eventStyle(traceEvent).title;
184 var tokens = [title]; 184 var tokens = [title];
185 if (traceEvent.url) 185 if (traceEvent.url)
186 tokens.push(traceEvent.url); 186 tokens.push(traceEvent.url);
187 for (var argName in traceEvent.args) { 187 for (var argName in traceEvent.args) {
188 var argValue = traceEvent.args[argName]; 188 var argValue = traceEvent.args[argName];
189 for (var key in argValue) 189 for (var key in argValue)
190 tokens.push(argValue[key]); 190 tokens.push(argValue[key]);
191 } 191 }
192 return regExp.test(tokens.join("|")); 192 return regExp.test(tokens.join("|"));
193 } 193 };
194 194
195 /** 195 /**
196 * @param {!WebInspector.TimelineModel.Record} record 196 * @param {!WebInspector.TimelineModel.Record} record
197 * @return {!WebInspector.TimelineCategory} 197 * @return {!WebInspector.TimelineCategory}
198 */ 198 */
199 WebInspector.TimelineUIUtils.categoryForRecord = function(record) 199 WebInspector.TimelineUIUtils.categoryForRecord = function(record)
200 { 200 {
201 return WebInspector.TimelineUIUtils.eventStyle(record.traceEvent()).category ; 201 return WebInspector.TimelineUIUtils.eventStyle(record.traceEvent()).category ;
202 } 202 };
203 203
204 204
205 /** 205 /**
206 * @param {!WebInspector.TracingModel.Event} event 206 * @param {!WebInspector.TracingModel.Event} event
207 * @return {!{title: string, category: !WebInspector.TimelineCategory}} 207 * @return {!{title: string, category: !WebInspector.TimelineCategory}}
208 */ 208 */
209 WebInspector.TimelineUIUtils.eventStyle = function(event) 209 WebInspector.TimelineUIUtils.eventStyle = function(event)
210 { 210 {
211 var eventStyles = WebInspector.TimelineUIUtils._initEventStyles(); 211 var eventStyles = WebInspector.TimelineUIUtils._initEventStyles();
212 if (event.hasCategory(WebInspector.TimelineModel.Category.Console) || event. hasCategory(WebInspector.TimelineModel.Category.UserTiming)) 212 if (event.hasCategory(WebInspector.TimelineModel.Category.Console) || event. hasCategory(WebInspector.TimelineModel.Category.UserTiming))
213 return { title: event.name, category: WebInspector.TimelineUIUtils.categ ories()["scripting"] }; 213 return { title: event.name, category: WebInspector.TimelineUIUtils.categ ories()["scripting"] };
214 214
215 if (event.hasCategory(WebInspector.TimelineModel.Category.LatencyInfo)) { 215 if (event.hasCategory(WebInspector.TimelineModel.Category.LatencyInfo)) {
216 /** @const */ 216 /** @const */
217 var prefix = "InputLatency::"; 217 var prefix = "InputLatency::";
218 var inputEventType = event.name.startsWith(prefix) ? event.name.substr(p refix.length) : event.name; 218 var inputEventType = event.name.startsWith(prefix) ? event.name.substr(p refix.length) : event.name;
219 var displayName = WebInspector.TimelineUIUtils.inputEventDisplayName(/** @type {!WebInspector.TimelineIRModel.InputEvents} */ (inputEventType)); 219 var displayName = WebInspector.TimelineUIUtils.inputEventDisplayName(/** @type {!WebInspector.TimelineIRModel.InputEvents} */ (inputEventType));
220 return { title: displayName || inputEventType, category: WebInspector.Ti melineUIUtils.categories()["scripting"] }; 220 return { title: displayName || inputEventType, category: WebInspector.Ti melineUIUtils.categories()["scripting"] };
221 } 221 }
222 var result = eventStyles[event.name]; 222 var result = eventStyles[event.name];
223 if (!result) { 223 if (!result) {
224 result = new WebInspector.TimelineRecordStyle(event.name, WebInspector. TimelineUIUtils.categories()["other"], true); 224 result = new WebInspector.TimelineRecordStyle(event.name, WebInspector. TimelineUIUtils.categories()["other"], true);
225 eventStyles[event.name] = result; 225 eventStyles[event.name] = result;
226 } 226 }
227 return result; 227 return result;
228 } 228 };
229 229
230 /** 230 /**
231 * @param {!WebInspector.TracingModel.Event} event 231 * @param {!WebInspector.TracingModel.Event} event
232 * @return {string} 232 * @return {string}
233 */ 233 */
234 WebInspector.TimelineUIUtils.eventColor = function(event) 234 WebInspector.TimelineUIUtils.eventColor = function(event)
235 { 235 {
236 if (event.name === WebInspector.TimelineModel.RecordType.JSFrame) { 236 if (event.name === WebInspector.TimelineModel.RecordType.JSFrame) {
237 var frame = event.args["data"]; 237 var frame = event.args["data"];
238 if (WebInspector.TimelineUIUtils.isUserFrame(frame)) 238 if (WebInspector.TimelineUIUtils.isUserFrame(frame))
239 return WebInspector.TimelineUIUtils.colorForURL(frame.url); 239 return WebInspector.TimelineUIUtils.colorForURL(frame.url);
240 } 240 }
241 return WebInspector.TimelineUIUtils.eventStyle(event).category.color; 241 return WebInspector.TimelineUIUtils.eventStyle(event).category.color;
242 } 242 };
243 243
244 /** 244 /**
245 * @param {!WebInspector.TracingModel.Event} event 245 * @param {!WebInspector.TracingModel.Event} event
246 * @return {string} 246 * @return {string}
247 */ 247 */
248 WebInspector.TimelineUIUtils.eventTitle = function(event) 248 WebInspector.TimelineUIUtils.eventTitle = function(event)
249 { 249 {
250 var title = WebInspector.TimelineUIUtils.eventStyle(event).title; 250 var title = WebInspector.TimelineUIUtils.eventStyle(event).title;
251 if (event.hasCategory(WebInspector.TimelineModel.Category.Console)) 251 if (event.hasCategory(WebInspector.TimelineModel.Category.Console))
252 return title; 252 return title;
253 if (event.name === WebInspector.TimelineModel.RecordType.TimeStamp) 253 if (event.name === WebInspector.TimelineModel.RecordType.TimeStamp)
254 return WebInspector.UIString("%s: %s", title, event.args["data"]["messag e"]); 254 return WebInspector.UIString("%s: %s", title, event.args["data"]["messag e"]);
255 if (event.name === WebInspector.TimelineModel.RecordType.Animation && event. args["data"] && event.args["data"]["name"]) 255 if (event.name === WebInspector.TimelineModel.RecordType.Animation && event. args["data"] && event.args["data"]["name"])
256 return WebInspector.UIString("%s: %s", title, event.args["data"]["name"] ); 256 return WebInspector.UIString("%s: %s", title, event.args["data"]["name"] );
257 return title; 257 return title;
258 } 258 };
259 259
260 /** 260 /**
261 * @param {!WebInspector.TracingModel.Event} event 261 * @param {!WebInspector.TracingModel.Event} event
262 * @return {?string} 262 * @return {?string}
263 */ 263 */
264 WebInspector.TimelineUIUtils.eventURL = function(event) 264 WebInspector.TimelineUIUtils.eventURL = function(event)
265 { 265 {
266 if (event.url) 266 if (event.url)
267 return event.url; 267 return event.url;
268 var data = event.args["data"] || event.args["beginData"]; 268 var data = event.args["data"] || event.args["beginData"];
269 return data && data.url || null; 269 return data && data.url || null;
270 } 270 };
271 271
272 /** 272 /**
273 * !Map<!WebInspector.TimelineIRModel.Phases, !{color: string, label: string}> 273 * !Map<!WebInspector.TimelineIRModel.Phases, !{color: string, label: string}>
274 */ 274 */
275 WebInspector.TimelineUIUtils._interactionPhaseStyles = function() 275 WebInspector.TimelineUIUtils._interactionPhaseStyles = function()
276 { 276 {
277 var map = WebInspector.TimelineUIUtils._interactionPhaseStylesMap; 277 var map = WebInspector.TimelineUIUtils._interactionPhaseStylesMap;
278 if (!map) { 278 if (!map) {
279 map = new Map([ 279 map = new Map([
280 [WebInspector.TimelineIRModel.Phases.Idle, {color: "white", label: " Idle"}], 280 [WebInspector.TimelineIRModel.Phases.Idle, {color: "white", label: " Idle"}],
281 [WebInspector.TimelineIRModel.Phases.Response, {color: "hsl(43, 83%, 64%)", label: WebInspector.UIString("Response")}], 281 [WebInspector.TimelineIRModel.Phases.Response, {color: "hsl(43, 83%, 64%)", label: WebInspector.UIString("Response")}],
282 [WebInspector.TimelineIRModel.Phases.Scroll, {color: "hsl(256, 67%, 70%)", label: WebInspector.UIString("Scroll")}], 282 [WebInspector.TimelineIRModel.Phases.Scroll, {color: "hsl(256, 67%, 70%)", label: WebInspector.UIString("Scroll")}],
283 [WebInspector.TimelineIRModel.Phases.Fling, {color: "hsl(256, 67%, 7 0%)", label: WebInspector.UIString("Fling")}], 283 [WebInspector.TimelineIRModel.Phases.Fling, {color: "hsl(256, 67%, 7 0%)", label: WebInspector.UIString("Fling")}],
284 [WebInspector.TimelineIRModel.Phases.Drag, {color: "hsl(256, 67%, 70 %)", label: WebInspector.UIString("Drag")}], 284 [WebInspector.TimelineIRModel.Phases.Drag, {color: "hsl(256, 67%, 70 %)", label: WebInspector.UIString("Drag")}],
285 [WebInspector.TimelineIRModel.Phases.Animation, {color: "hsl(256, 67 %, 70%)", label: WebInspector.UIString("Animation")}], 285 [WebInspector.TimelineIRModel.Phases.Animation, {color: "hsl(256, 67 %, 70%)", label: WebInspector.UIString("Animation")}],
286 [WebInspector.TimelineIRModel.Phases.Uncategorized, {color: "hsl(0, 0%, 87%)", label: WebInspector.UIString("Uncategorized")}] 286 [WebInspector.TimelineIRModel.Phases.Uncategorized, {color: "hsl(0, 0%, 87%)", label: WebInspector.UIString("Uncategorized")}]
287 ]); 287 ]);
288 WebInspector.TimelineUIUtils._interactionPhaseStylesMap = map; 288 WebInspector.TimelineUIUtils._interactionPhaseStylesMap = map;
289 } 289 }
290 return map; 290 return map;
291 } 291 };
292 292
293 /** 293 /**
294 * @param {!WebInspector.TimelineIRModel.Phases} phase 294 * @param {!WebInspector.TimelineIRModel.Phases} phase
295 * @return {string} 295 * @return {string}
296 */ 296 */
297 WebInspector.TimelineUIUtils.interactionPhaseColor = function(phase) 297 WebInspector.TimelineUIUtils.interactionPhaseColor = function(phase)
298 { 298 {
299 return WebInspector.TimelineUIUtils._interactionPhaseStyles().get(phase).col or; 299 return WebInspector.TimelineUIUtils._interactionPhaseStyles().get(phase).col or;
300 } 300 };
301 301
302 /** 302 /**
303 * @param {!WebInspector.TimelineIRModel.Phases} phase 303 * @param {!WebInspector.TimelineIRModel.Phases} phase
304 * @return {string} 304 * @return {string}
305 */ 305 */
306 WebInspector.TimelineUIUtils.interactionPhaseLabel = function(phase) 306 WebInspector.TimelineUIUtils.interactionPhaseLabel = function(phase)
307 { 307 {
308 return WebInspector.TimelineUIUtils._interactionPhaseStyles().get(phase).lab el; 308 return WebInspector.TimelineUIUtils._interactionPhaseStyles().get(phase).lab el;
309 } 309 };
310 310
311 /** 311 /**
312 * @param {!RuntimeAgent.CallFrame} frame 312 * @param {!RuntimeAgent.CallFrame} frame
313 * @return {boolean} 313 * @return {boolean}
314 */ 314 */
315 WebInspector.TimelineUIUtils.isUserFrame = function(frame) 315 WebInspector.TimelineUIUtils.isUserFrame = function(frame)
316 { 316 {
317 return frame.scriptId !== "0" && !(frame.url && frame.url.startsWith("native ")); 317 return frame.scriptId !== "0" && !(frame.url && frame.url.startsWith("native "));
318 } 318 };
319 319
320 /** 320 /**
321 * @param {!WebInspector.TracingModel.Event} event 321 * @param {!WebInspector.TracingModel.Event} event
322 * @return {?RuntimeAgent.CallFrame} 322 * @return {?RuntimeAgent.CallFrame}
323 */ 323 */
324 WebInspector.TimelineUIUtils.topStackFrame = function(event) 324 WebInspector.TimelineUIUtils.topStackFrame = function(event)
325 { 325 {
326 var stackTrace = event.stackTrace || event.initiator && event.initiator.stac kTrace; 326 var stackTrace = event.stackTrace || event.initiator && event.initiator.stac kTrace;
327 return stackTrace && stackTrace.length ? stackTrace[0] : null; 327 return stackTrace && stackTrace.length ? stackTrace[0] : null;
328 } 328 };
329 329
330 /** 330 /**
331 * @enum {symbol} 331 * @enum {symbol}
332 */ 332 */
333 WebInspector.TimelineUIUtils.NetworkCategory = { 333 WebInspector.TimelineUIUtils.NetworkCategory = {
334 HTML: Symbol("HTML"), 334 HTML: Symbol("HTML"),
335 Script: Symbol("Script"), 335 Script: Symbol("Script"),
336 Style: Symbol("Style"), 336 Style: Symbol("Style"),
337 Media: Symbol("Media"), 337 Media: Symbol("Media"),
338 Other: Symbol("Other") 338 Other: Symbol("Other")
339 } 339 };
340 340
341 /** 341 /**
342 * @param {!WebInspector.TimelineModel.NetworkRequest} request 342 * @param {!WebInspector.TimelineModel.NetworkRequest} request
343 * @return {!WebInspector.TimelineUIUtils.NetworkCategory} 343 * @return {!WebInspector.TimelineUIUtils.NetworkCategory}
344 */ 344 */
345 WebInspector.TimelineUIUtils.networkRequestCategory = function(request) 345 WebInspector.TimelineUIUtils.networkRequestCategory = function(request)
346 { 346 {
347 var categories = WebInspector.TimelineUIUtils.NetworkCategory; 347 var categories = WebInspector.TimelineUIUtils.NetworkCategory;
348 switch (request.mimeType) { 348 switch (request.mimeType) {
349 case "text/html": 349 case "text/html":
(...skipping 11 matching lines...) Expand all
361 case "image/svg+xml": 361 case "image/svg+xml":
362 case "image/webp": 362 case "image/webp":
363 case "image/x-icon": 363 case "image/x-icon":
364 case "font/opentype": 364 case "font/opentype":
365 case "font/woff2": 365 case "font/woff2":
366 case "application/font-woff": 366 case "application/font-woff":
367 return categories.Media; 367 return categories.Media;
368 default: 368 default:
369 return categories.Other; 369 return categories.Other;
370 } 370 }
371 } 371 };
372 372
373 /** 373 /**
374 * @param {!WebInspector.TimelineUIUtils.NetworkCategory} category 374 * @param {!WebInspector.TimelineUIUtils.NetworkCategory} category
375 * @return {string} 375 * @return {string}
376 */ 376 */
377 WebInspector.TimelineUIUtils.networkCategoryColor = function(category) 377 WebInspector.TimelineUIUtils.networkCategoryColor = function(category)
378 { 378 {
379 var categories = WebInspector.TimelineUIUtils.NetworkCategory; 379 var categories = WebInspector.TimelineUIUtils.NetworkCategory;
380 switch (category) { 380 switch (category) {
381 case categories.HTML: return "hsl(214, 67%, 66%)"; 381 case categories.HTML: return "hsl(214, 67%, 66%)";
382 case categories.Script: return "hsl(43, 83%, 64%)"; 382 case categories.Script: return "hsl(43, 83%, 64%)";
383 case categories.Style: return "hsl(256, 67%, 70%)"; 383 case categories.Style: return "hsl(256, 67%, 70%)";
384 case categories.Media: return "hsl(109, 33%, 55%)"; 384 case categories.Media: return "hsl(109, 33%, 55%)";
385 default: return "hsl(0, 0%, 70%)"; 385 default: return "hsl(0, 0%, 70%)";
386 } 386 }
387 } 387 };
388 388
389 /** 389 /**
390 * @param {!WebInspector.TracingModel.Event} event 390 * @param {!WebInspector.TracingModel.Event} event
391 * @param {?WebInspector.Target} target 391 * @param {?WebInspector.Target} target
392 * @return {?string} 392 * @return {?string}
393 */ 393 */
394 WebInspector.TimelineUIUtils.buildDetailsTextForTraceEvent = function(event, tar get) 394 WebInspector.TimelineUIUtils.buildDetailsTextForTraceEvent = function(event, tar get)
395 { 395 {
396 var recordType = WebInspector.TimelineModel.RecordType; 396 var recordType = WebInspector.TimelineModel.RecordType;
397 var detailsText; 397 var detailsText;
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 if (!frame) 516 if (!frame)
517 return null; 517 return null;
518 var text = linkifyLocationAsText(frame.scriptId, frame.lineNumber, frame .columnNumber); 518 var text = linkifyLocationAsText(frame.scriptId, frame.lineNumber, frame .columnNumber);
519 if (!text) { 519 if (!text) {
520 text = frame.url; 520 text = frame.url;
521 if (typeof frame.lineNumber === "number") 521 if (typeof frame.lineNumber === "number")
522 text += ":" + (frame.lineNumber + 1); 522 text += ":" + (frame.lineNumber + 1);
523 } 523 }
524 return text; 524 return text;
525 } 525 }
526 } 526 };
527 527
528 /** 528 /**
529 * @param {!WebInspector.TracingModel.Event} event 529 * @param {!WebInspector.TracingModel.Event} event
530 * @param {?WebInspector.Target} target 530 * @param {?WebInspector.Target} target
531 * @param {!WebInspector.Linkifier} linkifier 531 * @param {!WebInspector.Linkifier} linkifier
532 * @return {?Node} 532 * @return {?Node}
533 */ 533 */
534 WebInspector.TimelineUIUtils.buildDetailsNodeForTraceEvent = function(event, tar get, linkifier) 534 WebInspector.TimelineUIUtils.buildDetailsNodeForTraceEvent = function(event, tar get, linkifier)
535 { 535 {
536 var recordType = WebInspector.TimelineModel.RecordType; 536 var recordType = WebInspector.TimelineModel.RecordType;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 } 614 }
615 615
616 /** 616 /**
617 * @return {?Element} 617 * @return {?Element}
618 */ 618 */
619 function linkifyTopCallFrame() 619 function linkifyTopCallFrame()
620 { 620 {
621 var frame = WebInspector.TimelineUIUtils.topStackFrame(event); 621 var frame = WebInspector.TimelineUIUtils.topStackFrame(event);
622 return frame ? linkifier.maybeLinkifyConsoleCallFrame(target, frame, "ti meline-details") : null; 622 return frame ? linkifier.maybeLinkifyConsoleCallFrame(target, frame, "ti meline-details") : null;
623 } 623 }
624 } 624 };
625 625
626 /** 626 /**
627 * @param {!WebInspector.TracingModel.Event} event 627 * @param {!WebInspector.TracingModel.Event} event
628 * @param {!WebInspector.TimelineModel} model 628 * @param {!WebInspector.TimelineModel} model
629 * @param {!WebInspector.Linkifier} linkifier 629 * @param {!WebInspector.Linkifier} linkifier
630 * @param {boolean} detailed 630 * @param {boolean} detailed
631 * @param {function(!DocumentFragment)} callback 631 * @param {function(!DocumentFragment)} callback
632 */ 632 */
633 WebInspector.TimelineUIUtils.buildTraceEventDetails = function(event, model, lin kifier, detailed, callback) 633 WebInspector.TimelineUIUtils.buildTraceEventDetails = function(event, model, lin kifier, detailed, callback)
634 { 634 {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 */ 670 */
671 function setRelatedNodeMap(nodeMap) 671 function setRelatedNodeMap(nodeMap)
672 { 672 {
673 relatedNodes = nodeMap; 673 relatedNodes = nodeMap;
674 } 674 }
675 675
676 function callbackWrapper() 676 function callbackWrapper()
677 { 677 {
678 callback(WebInspector.TimelineUIUtils._buildTraceEventDetailsSynchronous ly(event, model, linkifier, detailed, relatedNodes)); 678 callback(WebInspector.TimelineUIUtils._buildTraceEventDetailsSynchronous ly(event, model, linkifier, detailed, relatedNodes));
679 } 679 }
680 } 680 };
681 681
682 /** 682 /**
683 * @param {!WebInspector.TracingModel.Event} event 683 * @param {!WebInspector.TracingModel.Event} event
684 * @param {!WebInspector.TimelineModel} model 684 * @param {!WebInspector.TimelineModel} model
685 * @param {!WebInspector.Linkifier} linkifier 685 * @param {!WebInspector.Linkifier} linkifier
686 * @param {boolean} detailed 686 * @param {boolean} detailed
687 * @param {?Map<number, ?WebInspector.DOMNode>} relatedNodesMap 687 * @param {?Map<number, ?WebInspector.DOMNode>} relatedNodesMap
688 * @return {!DocumentFragment} 688 * @return {!DocumentFragment}
689 */ 689 */
690 WebInspector.TimelineUIUtils._buildTraceEventDetailsSynchronously = function(eve nt, model, linkifier, detailed, relatedNodesMap) 690 WebInspector.TimelineUIUtils._buildTraceEventDetailsSynchronously = function(eve nt, model, linkifier, detailed, relatedNodesMap)
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 WebInspector.TimelineUIUtils._generateCauses(event, model.targetByEvent( event), relatedNodesMap, contentHelper); 865 WebInspector.TimelineUIUtils._generateCauses(event, model.targetByEvent( event), relatedNodesMap, contentHelper);
866 866
867 var showPieChart = detailed && WebInspector.TimelineUIUtils._aggregatedStats ForTraceEvent(stats, model, event); 867 var showPieChart = detailed && WebInspector.TimelineUIUtils._aggregatedStats ForTraceEvent(stats, model, event);
868 if (showPieChart) { 868 if (showPieChart) {
869 contentHelper.addSection(WebInspector.UIString("Aggregated Time")); 869 contentHelper.addSection(WebInspector.UIString("Aggregated Time"));
870 var pieChart = WebInspector.TimelineUIUtils.generatePieChart(stats, WebI nspector.TimelineUIUtils.eventStyle(event).category, event.selfTime); 870 var pieChart = WebInspector.TimelineUIUtils.generatePieChart(stats, WebI nspector.TimelineUIUtils.eventStyle(event).category, event.selfTime);
871 contentHelper.appendElementRow("", pieChart); 871 contentHelper.appendElementRow("", pieChart);
872 } 872 }
873 873
874 return contentHelper.fragment; 874 return contentHelper.fragment;
875 } 875 };
876 876
877 WebInspector.TimelineUIUtils._aggregatedStatsKey = Symbol("aggregatedStats"); 877 WebInspector.TimelineUIUtils._aggregatedStatsKey = Symbol("aggregatedStats");
878 878
879 /** 879 /**
880 * @param {!WebInspector.TimelineModel} model 880 * @param {!WebInspector.TimelineModel} model
881 * @param {number} startTime 881 * @param {number} startTime
882 * @param {number} endTime 882 * @param {number} endTime
883 * @return {!DocumentFragment} 883 * @return {!DocumentFragment}
884 */ 884 */
885 WebInspector.TimelineUIUtils.buildRangeStats = function(model, startTime, endTim e) 885 WebInspector.TimelineUIUtils.buildRangeStats = function(model, startTime, endTim e)
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
922 aggregatedStats["idle"] = Math.max(0, endTime - startTime - aggregatedTotal) ; 922 aggregatedStats["idle"] = Math.max(0, endTime - startTime - aggregatedTotal) ;
923 923
924 var startOffset = startTime - model.minimumRecordTime(); 924 var startOffset = startTime - model.minimumRecordTime();
925 var endOffset = endTime - model.minimumRecordTime(); 925 var endOffset = endTime - model.minimumRecordTime();
926 926
927 var contentHelper = new WebInspector.TimelineDetailsContentHelper(null, null ); 927 var contentHelper = new WebInspector.TimelineDetailsContentHelper(null, null );
928 contentHelper.addSection(WebInspector.UIString("Range: %s \u2013 %s", Numbe r.millisToString(startOffset), Number.millisToString(endOffset))); 928 contentHelper.addSection(WebInspector.UIString("Range: %s \u2013 %s", Numbe r.millisToString(startOffset), Number.millisToString(endOffset)));
929 var pieChart = WebInspector.TimelineUIUtils.generatePieChart(aggregatedStats ); 929 var pieChart = WebInspector.TimelineUIUtils.generatePieChart(aggregatedStats );
930 contentHelper.appendElementRow("", pieChart); 930 contentHelper.appendElementRow("", pieChart);
931 return contentHelper.fragment; 931 return contentHelper.fragment;
932 } 932 };
933 933
934 /** 934 /**
935 * @param {!WebInspector.TimelineModel.Record} record 935 * @param {!WebInspector.TimelineModel.Record} record
936 * @param {number} startTime 936 * @param {number} startTime
937 * @param {number} endTime 937 * @param {number} endTime
938 * @param {!Object} aggregatedStats 938 * @param {!Object} aggregatedStats
939 */ 939 */
940 WebInspector.TimelineUIUtils._collectAggregatedStatsForRecord = function(record, startTime, endTime, aggregatedStats) 940 WebInspector.TimelineUIUtils._collectAggregatedStatsForRecord = function(record, startTime, endTime, aggregatedStats)
941 { 941 {
942 var records = []; 942 var records = [];
943 943
944 if (!record.endTime() || record.endTime() < startTime || record.startTime() > endTime) 944 if (!record.endTime() || record.endTime() < startTime || record.startTime() > endTime)
945 return; 945 return;
946 946
947 var childrenTime = 0; 947 var childrenTime = 0;
948 var children = record.children() || []; 948 var children = record.children() || [];
949 for (var i = 0; i < children.length; ++i) { 949 for (var i = 0; i < children.length; ++i) {
950 var child = children[i]; 950 var child = children[i];
951 if (!child.endTime() || child.endTime() < startTime || child.startTime() > endTime) 951 if (!child.endTime() || child.endTime() < startTime || child.startTime() > endTime)
952 continue; 952 continue;
953 childrenTime += Math.min(endTime, child.endTime()) - Math.max(startTime, child.startTime()); 953 childrenTime += Math.min(endTime, child.endTime()) - Math.max(startTime, child.startTime());
954 WebInspector.TimelineUIUtils._collectAggregatedStatsForRecord(child, sta rtTime, endTime, aggregatedStats); 954 WebInspector.TimelineUIUtils._collectAggregatedStatsForRecord(child, sta rtTime, endTime, aggregatedStats);
955 } 955 }
956 var categoryName = WebInspector.TimelineUIUtils.categoryForRecord(record).na me; 956 var categoryName = WebInspector.TimelineUIUtils.categoryForRecord(record).na me;
957 var ownTime = Math.min(endTime, record.endTime()) - Math.max(startTime, reco rd.startTime()) - childrenTime; 957 var ownTime = Math.min(endTime, record.endTime()) - Math.max(startTime, reco rd.startTime()) - childrenTime;
958 aggregatedStats[categoryName] = (aggregatedStats[categoryName] || 0) + ownTi me; 958 aggregatedStats[categoryName] = (aggregatedStats[categoryName] || 0) + ownTi me;
959 } 959 };
960 960
961 /** 961 /**
962 * @param {!WebInspector.TimelineModel.NetworkRequest} request 962 * @param {!WebInspector.TimelineModel.NetworkRequest} request
963 * @param {!WebInspector.TimelineModel} model 963 * @param {!WebInspector.TimelineModel} model
964 * @param {!WebInspector.Linkifier} linkifier 964 * @param {!WebInspector.Linkifier} linkifier
965 * @return {!Promise<!DocumentFragment>} 965 * @return {!Promise<!DocumentFragment>}
966 */ 966 */
967 WebInspector.TimelineUIUtils.buildNetworkRequestDetails = function(request, mode l, linkifier) 967 WebInspector.TimelineUIUtils.buildNetworkRequestDetails = function(request, mode l, linkifier)
968 { 968 {
969 var target = model.targetByEvent(request.children[0]); 969 var target = model.targetByEvent(request.children[0]);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1024 * @param {?Element} element 1024 * @param {?Element} element
1025 * @return {!DocumentFragment} 1025 * @return {!DocumentFragment}
1026 */ 1026 */
1027 function appendPreview(element) 1027 function appendPreview(element)
1028 { 1028 {
1029 if (element) 1029 if (element)
1030 contentHelper.appendElementRow(WebInspector.UIString("Preview"), req uest.previewElement); 1030 contentHelper.appendElementRow(WebInspector.UIString("Preview"), req uest.previewElement);
1031 return contentHelper.fragment; 1031 return contentHelper.fragment;
1032 } 1032 }
1033 return previewPromise.then(appendPreview); 1033 return previewPromise.then(appendPreview);
1034 } 1034 };
1035 1035
1036 /** 1036 /**
1037 * @param {!Array<!RuntimeAgent.CallFrame>} callFrames 1037 * @param {!Array<!RuntimeAgent.CallFrame>} callFrames
1038 * @return {!RuntimeAgent.StackTrace} 1038 * @return {!RuntimeAgent.StackTrace}
1039 */ 1039 */
1040 WebInspector.TimelineUIUtils._stackTraceFromCallFrames = function(callFrames) 1040 WebInspector.TimelineUIUtils._stackTraceFromCallFrames = function(callFrames)
1041 { 1041 {
1042 return /** @type {!RuntimeAgent.StackTrace} */ ({ callFrames: callFrames }); 1042 return /** @type {!RuntimeAgent.StackTrace} */ ({ callFrames: callFrames });
1043 } 1043 };
1044 1044
1045 /** 1045 /**
1046 * @param {!WebInspector.TracingModel.Event} event 1046 * @param {!WebInspector.TracingModel.Event} event
1047 * @param {?WebInspector.Target} target 1047 * @param {?WebInspector.Target} target
1048 * @param {?Map<number, ?WebInspector.DOMNode>} relatedNodesMap 1048 * @param {?Map<number, ?WebInspector.DOMNode>} relatedNodesMap
1049 * @param {!WebInspector.TimelineDetailsContentHelper} contentHelper 1049 * @param {!WebInspector.TimelineDetailsContentHelper} contentHelper
1050 */ 1050 */
1051 WebInspector.TimelineUIUtils._generateCauses = function(event, target, relatedNo desMap, contentHelper) 1051 WebInspector.TimelineUIUtils._generateCauses = function(event, target, relatedNo desMap, contentHelper)
1052 { 1052 {
1053 var recordTypes = WebInspector.TimelineModel.RecordType; 1053 var recordTypes = WebInspector.TimelineModel.RecordType;
(...skipping 28 matching lines...) Expand all
1082 contentHelper.appendStackTrace(stackLabel || WebInspector.UIString("Stac k Trace"), WebInspector.TimelineUIUtils._stackTraceFromCallFrames(event.stackTra ce)); 1082 contentHelper.appendStackTrace(stackLabel || WebInspector.UIString("Stac k Trace"), WebInspector.TimelineUIUtils._stackTraceFromCallFrames(event.stackTra ce));
1083 } 1083 }
1084 1084
1085 // Indirect causes. 1085 // Indirect causes.
1086 if (event.invalidationTrackingEvents && target) { // Full invalidation track ing (experimental). 1086 if (event.invalidationTrackingEvents && target) { // Full invalidation track ing (experimental).
1087 contentHelper.addSection(WebInspector.UIString("Invalidations")); 1087 contentHelper.addSection(WebInspector.UIString("Invalidations"));
1088 WebInspector.TimelineUIUtils._generateInvalidations(event, target, relat edNodesMap, contentHelper); 1088 WebInspector.TimelineUIUtils._generateInvalidations(event, target, relat edNodesMap, contentHelper);
1089 } else if (initiator && initiator.stackTrace) { // Partial invalidation trac king. 1089 } else if (initiator && initiator.stackTrace) { // Partial invalidation trac king.
1090 contentHelper.appendStackTrace(callSiteStackLabel || WebInspector.UIStri ng("First Invalidated"), WebInspector.TimelineUIUtils._stackTraceFromCallFrames( initiator.stackTrace)); 1090 contentHelper.appendStackTrace(callSiteStackLabel || WebInspector.UIStri ng("First Invalidated"), WebInspector.TimelineUIUtils._stackTraceFromCallFrames( initiator.stackTrace));
1091 } 1091 }
1092 } 1092 };
1093 1093
1094 /** 1094 /**
1095 * @param {!WebInspector.TracingModel.Event} event 1095 * @param {!WebInspector.TracingModel.Event} event
1096 * @param {!WebInspector.Target} target 1096 * @param {!WebInspector.Target} target
1097 * @param {?Map<number, ?WebInspector.DOMNode>} relatedNodesMap 1097 * @param {?Map<number, ?WebInspector.DOMNode>} relatedNodesMap
1098 * @param {!WebInspector.TimelineDetailsContentHelper} contentHelper 1098 * @param {!WebInspector.TimelineDetailsContentHelper} contentHelper
1099 */ 1099 */
1100 WebInspector.TimelineUIUtils._generateInvalidations = function(event, target, re latedNodesMap, contentHelper) 1100 WebInspector.TimelineUIUtils._generateInvalidations = function(event, target, re latedNodesMap, contentHelper)
1101 { 1101 {
1102 if (!event.invalidationTrackingEvents) 1102 if (!event.invalidationTrackingEvents)
1103 return; 1103 return;
1104 1104
1105 var invalidations = {}; 1105 var invalidations = {};
1106 event.invalidationTrackingEvents.forEach(function(invalidation) { 1106 event.invalidationTrackingEvents.forEach(function(invalidation) {
1107 if (!invalidations[invalidation.type]) 1107 if (!invalidations[invalidation.type])
1108 invalidations[invalidation.type] = [invalidation]; 1108 invalidations[invalidation.type] = [invalidation];
1109 else 1109 else
1110 invalidations[invalidation.type].push(invalidation); 1110 invalidations[invalidation.type].push(invalidation);
1111 }); 1111 });
1112 1112
1113 Object.keys(invalidations).forEach(function(type) { 1113 Object.keys(invalidations).forEach(function(type) {
1114 WebInspector.TimelineUIUtils._generateInvalidationsForType( 1114 WebInspector.TimelineUIUtils._generateInvalidationsForType(
1115 type, target, invalidations[type], relatedNodesMap, contentHelper); 1115 type, target, invalidations[type], relatedNodesMap, contentHelper);
1116 }); 1116 });
1117 } 1117 };
1118 1118
1119 /** 1119 /**
1120 * @param {string} type 1120 * @param {string} type
1121 * @param {!WebInspector.Target} target 1121 * @param {!WebInspector.Target} target
1122 * @param {!Array.<!WebInspector.InvalidationTrackingEvent>} invalidations 1122 * @param {!Array.<!WebInspector.InvalidationTrackingEvent>} invalidations
1123 * @param {?Map<number, ?WebInspector.DOMNode>} relatedNodesMap 1123 * @param {?Map<number, ?WebInspector.DOMNode>} relatedNodesMap
1124 * @param {!WebInspector.TimelineDetailsContentHelper} contentHelper 1124 * @param {!WebInspector.TimelineDetailsContentHelper} contentHelper
1125 */ 1125 */
1126 WebInspector.TimelineUIUtils._generateInvalidationsForType = function(type, targ et, invalidations, relatedNodesMap, contentHelper) 1126 WebInspector.TimelineUIUtils._generateInvalidationsForType = function(type, targ et, invalidations, relatedNodesMap, contentHelper)
1127 { 1127 {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1172 }); 1172 });
1173 } 1173 }
1174 1174
1175 if (causeToInvalidationMap.has(causeKey)) 1175 if (causeToInvalidationMap.has(causeKey))
1176 causeToInvalidationMap.get(causeKey).push(invalidation); 1176 causeToInvalidationMap.get(causeKey).push(invalidation);
1177 else 1177 else
1178 causeToInvalidationMap.set(causeKey, [ invalidation ]); 1178 causeToInvalidationMap.set(causeKey, [ invalidation ]);
1179 } 1179 }
1180 return causeToInvalidationMap.valuesArray(); 1180 return causeToInvalidationMap.valuesArray();
1181 } 1181 }
1182 } 1182 };
1183 1183
1184 /** 1184 /**
1185 * @param {!Set<number>} nodeIds 1185 * @param {!Set<number>} nodeIds
1186 * @param {!WebInspector.InvalidationTrackingEvent} invalidations 1186 * @param {!WebInspector.InvalidationTrackingEvent} invalidations
1187 */ 1187 */
1188 WebInspector.TimelineUIUtils._collectInvalidationNodeIds = function(nodeIds, inv alidations) 1188 WebInspector.TimelineUIUtils._collectInvalidationNodeIds = function(nodeIds, inv alidations)
1189 { 1189 {
1190 for (var i = 0; i < invalidations.length; ++i) { 1190 for (var i = 0; i < invalidations.length; ++i) {
1191 if (invalidations[i].nodeId) 1191 if (invalidations[i].nodeId)
1192 nodeIds.add(invalidations[i].nodeId); 1192 nodeIds.add(invalidations[i].nodeId);
1193 } 1193 }
1194 } 1194 };
1195 1195
1196 /** 1196 /**
1197 * @constructor 1197 * @constructor
1198 * @param {!WebInspector.Target} target 1198 * @param {!WebInspector.Target} target
1199 * @param {?Map<number, ?WebInspector.DOMNode>} relatedNodesMap 1199 * @param {?Map<number, ?WebInspector.DOMNode>} relatedNodesMap
1200 * @param {!WebInspector.TimelineDetailsContentHelper} contentHelper 1200 * @param {!WebInspector.TimelineDetailsContentHelper} contentHelper
1201 * @param {!Array.<!WebInspector.InvalidationTrackingEvent>} invalidations 1201 * @param {!Array.<!WebInspector.InvalidationTrackingEvent>} invalidations
1202 * @extends {TreeElement} 1202 * @extends {TreeElement}
1203 */ 1203 */
1204 WebInspector.TimelineUIUtils.InvalidationsGroupElement = function(target, relate dNodesMap, contentHelper, invalidations) 1204 WebInspector.TimelineUIUtils.InvalidationsGroupElement = function(target, relate dNodesMap, contentHelper, invalidations)
1205 { 1205 {
1206 TreeElement.call(this, "", true); 1206 TreeElement.call(this, "", true);
1207 1207
1208 this.listItemElement.classList.add("header"); 1208 this.listItemElement.classList.add("header");
1209 this.selectable = false; 1209 this.selectable = false;
1210 this.toggleOnClick = true; 1210 this.toggleOnClick = true;
1211 1211
1212 this._relatedNodesMap = relatedNodesMap; 1212 this._relatedNodesMap = relatedNodesMap;
1213 this._contentHelper = contentHelper; 1213 this._contentHelper = contentHelper;
1214 this._invalidations = invalidations; 1214 this._invalidations = invalidations;
1215 this.title = this._createTitle(target); 1215 this.title = this._createTitle(target);
1216 } 1216 };
1217 1217
1218 WebInspector.TimelineUIUtils.InvalidationsGroupElement.prototype = { 1218 WebInspector.TimelineUIUtils.InvalidationsGroupElement.prototype = {
1219 1219
1220 /** 1220 /**
1221 * @param {!WebInspector.Target} target 1221 * @param {!WebInspector.Target} target
1222 * @return {!Element} 1222 * @return {!Element}
1223 */ 1223 */
1224 _createTitle: function(target) 1224 _createTitle: function(target)
1225 { 1225 {
1226 var first = this._invalidations[0]; 1226 var first = this._invalidations[0];
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
1341 nodeSpan.textContent = WebInspector.UIString("[ %s ]", invalidation. nodeName); 1341 nodeSpan.textContent = WebInspector.UIString("[ %s ]", invalidation. nodeName);
1342 return nodeSpan; 1342 return nodeSpan;
1343 } 1343 }
1344 if (showUnknownNodes) { 1344 if (showUnknownNodes) {
1345 var nodeSpan = createElement("span"); 1345 var nodeSpan = createElement("span");
1346 return nodeSpan.createTextChild(WebInspector.UIString("[ unknown nod e ]")); 1346 return nodeSpan.createTextChild(WebInspector.UIString("[ unknown nod e ]"));
1347 } 1347 }
1348 }, 1348 },
1349 1349
1350 __proto__: TreeElement.prototype 1350 __proto__: TreeElement.prototype
1351 } 1351 };
1352 1352
1353 /** 1353 /**
1354 * @param {!Object} total 1354 * @param {!Object} total
1355 * @param {!WebInspector.TimelineModel} model 1355 * @param {!WebInspector.TimelineModel} model
1356 * @param {!WebInspector.TracingModel.Event} event 1356 * @param {!WebInspector.TracingModel.Event} event
1357 * @return {boolean} 1357 * @return {boolean}
1358 */ 1358 */
1359 WebInspector.TimelineUIUtils._aggregatedStatsForTraceEvent = function(total, mod el, event) 1359 WebInspector.TimelineUIUtils._aggregatedStatsForTraceEvent = function(total, mod el, event)
1360 { 1360 {
1361 var events = model.inspectedTargetEvents(); 1361 var events = model.inspectedTargetEvents();
(...skipping 30 matching lines...) Expand all
1392 if (WebInspector.TracingModel.isAsyncPhase(event.phase)) { 1392 if (WebInspector.TracingModel.isAsyncPhase(event.phase)) {
1393 if (event.endTime) { 1393 if (event.endTime) {
1394 var aggregatedTotal = 0; 1394 var aggregatedTotal = 0;
1395 for (var categoryName in total) 1395 for (var categoryName in total)
1396 aggregatedTotal += total[categoryName]; 1396 aggregatedTotal += total[categoryName];
1397 total["idle"] = Math.max(0, event.endTime - event.startTime - aggreg atedTotal); 1397 total["idle"] = Math.max(0, event.endTime - event.startTime - aggreg atedTotal);
1398 } 1398 }
1399 return false; 1399 return false;
1400 } 1400 }
1401 return hasChildren; 1401 return hasChildren;
1402 } 1402 };
1403 1403
1404 /** 1404 /**
1405 * @param {!WebInspector.TracingModel.Event} event 1405 * @param {!WebInspector.TracingModel.Event} event
1406 * @param {!WebInspector.Target} target 1406 * @param {!WebInspector.Target} target
1407 * @param {function(!Element=)} callback 1407 * @param {function(!Element=)} callback
1408 */ 1408 */
1409 WebInspector.TimelineUIUtils.buildPicturePreviewContent = function(event, target , callback) 1409 WebInspector.TimelineUIUtils.buildPicturePreviewContent = function(event, target , callback)
1410 { 1410 {
1411 new WebInspector.LayerPaintEvent(event, target).snapshotPromise().then(onSna pshotLoaded); 1411 new WebInspector.LayerPaintEvent(event, target).snapshotPromise().then(onSna pshotLoaded);
1412 /** 1412 /**
(...skipping 25 matching lines...) Expand all
1438 var paintProfilerButton = container.createChild("a"); 1438 var paintProfilerButton = container.createChild("a");
1439 paintProfilerButton.textContent = WebInspector.UIString("Paint Profiler" ); 1439 paintProfilerButton.textContent = WebInspector.UIString("Paint Profiler" );
1440 container.addEventListener("click", showPaintProfiler, false); 1440 container.addEventListener("click", showPaintProfiler, false);
1441 callback(container); 1441 callback(container);
1442 } 1442 }
1443 1443
1444 function showPaintProfiler() 1444 function showPaintProfiler()
1445 { 1445 {
1446 WebInspector.TimelinePanel.instance().select(WebInspector.TimelineSelect ion.fromTraceEvent(event), WebInspector.TimelinePanel.DetailsTab.PaintProfiler); 1446 WebInspector.TimelinePanel.instance().select(WebInspector.TimelineSelect ion.fromTraceEvent(event), WebInspector.TimelinePanel.DetailsTab.PaintProfiler);
1447 } 1447 }
1448 } 1448 };
1449 1449
1450 /** 1450 /**
1451 * @param {!WebInspector.TimelineModel.RecordType} recordType 1451 * @param {!WebInspector.TimelineModel.RecordType} recordType
1452 * @param {?string} title 1452 * @param {?string} title
1453 * @param {number} position 1453 * @param {number} position
1454 * @return {!Element} 1454 * @return {!Element}
1455 */ 1455 */
1456 WebInspector.TimelineUIUtils.createEventDivider = function(recordType, title, po sition) 1456 WebInspector.TimelineUIUtils.createEventDivider = function(recordType, title, po sition)
1457 { 1457 {
1458 var eventDivider = createElement("div"); 1458 var eventDivider = createElement("div");
1459 eventDivider.className = "resources-event-divider"; 1459 eventDivider.className = "resources-event-divider";
1460 var recordTypes = WebInspector.TimelineModel.RecordType; 1460 var recordTypes = WebInspector.TimelineModel.RecordType;
1461 1461
1462 if (recordType === recordTypes.MarkDOMContent) 1462 if (recordType === recordTypes.MarkDOMContent)
1463 eventDivider.className += " resources-blue-divider"; 1463 eventDivider.className += " resources-blue-divider";
1464 else if (recordType === recordTypes.MarkLoad) 1464 else if (recordType === recordTypes.MarkLoad)
1465 eventDivider.className += " resources-red-divider"; 1465 eventDivider.className += " resources-red-divider";
1466 else if (recordType === recordTypes.MarkFirstPaint) 1466 else if (recordType === recordTypes.MarkFirstPaint)
1467 eventDivider.className += " resources-green-divider"; 1467 eventDivider.className += " resources-green-divider";
1468 else if (recordType === recordTypes.TimeStamp || recordType === recordTypes. ConsoleTime || recordType === recordTypes.UserTiming) 1468 else if (recordType === recordTypes.TimeStamp || recordType === recordTypes. ConsoleTime || recordType === recordTypes.UserTiming)
1469 eventDivider.className += " resources-orange-divider"; 1469 eventDivider.className += " resources-orange-divider";
1470 else if (recordType === recordTypes.BeginFrame) 1470 else if (recordType === recordTypes.BeginFrame)
1471 eventDivider.className += " timeline-frame-divider"; 1471 eventDivider.className += " timeline-frame-divider";
1472 1472
1473 if (title) 1473 if (title)
1474 eventDivider.title = title; 1474 eventDivider.title = title;
1475 eventDivider.style.left = position + "px"; 1475 eventDivider.style.left = position + "px";
1476 return eventDivider; 1476 return eventDivider;
1477 } 1477 };
1478 1478
1479 /** 1479 /**
1480 * @param {!WebInspector.TimelineModel.Record} record 1480 * @param {!WebInspector.TimelineModel.Record} record
1481 * @param {number} zeroTime 1481 * @param {number} zeroTime
1482 * @param {number} position 1482 * @param {number} position
1483 * @return {!Element} 1483 * @return {!Element}
1484 */ 1484 */
1485 WebInspector.TimelineUIUtils.createDividerForRecord = function(record, zeroTime, position) 1485 WebInspector.TimelineUIUtils.createDividerForRecord = function(record, zeroTime, position)
1486 { 1486 {
1487 var startTime = Number.millisToString(record.startTime() - zeroTime); 1487 var startTime = Number.millisToString(record.startTime() - zeroTime);
1488 var title = WebInspector.UIString("%s at %s", WebInspector.TimelineUIUtils.e ventTitle(record.traceEvent()), startTime); 1488 var title = WebInspector.UIString("%s at %s", WebInspector.TimelineUIUtils.e ventTitle(record.traceEvent()), startTime);
1489 return WebInspector.TimelineUIUtils.createEventDivider(record.type(), title, position); 1489 return WebInspector.TimelineUIUtils.createEventDivider(record.type(), title, position);
1490 } 1490 };
1491 1491
1492 /** 1492 /**
1493 * @return {!Array.<string>} 1493 * @return {!Array.<string>}
1494 */ 1494 */
1495 WebInspector.TimelineUIUtils._visibleTypes = function() 1495 WebInspector.TimelineUIUtils._visibleTypes = function()
1496 { 1496 {
1497 var eventStyles = WebInspector.TimelineUIUtils._initEventStyles(); 1497 var eventStyles = WebInspector.TimelineUIUtils._initEventStyles();
1498 var result = []; 1498 var result = [];
1499 for (var name in eventStyles) { 1499 for (var name in eventStyles) {
1500 if (!eventStyles[name].hidden) 1500 if (!eventStyles[name].hidden)
1501 result.push(name); 1501 result.push(name);
1502 } 1502 }
1503 return result; 1503 return result;
1504 } 1504 };
1505 1505
1506 /** 1506 /**
1507 * @return {!WebInspector.TimelineModel.Filter} 1507 * @return {!WebInspector.TimelineModel.Filter}
1508 */ 1508 */
1509 WebInspector.TimelineUIUtils.visibleEventsFilter = function() 1509 WebInspector.TimelineUIUtils.visibleEventsFilter = function()
1510 { 1510 {
1511 return new WebInspector.TimelineVisibleEventsFilter(WebInspector.TimelineUIU tils._visibleTypes()); 1511 return new WebInspector.TimelineVisibleEventsFilter(WebInspector.TimelineUIU tils._visibleTypes());
1512 } 1512 };
1513 1513
1514 /** 1514 /**
1515 * @return {!Object.<string, !WebInspector.TimelineCategory>} 1515 * @return {!Object.<string, !WebInspector.TimelineCategory>}
1516 */ 1516 */
1517 WebInspector.TimelineUIUtils.categories = function() 1517 WebInspector.TimelineUIUtils.categories = function()
1518 { 1518 {
1519 if (WebInspector.TimelineUIUtils._categories) 1519 if (WebInspector.TimelineUIUtils._categories)
1520 return WebInspector.TimelineUIUtils._categories; 1520 return WebInspector.TimelineUIUtils._categories;
1521 WebInspector.TimelineUIUtils._categories = { 1521 WebInspector.TimelineUIUtils._categories = {
1522 loading: new WebInspector.TimelineCategory("loading", WebInspector.UIStr ing("Loading"), true, "hsl(214, 67%, 74%)", "hsl(214, 67%, 66%)"), 1522 loading: new WebInspector.TimelineCategory("loading", WebInspector.UIStr ing("Loading"), true, "hsl(214, 67%, 74%)", "hsl(214, 67%, 66%)"),
(...skipping 16 matching lines...) Expand all
1539 if (!WebInspector.TimelineUIUtils._titleForAsyncEventGroupMap) { 1539 if (!WebInspector.TimelineUIUtils._titleForAsyncEventGroupMap) {
1540 var groups = WebInspector.TimelineModel.AsyncEventGroup; 1540 var groups = WebInspector.TimelineModel.AsyncEventGroup;
1541 WebInspector.TimelineUIUtils._titleForAsyncEventGroupMap = new Map([ 1541 WebInspector.TimelineUIUtils._titleForAsyncEventGroupMap = new Map([
1542 [groups.animation, WebInspector.UIString("Animation")], 1542 [groups.animation, WebInspector.UIString("Animation")],
1543 [groups.console, WebInspector.UIString("Console")], 1543 [groups.console, WebInspector.UIString("Console")],
1544 [groups.userTiming, WebInspector.UIString("User Timing")], 1544 [groups.userTiming, WebInspector.UIString("User Timing")],
1545 [groups.input, WebInspector.UIString("Input")] 1545 [groups.input, WebInspector.UIString("Input")]
1546 ]); 1546 ]);
1547 } 1547 }
1548 return WebInspector.TimelineUIUtils._titleForAsyncEventGroupMap.get(group) | | ""; 1548 return WebInspector.TimelineUIUtils._titleForAsyncEventGroupMap.get(group) | | "";
1549 } 1549 };
1550 1550
1551 /** 1551 /**
1552 * @param {!Object} aggregatedStats 1552 * @param {!Object} aggregatedStats
1553 * @param {!WebInspector.TimelineCategory=} selfCategory 1553 * @param {!WebInspector.TimelineCategory=} selfCategory
1554 * @param {number=} selfTime 1554 * @param {number=} selfTime
1555 * @return {!Element} 1555 * @return {!Element}
1556 */ 1556 */
1557 WebInspector.TimelineUIUtils.generatePieChart = function(aggregatedStats, selfCa tegory, selfTime) 1557 WebInspector.TimelineUIUtils.generatePieChart = function(aggregatedStats, selfCa tegory, selfTime)
1558 { 1558 {
1559 var total = 0; 1559 var total = 0;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1598 } 1598 }
1599 1599
1600 // Add other categories. 1600 // Add other categories.
1601 for (var categoryName in WebInspector.TimelineUIUtils.categories()) { 1601 for (var categoryName in WebInspector.TimelineUIUtils.categories()) {
1602 var category = WebInspector.TimelineUIUtils.categories()[categoryName]; 1602 var category = WebInspector.TimelineUIUtils.categories()[categoryName];
1603 if (category === selfCategory) 1603 if (category === selfCategory)
1604 continue; 1604 continue;
1605 appendLegendRow(category.name, category.title, aggregatedStats[category. name], category.childColor); 1605 appendLegendRow(category.name, category.title, aggregatedStats[category. name], category.childColor);
1606 } 1606 }
1607 return element; 1607 return element;
1608 } 1608 };
1609 1609
1610 /** 1610 /**
1611 * @param {!WebInspector.TimelineFrameModel} frameModel 1611 * @param {!WebInspector.TimelineFrameModel} frameModel
1612 * @param {!WebInspector.TimelineFrame} frame 1612 * @param {!WebInspector.TimelineFrame} frame
1613 * @param {?WebInspector.FilmStripModel.Frame} filmStripFrame 1613 * @param {?WebInspector.FilmStripModel.Frame} filmStripFrame
1614 * @return {!Element} 1614 * @return {!Element}
1615 */ 1615 */
1616 WebInspector.TimelineUIUtils.generateDetailsContentForFrame = function(frameMode l, frame, filmStripFrame) 1616 WebInspector.TimelineUIUtils.generateDetailsContentForFrame = function(frameMode l, frame, filmStripFrame)
1617 { 1617 {
1618 var pieChart = WebInspector.TimelineUIUtils.generatePieChart(frame.timeByCat egory); 1618 var pieChart = WebInspector.TimelineUIUtils.generatePieChart(frame.timeByCat egory);
(...skipping 29 matching lines...) Expand all
1648 1648
1649 /** 1649 /**
1650 * @param {!WebInspector.FilmStripModel.Frame} filmStripFrame 1650 * @param {!WebInspector.FilmStripModel.Frame} filmStripFrame
1651 */ 1651 */
1652 function frameClicked(filmStripFrame) 1652 function frameClicked(filmStripFrame)
1653 { 1653 {
1654 new WebInspector.FilmStripView.Dialog(filmStripFrame, 0); 1654 new WebInspector.FilmStripView.Dialog(filmStripFrame, 0);
1655 } 1655 }
1656 1656
1657 return contentHelper.fragment; 1657 return contentHelper.fragment;
1658 } 1658 };
1659 1659
1660 /** 1660 /**
1661 * @param {!WebInspector.TimelineFrame} frame 1661 * @param {!WebInspector.TimelineFrame} frame
1662 * @return {!Element} 1662 * @return {!Element}
1663 */ 1663 */
1664 WebInspector.TimelineUIUtils.frameDuration = function(frame) 1664 WebInspector.TimelineUIUtils.frameDuration = function(frame)
1665 { 1665 {
1666 var durationText = WebInspector.UIString("%s (at %s)", Number.millisToString (frame.endTime - frame.startTime, true), 1666 var durationText = WebInspector.UIString("%s (at %s)", Number.millisToString (frame.endTime - frame.startTime, true),
1667 Number.millisToString(frame.startTimeOffset, true)); 1667 Number.millisToString(frame.startTimeOffset, true));
1668 var element = createElement("span"); 1668 var element = createElement("span");
1669 element.createTextChild(durationText); 1669 element.createTextChild(durationText);
1670 if (!frame.hasWarnings()) 1670 if (!frame.hasWarnings())
1671 return element; 1671 return element;
1672 element.createTextChild(WebInspector.UIString(". Long frame times are an ind ication of ")); 1672 element.createTextChild(WebInspector.UIString(". Long frame times are an ind ication of "));
1673 element.appendChild(WebInspector.linkifyURLAsNode("https://developers.google .com/web/fundamentals/performance/rendering/", 1673 element.appendChild(WebInspector.linkifyURLAsNode("https://developers.google .com/web/fundamentals/performance/rendering/",
1674 WebInspector.UIString("jan k"), undefined, true)); 1674 WebInspector.UIString("jan k"), undefined, true));
1675 element.createTextChild("."); 1675 element.createTextChild(".");
1676 return element; 1676 return element;
1677 } 1677 };
1678 1678
1679 /** 1679 /**
1680 * @param {!CanvasRenderingContext2D} context 1680 * @param {!CanvasRenderingContext2D} context
1681 * @param {number} width 1681 * @param {number} width
1682 * @param {number} height 1682 * @param {number} height
1683 * @param {string} color0 1683 * @param {string} color0
1684 * @param {string} color1 1684 * @param {string} color1
1685 * @param {string} color2 1685 * @param {string} color2
1686 * @return {!CanvasGradient} 1686 * @return {!CanvasGradient}
1687 */ 1687 */
1688 WebInspector.TimelineUIUtils.createFillStyle = function(context, width, height, color0, color1, color2) 1688 WebInspector.TimelineUIUtils.createFillStyle = function(context, width, height, color0, color1, color2)
1689 { 1689 {
1690 var gradient = context.createLinearGradient(0, 0, width, height); 1690 var gradient = context.createLinearGradient(0, 0, width, height);
1691 gradient.addColorStop(0, color0); 1691 gradient.addColorStop(0, color0);
1692 gradient.addColorStop(0.25, color1); 1692 gradient.addColorStop(0.25, color1);
1693 gradient.addColorStop(0.75, color1); 1693 gradient.addColorStop(0.75, color1);
1694 gradient.addColorStop(1, color2); 1694 gradient.addColorStop(1, color2);
1695 return gradient; 1695 return gradient;
1696 } 1696 };
1697 1697
1698 /** 1698 /**
1699 * @param {!Array.<number>} quad 1699 * @param {!Array.<number>} quad
1700 * @return {number} 1700 * @return {number}
1701 */ 1701 */
1702 WebInspector.TimelineUIUtils.quadWidth = function(quad) 1702 WebInspector.TimelineUIUtils.quadWidth = function(quad)
1703 { 1703 {
1704 return Math.round(Math.sqrt(Math.pow(quad[0] - quad[2], 2) + Math.pow(quad[1 ] - quad[3], 2))); 1704 return Math.round(Math.sqrt(Math.pow(quad[0] - quad[2], 2) + Math.pow(quad[1 ] - quad[3], 2)));
1705 } 1705 };
1706 1706
1707 /** 1707 /**
1708 * @param {!Array.<number>} quad 1708 * @param {!Array.<number>} quad
1709 * @return {number} 1709 * @return {number}
1710 */ 1710 */
1711 WebInspector.TimelineUIUtils.quadHeight = function(quad) 1711 WebInspector.TimelineUIUtils.quadHeight = function(quad)
1712 { 1712 {
1713 return Math.round(Math.sqrt(Math.pow(quad[0] - quad[6], 2) + Math.pow(quad[1 ] - quad[7], 2))); 1713 return Math.round(Math.sqrt(Math.pow(quad[0] - quad[6], 2) + Math.pow(quad[1 ] - quad[7], 2)));
1714 } 1714 };
1715 1715
1716 /** 1716 /**
1717 * @constructor 1717 * @constructor
1718 * @param {number} priority 1718 * @param {number} priority
1719 * @param {string} color 1719 * @param {string} color
1720 * @param {!Array.<string>} eventTypes 1720 * @param {!Array.<string>} eventTypes
1721 */ 1721 */
1722 WebInspector.TimelineUIUtils.EventDispatchTypeDescriptor = function(priority, co lor, eventTypes) 1722 WebInspector.TimelineUIUtils.EventDispatchTypeDescriptor = function(priority, co lor, eventTypes)
1723 { 1723 {
1724 this.priority = priority; 1724 this.priority = priority;
1725 this.color = color; 1725 this.color = color;
1726 this.eventTypes = eventTypes; 1726 this.eventTypes = eventTypes;
1727 } 1727 };
1728 1728
1729 /** 1729 /**
1730 * @return {!Array.<!WebInspector.TimelineUIUtils.EventDispatchTypeDescriptor>} 1730 * @return {!Array.<!WebInspector.TimelineUIUtils.EventDispatchTypeDescriptor>}
1731 */ 1731 */
1732 WebInspector.TimelineUIUtils.eventDispatchDesciptors = function() 1732 WebInspector.TimelineUIUtils.eventDispatchDesciptors = function()
1733 { 1733 {
1734 if (WebInspector.TimelineUIUtils._eventDispatchDesciptors) 1734 if (WebInspector.TimelineUIUtils._eventDispatchDesciptors)
1735 return WebInspector.TimelineUIUtils._eventDispatchDesciptors; 1735 return WebInspector.TimelineUIUtils._eventDispatchDesciptors;
1736 var lightOrange = "hsl(40,100%,80%)"; 1736 var lightOrange = "hsl(40,100%,80%)";
1737 var orange = "hsl(40,100%,50%)"; 1737 var orange = "hsl(40,100%,50%)";
1738 var green = "hsl(90,100%,40%)"; 1738 var green = "hsl(90,100%,40%)";
1739 var purple = "hsl(256,100%,75%)"; 1739 var purple = "hsl(256,100%,75%)";
1740 WebInspector.TimelineUIUtils._eventDispatchDesciptors = [ 1740 WebInspector.TimelineUIUtils._eventDispatchDesciptors = [
1741 new WebInspector.TimelineUIUtils.EventDispatchTypeDescriptor(1, lightOra nge, ["mousemove", "mouseenter", "mouseleave", "mouseout", "mouseover"]), 1741 new WebInspector.TimelineUIUtils.EventDispatchTypeDescriptor(1, lightOra nge, ["mousemove", "mouseenter", "mouseleave", "mouseout", "mouseover"]),
1742 new WebInspector.TimelineUIUtils.EventDispatchTypeDescriptor(1, lightOra nge, ["pointerover", "pointerout", "pointerenter", "pointerleave", "pointermove" ]), 1742 new WebInspector.TimelineUIUtils.EventDispatchTypeDescriptor(1, lightOra nge, ["pointerover", "pointerout", "pointerenter", "pointerleave", "pointermove" ]),
1743 new WebInspector.TimelineUIUtils.EventDispatchTypeDescriptor(2, green, [ "wheel"]), 1743 new WebInspector.TimelineUIUtils.EventDispatchTypeDescriptor(2, green, [ "wheel"]),
1744 new WebInspector.TimelineUIUtils.EventDispatchTypeDescriptor(3, orange, ["click", "mousedown", "mouseup"]), 1744 new WebInspector.TimelineUIUtils.EventDispatchTypeDescriptor(3, orange, ["click", "mousedown", "mouseup"]),
1745 new WebInspector.TimelineUIUtils.EventDispatchTypeDescriptor(3, orange, ["touchstart", "touchend", "touchmove", "touchcancel"]), 1745 new WebInspector.TimelineUIUtils.EventDispatchTypeDescriptor(3, orange, ["touchstart", "touchend", "touchmove", "touchcancel"]),
1746 new WebInspector.TimelineUIUtils.EventDispatchTypeDescriptor(3, orange, ["pointerdown", "pointerup", "pointercancel", "gotpointercapture", "lostpointerc apture"]), 1746 new WebInspector.TimelineUIUtils.EventDispatchTypeDescriptor(3, orange, ["pointerdown", "pointerup", "pointercancel", "gotpointercapture", "lostpointerc apture"]),
1747 new WebInspector.TimelineUIUtils.EventDispatchTypeDescriptor(3, purple, ["keydown", "keyup", "keypress"]) 1747 new WebInspector.TimelineUIUtils.EventDispatchTypeDescriptor(3, purple, ["keydown", "keyup", "keypress"])
1748 ]; 1748 ];
1749 return WebInspector.TimelineUIUtils._eventDispatchDesciptors; 1749 return WebInspector.TimelineUIUtils._eventDispatchDesciptors;
1750 } 1750 };
1751 1751
1752 /** 1752 /**
1753 * @constructor 1753 * @constructor
1754 * @extends {WebInspector.Object} 1754 * @extends {WebInspector.Object}
1755 * @param {string} name 1755 * @param {string} name
1756 * @param {string} title 1756 * @param {string} title
1757 * @param {boolean} visible 1757 * @param {boolean} visible
1758 * @param {string} childColor 1758 * @param {string} childColor
1759 * @param {string} color 1759 * @param {string} color
1760 */ 1760 */
1761 WebInspector.TimelineCategory = function(name, title, visible, childColor, color ) 1761 WebInspector.TimelineCategory = function(name, title, visible, childColor, color )
1762 { 1762 {
1763 this.name = name; 1763 this.name = name;
1764 this.title = title; 1764 this.title = title;
1765 this.visible = visible; 1765 this.visible = visible;
1766 this.childColor = childColor; 1766 this.childColor = childColor;
1767 this.color = color; 1767 this.color = color;
1768 this.hidden = false; 1768 this.hidden = false;
1769 } 1769 };
1770 1770
1771 /** @enum {symbol} */ 1771 /** @enum {symbol} */
1772 WebInspector.TimelineCategory.Events = { 1772 WebInspector.TimelineCategory.Events = {
1773 VisibilityChanged: Symbol("VisibilityChanged") 1773 VisibilityChanged: Symbol("VisibilityChanged")
1774 }; 1774 };
1775 1775
1776 WebInspector.TimelineCategory.prototype = { 1776 WebInspector.TimelineCategory.prototype = {
1777 /** 1777 /**
1778 * @return {boolean} 1778 * @return {boolean}
1779 */ 1779 */
1780 get hidden() 1780 get hidden()
1781 { 1781 {
1782 return this._hidden; 1782 return this._hidden;
1783 }, 1783 },
1784 1784
1785 set hidden(hidden) 1785 set hidden(hidden)
1786 { 1786 {
1787 this._hidden = hidden; 1787 this._hidden = hidden;
1788 this.dispatchEventToListeners(WebInspector.TimelineCategory.Events.Visib ilityChanged, this); 1788 this.dispatchEventToListeners(WebInspector.TimelineCategory.Events.Visib ilityChanged, this);
1789 }, 1789 },
1790 1790
1791 __proto__: WebInspector.Object.prototype 1791 __proto__: WebInspector.Object.prototype
1792 } 1792 };
1793 1793
1794 /** 1794 /**
1795 * @typedef {!{ 1795 * @typedef {!{
1796 * title: string, 1796 * title: string,
1797 * color: string, 1797 * color: string,
1798 * lineWidth: number, 1798 * lineWidth: number,
1799 * dashStyle: !Array.<number>, 1799 * dashStyle: !Array.<number>,
1800 * tall: boolean, 1800 * tall: boolean,
1801 * lowPriority: boolean 1801 * lowPriority: boolean
1802 * }} 1802 * }}
1803 */ 1803 */
1804 WebInspector.TimelineMarkerStyle; 1804 WebInspector.TimelineMarkerStyle;
1805 1805
1806 /** 1806 /**
1807 * @param {!WebInspector.TracingModel.Event} event 1807 * @param {!WebInspector.TracingModel.Event} event
1808 * @return {!WebInspector.TimelineMarkerStyle} 1808 * @return {!WebInspector.TimelineMarkerStyle}
1809 */ 1809 */
1810 WebInspector.TimelineUIUtils.markerStyleForEvent = function(event) 1810 WebInspector.TimelineUIUtils.markerStyleForEvent = function(event)
1811 { 1811 {
1812 var red = "rgb(255, 0, 0)"; 1812 var red = "rgb(255, 0, 0)";
1813 var blue = "rgb(0, 0, 255)"; 1813 var blue = "rgb(0, 0, 255)";
1814 var orange = "rgb(255, 178, 23)"; 1814 var orange = "rgb(255, 178, 23)";
1815 var green = "rgb(0, 130, 0)"; 1815 var green = "rgb(0, 130, 0)";
1816 var tallMarkerDashStyle = [10, 5]; 1816 var tallMarkerDashStyle = [10, 5];
1817 1817
1818 var title = WebInspector.TimelineUIUtils.eventTitle(event) 1818 var title = WebInspector.TimelineUIUtils.eventTitle(event);
1819 1819
1820 if (event.hasCategory(WebInspector.TimelineModel.Category.Console) || event. hasCategory(WebInspector.TimelineModel.Category.UserTiming)) { 1820 if (event.hasCategory(WebInspector.TimelineModel.Category.Console) || event. hasCategory(WebInspector.TimelineModel.Category.UserTiming)) {
1821 return { 1821 return {
1822 title: title, 1822 title: title,
1823 dashStyle: tallMarkerDashStyle, 1823 dashStyle: tallMarkerDashStyle,
1824 lineWidth: 0.5, 1824 lineWidth: 0.5,
1825 color: orange, 1825 color: orange,
1826 tall: false, 1826 tall: false,
1827 lowPriority: false, 1827 lowPriority: false,
1828 }; 1828 };
(...skipping 19 matching lines...) Expand all
1848 break; 1848 break;
1849 } 1849 }
1850 return { 1850 return {
1851 title: title, 1851 title: title,
1852 dashStyle: tallMarkerDashStyle, 1852 dashStyle: tallMarkerDashStyle,
1853 lineWidth: 0.5, 1853 lineWidth: 0.5,
1854 color: color, 1854 color: color,
1855 tall: tall, 1855 tall: tall,
1856 lowPriority: false, 1856 lowPriority: false,
1857 }; 1857 };
1858 } 1858 };
1859 1859
1860 /** 1860 /**
1861 * @return {!WebInspector.TimelineMarkerStyle} 1861 * @return {!WebInspector.TimelineMarkerStyle}
1862 */ 1862 */
1863 WebInspector.TimelineUIUtils.markerStyleForFrame = function() 1863 WebInspector.TimelineUIUtils.markerStyleForFrame = function()
1864 { 1864 {
1865 return { 1865 return {
1866 title: WebInspector.UIString("Frame"), 1866 title: WebInspector.UIString("Frame"),
1867 color: "rgba(100, 100, 100, 0.4)", 1867 color: "rgba(100, 100, 100, 0.4)",
1868 lineWidth: 3, 1868 lineWidth: 3,
1869 dashStyle: [3], 1869 dashStyle: [3],
1870 tall: true, 1870 tall: true,
1871 lowPriority: true 1871 lowPriority: true
1872 }; 1872 };
1873 } 1873 };
1874 1874
1875 /** 1875 /**
1876 * @param {string} url 1876 * @param {string} url
1877 * @return {string} 1877 * @return {string}
1878 */ 1878 */
1879 WebInspector.TimelineUIUtils.colorForURL = function(url) 1879 WebInspector.TimelineUIUtils.colorForURL = function(url)
1880 { 1880 {
1881 if (!WebInspector.TimelineUIUtils.colorForURL._colorGenerator) { 1881 if (!WebInspector.TimelineUIUtils.colorForURL._colorGenerator) {
1882 WebInspector.TimelineUIUtils.colorForURL._colorGenerator = new WebInspec tor.FlameChart.ColorGenerator( 1882 WebInspector.TimelineUIUtils.colorForURL._colorGenerator = new WebInspec tor.FlameChart.ColorGenerator(
1883 { min: 30, max: 330 }, 1883 { min: 30, max: 330 },
1884 { min: 50, max: 80, count: 3 }, 1884 { min: 50, max: 80, count: 3 },
1885 85); 1885 85);
1886 } 1886 }
1887 return WebInspector.TimelineUIUtils.colorForURL._colorGenerator.colorForID(u rl); 1887 return WebInspector.TimelineUIUtils.colorForURL._colorGenerator.colorForID(u rl);
1888 } 1888 };
1889 1889
1890 /** 1890 /**
1891 * @constructor 1891 * @constructor
1892 * @param {string} title 1892 * @param {string} title
1893 */ 1893 */
1894 WebInspector.TimelinePopupContentHelper = function(title) 1894 WebInspector.TimelinePopupContentHelper = function(title)
1895 { 1895 {
1896 this._contentTable = createElement("table"); 1896 this._contentTable = createElement("table");
1897 var titleCell = this._createCell(WebInspector.UIString("%s - Details", title ), "timeline-details-title"); 1897 var titleCell = this._createCell(WebInspector.UIString("%s - Details", title ), "timeline-details-title");
1898 titleCell.colSpan = 2; 1898 titleCell.colSpan = 2;
1899 var titleRow = createElement("tr"); 1899 var titleRow = createElement("tr");
1900 titleRow.appendChild(titleCell); 1900 titleRow.appendChild(titleCell);
1901 this._contentTable.appendChild(titleRow); 1901 this._contentTable.appendChild(titleRow);
1902 } 1902 };
1903 1903
1904 WebInspector.TimelinePopupContentHelper.prototype = { 1904 WebInspector.TimelinePopupContentHelper.prototype = {
1905 /** 1905 /**
1906 * @return {!Element} 1906 * @return {!Element}
1907 */ 1907 */
1908 contentTable: function() 1908 contentTable: function()
1909 { 1909 {
1910 return this._contentTable; 1910 return this._contentTable;
1911 }, 1911 },
1912 1912
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1949 row.appendChild(titleCell); 1949 row.appendChild(titleCell);
1950 var cell = createElement("td"); 1950 var cell = createElement("td");
1951 cell.className = "details"; 1951 cell.className = "details";
1952 if (content instanceof Node) 1952 if (content instanceof Node)
1953 cell.appendChild(content); 1953 cell.appendChild(content);
1954 else 1954 else
1955 cell.createTextChild(content || ""); 1955 cell.createTextChild(content || "");
1956 row.appendChild(cell); 1956 row.appendChild(cell);
1957 this._contentTable.appendChild(row); 1957 this._contentTable.appendChild(row);
1958 } 1958 }
1959 } 1959 };
1960 1960
1961 /** 1961 /**
1962 * @constructor 1962 * @constructor
1963 * @param {?WebInspector.Target} target 1963 * @param {?WebInspector.Target} target
1964 * @param {?WebInspector.Linkifier} linkifier 1964 * @param {?WebInspector.Linkifier} linkifier
1965 */ 1965 */
1966 WebInspector.TimelineDetailsContentHelper = function(target, linkifier) 1966 WebInspector.TimelineDetailsContentHelper = function(target, linkifier)
1967 { 1967 {
1968 this.fragment = createDocumentFragment(); 1968 this.fragment = createDocumentFragment();
1969 1969
1970 this._linkifier = linkifier; 1970 this._linkifier = linkifier;
1971 this._target = target; 1971 this._target = target;
1972 1972
1973 this.element = createElementWithClass("div", "timeline-details-view-block"); 1973 this.element = createElementWithClass("div", "timeline-details-view-block");
1974 this._tableElement = this.element.createChild("div", "vbox timeline-details- chip-body"); 1974 this._tableElement = this.element.createChild("div", "vbox timeline-details- chip-body");
1975 this.fragment.appendChild(this.element); 1975 this.fragment.appendChild(this.element);
1976 } 1976 };
1977 1977
1978 WebInspector.TimelineDetailsContentHelper.prototype = { 1978 WebInspector.TimelineDetailsContentHelper.prototype = {
1979 /** 1979 /**
1980 * @param {string} title 1980 * @param {string} title
1981 * @param {!WebInspector.TimelineCategory=} category 1981 * @param {!WebInspector.TimelineCategory=} category
1982 */ 1982 */
1983 addSection: function(title, category) 1983 addSection: function(title, category)
1984 { 1984 {
1985 if (!this._tableElement.hasChildNodes()) { 1985 if (!this._tableElement.hasChildNodes()) {
1986 this.element.removeChildren(); 1986 this.element.removeChildren();
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
2107 /** 2107 /**
2108 * @param {!WebInspector.TracingModel.Event} event 2108 * @param {!WebInspector.TracingModel.Event} event
2109 * @param {string=} warningType 2109 * @param {string=} warningType
2110 */ 2110 */
2111 appendWarningRow: function(event, warningType) 2111 appendWarningRow: function(event, warningType)
2112 { 2112 {
2113 var warning = WebInspector.TimelineUIUtils.eventWarning(event, warningTy pe); 2113 var warning = WebInspector.TimelineUIUtils.eventWarning(event, warningTy pe);
2114 if (warning) 2114 if (warning)
2115 this.appendElementRow(WebInspector.UIString("Warning"), warning, tru e); 2115 this.appendElementRow(WebInspector.UIString("Warning"), warning, tru e);
2116 } 2116 }
2117 } 2117 };
2118 2118
2119 /** 2119 /**
2120 * @param {!WebInspector.TracingModel.Event} event 2120 * @param {!WebInspector.TracingModel.Event} event
2121 * @param {string=} warningType 2121 * @param {string=} warningType
2122 * @return {?Element} 2122 * @return {?Element}
2123 */ 2123 */
2124 WebInspector.TimelineUIUtils.eventWarning = function(event, warningType) 2124 WebInspector.TimelineUIUtils.eventWarning = function(event, warningType)
2125 { 2125 {
2126 var warning = warningType || event.warning; 2126 var warning = warningType || event.warning;
2127 if (!warning) 2127 if (!warning)
(...skipping 15 matching lines...) Expand all
2143 break; 2143 break;
2144 case warnings.V8Deopt: 2144 case warnings.V8Deopt:
2145 span.appendChild(WebInspector.linkifyURLAsNode("https://github.com/Googl eChrome/devtools-docs/issues/53", 2145 span.appendChild(WebInspector.linkifyURLAsNode("https://github.com/Googl eChrome/devtools-docs/issues/53",
2146 WebInspector.UIString("Not optimized"), undefined, true)); 2146 WebInspector.UIString("Not optimized"), undefined, true));
2147 span.createTextChild(WebInspector.UIString(": %s", eventData["deoptReaso n"])); 2147 span.createTextChild(WebInspector.UIString(": %s", eventData["deoptReaso n"]));
2148 break; 2148 break;
2149 default: 2149 default:
2150 console.assert(false, "Unhandled TimelineModel.WarningType"); 2150 console.assert(false, "Unhandled TimelineModel.WarningType");
2151 } 2151 }
2152 return span; 2152 return span;
2153 } 2153 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698