OLD | NEW |
---|---|
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 Loading... | |
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 Loading... | |
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 setEntryColorMapping(colorForEvent) { | |
caseq
2017/05/08 18:20:35
setEventColorMapping()?
alph
2017/05/08 19:00:20
Done.
| |
973 this._colorForEvent = colorForEvent; | |
974 this.dispatchEventToListeners(Timeline.TimelineFlameChartDataProvider.Events .DataChanged); | |
caseq
2017/05/08 18:20:35
Let's have higher level perform refresh instead.
alph
2017/05/08 19:00:20
Done.
| |
975 } | |
968 }; | 976 }; |
969 | 977 |
970 Timeline.TimelineFlameChartDataProvider.InstantEventVisibleDurationMs = 0.001; | 978 Timeline.TimelineFlameChartDataProvider.InstantEventVisibleDurationMs = 0.001; |
971 Timeline.TimelineFlameChartDataProvider._indexSymbol = Symbol('index'); | 979 Timeline.TimelineFlameChartDataProvider._indexSymbol = Symbol('index'); |
972 | 980 |
973 /** @enum {symbol} */ | 981 /** @enum {symbol} */ |
974 Timeline.TimelineFlameChartDataProvider.Events = { | 982 Timeline.TimelineFlameChartDataProvider.Events = { |
975 DataChanged: Symbol('DataChanged') | 983 DataChanged: Symbol('DataChanged') |
976 }; | 984 }; |
OLD | NEW |