Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 326 static eventColor(event) { | 326 static eventColor(event) { |
| 327 if (event.name === TimelineModel.TimelineModel.RecordType.JSFrame) { | 327 if (event.name === TimelineModel.TimelineModel.RecordType.JSFrame) { |
| 328 var frame = event.args['data']; | 328 var frame = event.args['data']; |
| 329 if (Timeline.TimelineUIUtils.isUserFrame(frame)) | 329 if (Timeline.TimelineUIUtils.isUserFrame(frame)) |
| 330 return Timeline.TimelineUIUtils.colorForId(frame.url); | 330 return Timeline.TimelineUIUtils.colorForId(frame.url); |
| 331 } | 331 } |
| 332 return Timeline.TimelineUIUtils.eventStyle(event).category.color; | 332 return Timeline.TimelineUIUtils.eventStyle(event).category.color; |
| 333 } | 333 } |
| 334 | 334 |
| 335 /** | 335 /** |
| 336 * @param {!ProductRegistry.Registry} productRegistry | |
| 337 * @param {!TimelineModel.TimelineModel} model | |
| 338 * @param {!Map<string, string>} urlToColorCache | |
| 339 * @param {!SDK.TracingModel.Event} event | |
| 340 * @return {string} | |
| 341 */ | |
| 342 static eventColorByProduct(productRegistry, model, urlToColorCache, event) { | |
| 343 var url = Timeline.TimelineUIUtils.eventURL(event) || ''; | |
| 344 var color = urlToColorCache.get(url); | |
| 345 if (!color) { | |
| 346 var defaultColor = '#f2ecdc'; | |
| 347 var parsedURL = url.asParsedURL(); | |
| 348 if (!parsedURL) | |
| 349 return defaultColor; | |
| 350 var name = productRegistry && productRegistry.nameForUrl(parsedURL); | |
| 351 if (!name) { | |
| 352 name = parsedURL.host; | |
| 353 var rootFrames = model.rootFrames(); | |
| 354 if (rootFrames.some(pageFrame => new Common.ParsedURL(pageFrame.url).hos t === name)) | |
| 355 return defaultColor; | |
|
caseq
2017/05/22 23:43:35
Why don't we cache it?
alph
2017/05/24 00:53:44
Done.
| |
| 356 } | |
| 357 color = name ? ProductRegistry.BadgePool.colorForEntryName(name) : default Color; | |
| 358 urlToColorCache.set(url, color); | |
| 359 } | |
| 360 return color; | |
| 361 } | |
| 362 | |
| 363 /** | |
| 336 * @param {!SDK.TracingModel.Event} event | 364 * @param {!SDK.TracingModel.Event} event |
| 337 * @return {string} | 365 * @return {string} |
| 338 */ | 366 */ |
| 339 static eventTitle(event) { | 367 static eventTitle(event) { |
| 340 const recordType = TimelineModel.TimelineModel.RecordType; | 368 const recordType = TimelineModel.TimelineModel.RecordType; |
| 341 const eventData = event.args['data']; | 369 const eventData = event.args['data']; |
| 342 if (event.name === recordType.JSFrame) | 370 if (event.name === recordType.JSFrame) |
| 343 return Timeline.TimelineUIUtils.frameDisplayName(eventData); | 371 return Timeline.TimelineUIUtils.frameDisplayName(eventData); |
| 344 const title = Timeline.TimelineUIUtils.eventStyle(event).title; | 372 const title = Timeline.TimelineUIUtils.eventStyle(event).title; |
| 345 if (event.hasCategory(TimelineModel.TimelineModel.Category.Console)) | 373 if (event.hasCategory(TimelineModel.TimelineModel.Category.Console)) |
| (...skipping 1938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2284 * @param {string=} warningType | 2312 * @param {string=} warningType |
| 2285 */ | 2313 */ |
| 2286 appendWarningRow(event, warningType) { | 2314 appendWarningRow(event, warningType) { |
| 2287 var warning = Timeline.TimelineUIUtils.eventWarning(event, warningType); | 2315 var warning = Timeline.TimelineUIUtils.eventWarning(event, warningType); |
| 2288 if (warning) | 2316 if (warning) |
| 2289 this.appendElementRow(Common.UIString('Warning'), warning, true); | 2317 this.appendElementRow(Common.UIString('Warning'), warning, true); |
| 2290 } | 2318 } |
| 2291 }; | 2319 }; |
| 2292 | 2320 |
| 2293 Timeline.TimelineUIUtils._categoryBreakdownCacheSymbol = Symbol('categoryBreakdo wnCache'); | 2321 Timeline.TimelineUIUtils._categoryBreakdownCacheSymbol = Symbol('categoryBreakdo wnCache'); |
| OLD | NEW |