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

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

Issue 2863293002: DevTools: Support color by Product on timeline flamechart. (Closed)
Patch Set: addressing comments Created 3 years, 7 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 (C) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 var parsedColor = Common.Color.parse(lookupColor(key)); 528 var parsedColor = Common.Color.parse(lookupColor(key));
529 color = parsedColor.setAlpha(0.7).asString(Common.Color.Format.RGBA) || '' ; 529 color = parsedColor.setAlpha(0.7).asString(Common.Color.Format.RGBA) || '' ;
530 cache.set(key, color); 530 cache.set(key, color);
531 return color; 531 return color;
532 } 532 }
533 533
534 var type = this._entryType(entryIndex); 534 var type = this._entryType(entryIndex);
535 if (type === Timeline.TimelineFlameChartEntryType.Event) { 535 if (type === Timeline.TimelineFlameChartEntryType.Event) {
536 var event = /** @type {!SDK.TracingModel.Event} */ (this._entryData[entryI ndex]); 536 var event = /** @type {!SDK.TracingModel.Event} */ (this._entryData[entryI ndex]);
537 if (!SDK.TracingModel.isAsyncPhase(event.phase)) 537 if (!SDK.TracingModel.isAsyncPhase(event.phase))
538 return Timeline.TimelineUIUtils.eventColor(event); 538 return this._colorForEvent(event);
539 if (event.hasCategory(TimelineModel.TimelineModel.Category.Console) || 539 if (event.hasCategory(TimelineModel.TimelineModel.Category.Console) ||
540 event.hasCategory(TimelineModel.TimelineModel.Category.UserTiming)) 540 event.hasCategory(TimelineModel.TimelineModel.Category.UserTiming))
541 return this._consoleColorGenerator.colorForID(event.name); 541 return this._consoleColorGenerator.colorForID(event.name);
542 if (event.hasCategory(TimelineModel.TimelineModel.Category.LatencyInfo)) { 542 if (event.hasCategory(TimelineModel.TimelineModel.Category.LatencyInfo)) {
543 var phase = 543 var phase =
544 TimelineModel.TimelineIRModel.phaseForEvent(event) || TimelineModel. TimelineIRModel.Phases.Uncategorized; 544 TimelineModel.TimelineIRModel.phaseForEvent(event) || TimelineModel. TimelineIRModel.Phases.Uncategorized;
545 return patchColorAndCache( 545 return patchColorAndCache(
546 this._asyncColorByInteractionPhase, phase, Timeline.TimelineUIUtils. interactionPhaseColor); 546 this._asyncColorByInteractionPhase, phase, Timeline.TimelineUIUtils. interactionPhaseColor);
547 } 547 }
548 var category = Timeline.TimelineUIUtils.eventStyle(event).category; 548 var category = Timeline.TimelineUIUtils.eventStyle(event).category;
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
958 958
959 /** 959 /**
960 * @param {number} entryIndex 960 * @param {number} entryIndex
961 * @return {?SDK.TracingModel.Event} 961 * @return {?SDK.TracingModel.Event}
962 */ 962 */
963 eventByIndex(entryIndex) { 963 eventByIndex(entryIndex) {
964 return this._entryType(entryIndex) === Timeline.TimelineFlameChartEntryType. Event ? 964 return this._entryType(entryIndex) === Timeline.TimelineFlameChartEntryType. Event ?
965 /** @type {!SDK.TracingModel.Event} */ (this._entryData[entryIndex]) : 965 /** @type {!SDK.TracingModel.Event} */ (this._entryData[entryIndex]) :
966 null; 966 null;
967 } 967 }
968
969 /**
970 * @param {function(!SDK.TracingModel.Event):string} colorForEvent
971 */
972 setEventColorMapping(colorForEvent) {
973 this._colorForEvent = colorForEvent;
974 }
968 }; 975 };
969 976
970 Timeline.TimelineFlameChartDataProvider.InstantEventVisibleDurationMs = 0.001; 977 Timeline.TimelineFlameChartDataProvider.InstantEventVisibleDurationMs = 0.001;
971 Timeline.TimelineFlameChartDataProvider._indexSymbol = Symbol('index'); 978 Timeline.TimelineFlameChartDataProvider._indexSymbol = Symbol('index');
972 979
973 /** @enum {symbol} */ 980 /** @enum {symbol} */
974 Timeline.TimelineFlameChartDataProvider.Events = { 981 Timeline.TimelineFlameChartDataProvider.Events = {
975 DataChanged: Symbol('DataChanged') 982 DataChanged: Symbol('DataChanged')
976 }; 983 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698