| 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 return color; |
| 347 var defaultColor = '#f2ecdc'; |
| 348 var parsedURL = url.asParsedURL(); |
| 349 if (!parsedURL) |
| 350 return defaultColor; |
| 351 var name = productRegistry && productRegistry.nameForUrl(parsedURL); |
| 352 if (!name) { |
| 353 name = parsedURL.host; |
| 354 var rootFrames = model.rootFrames(); |
| 355 if (rootFrames.some(pageFrame => new Common.ParsedURL(pageFrame.url).host
=== name)) |
| 356 color = defaultColor; |
| 357 } |
| 358 if (!color) |
| 359 color = name ? ProductRegistry.BadgePool.colorForEntryName(name) : default
Color; |
| 360 urlToColorCache.set(url, color); |
| 361 return color; |
| 362 } |
| 363 |
| 364 /** |
| 336 * @param {!SDK.TracingModel.Event} event | 365 * @param {!SDK.TracingModel.Event} event |
| 337 * @return {string} | 366 * @return {string} |
| 338 */ | 367 */ |
| 339 static eventTitle(event) { | 368 static eventTitle(event) { |
| 340 const recordType = TimelineModel.TimelineModel.RecordType; | 369 const recordType = TimelineModel.TimelineModel.RecordType; |
| 341 const eventData = event.args['data']; | 370 const eventData = event.args['data']; |
| 342 if (event.name === recordType.JSFrame) | 371 if (event.name === recordType.JSFrame) |
| 343 return Timeline.TimelineUIUtils.frameDisplayName(eventData); | 372 return Timeline.TimelineUIUtils.frameDisplayName(eventData); |
| 344 const title = Timeline.TimelineUIUtils.eventStyle(event).title; | 373 const title = Timeline.TimelineUIUtils.eventStyle(event).title; |
| 345 if (event.hasCategory(TimelineModel.TimelineModel.Category.Console)) | 374 if (event.hasCategory(TimelineModel.TimelineModel.Category.Console)) |
| (...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 948 } | 977 } |
| 949 | 978 |
| 950 /** | 979 /** |
| 951 * @param {!Timeline.TimelineDetailsContentHelper} contentHelper | 980 * @param {!Timeline.TimelineDetailsContentHelper} contentHelper |
| 952 * @param {!ProductRegistry.BadgePool} badgePool | 981 * @param {!ProductRegistry.BadgePool} badgePool |
| 953 * @param {?string} url | 982 * @param {?string} url |
| 954 */ | 983 */ |
| 955 static _maybeAppendProductToDetails(contentHelper, badgePool, url) { | 984 static _maybeAppendProductToDetails(contentHelper, badgePool, url) { |
| 956 var parsedURL = url ? url.asParsedURL() : null; | 985 var parsedURL = url ? url.asParsedURL() : null; |
| 957 if (parsedURL) | 986 if (parsedURL) |
| 958 contentHelper.appendElementRow('', badgePool.badgeForURL(parsedURL, true))
; | 987 contentHelper.appendElementRow('', badgePool.badgeForURL(parsedURL)); |
| 959 } | 988 } |
| 960 | 989 |
| 961 /** | 990 /** |
| 962 * @param {!TimelineModel.TimelineModel} model | 991 * @param {!TimelineModel.TimelineModel} model |
| 963 * @param {number} startTime | 992 * @param {number} startTime |
| 964 * @param {number} endTime | 993 * @param {number} endTime |
| 965 * @return {!DocumentFragment} | 994 * @return {!DocumentFragment} |
| 966 */ | 995 */ |
| 967 static buildRangeStats(model, startTime, endTime) { | 996 static buildRangeStats(model, startTime, endTime) { |
| 968 var aggregatedStats = Timeline.TimelineUIUtils.statsForTimeRange(model, star
tTime, endTime); | 997 var aggregatedStats = Timeline.TimelineUIUtils.statsForTimeRange(model, star
tTime, endTime); |
| (...skipping 1315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2284 * @param {string=} warningType | 2313 * @param {string=} warningType |
| 2285 */ | 2314 */ |
| 2286 appendWarningRow(event, warningType) { | 2315 appendWarningRow(event, warningType) { |
| 2287 var warning = Timeline.TimelineUIUtils.eventWarning(event, warningType); | 2316 var warning = Timeline.TimelineUIUtils.eventWarning(event, warningType); |
| 2288 if (warning) | 2317 if (warning) |
| 2289 this.appendElementRow(Common.UIString('Warning'), warning, true); | 2318 this.appendElementRow(Common.UIString('Warning'), warning, true); |
| 2290 } | 2319 } |
| 2291 }; | 2320 }; |
| 2292 | 2321 |
| 2293 Timeline.TimelineUIUtils._categoryBreakdownCacheSymbol = Symbol('categoryBreakdo
wnCache'); | 2322 Timeline.TimelineUIUtils._categoryBreakdownCacheSymbol = Symbol('categoryBreakdo
wnCache'); |
| OLD | NEW |