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

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

Issue 2713363002: DevTools: Highlight DOM node on hover in flamechart. (Closed)
Patch Set: Created 3 years, 9 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 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 if (warning) { 487 if (warning) {
488 warning.classList.add('timeline-info-warning'); 488 warning.classList.add('timeline-info-warning');
489 contents.appendChild(warning); 489 contents.appendChild(warning);
490 } 490 }
491 return element; 491 return element;
492 } 492 }
493 493
494 /** 494 /**
495 * @override 495 * @override
496 * @param {number} entryIndex 496 * @param {number} entryIndex
497 */
498 highlightEntry(entryIndex) {
499 this._highlightEntry(entryIndex);
caseq 2017/02/25 01:53:57 let's avoid races of calls to highlightEntry() vs.
alph 2017/02/25 01:58:57 Done.
500 }
501
502 /**
503 * @param {number} entryIndex
504 */
505 async _highlightEntry(entryIndex) {
506 SDK.DOMModel.hideDOMNodeHighlight();
507 var event = /** @type {!SDK.TracingModel.Event} */ (this._entryData[entryInd ex]);
508 if (!event)
509 return;
caseq 2017/02/25 01:53:57 moved as much as possible to the sync part?
alph 2017/02/25 01:58:57 Done.
510 var target = this._model.targetByEvent(event);
511 if (!target)
512 return;
513 var timelineData = TimelineModel.TimelineData.forEvent(event);
514 var backendNodeId = timelineData.backendNodeId;
515 if (!backendNodeId)
516 return;
517 var domModel = SDK.DOMModel.fromTarget(/** @type {!SDK.Target} */ (target));
518 if (!domModel)
519 return;
520 var nodes = await new Promise(fulfill =>
caseq 2017/02/25 01:53:57 new SDK.DeferredDOMNode(target, backendNodeId).hig
alph 2017/02/25 01:58:57 Done.
521 domModel.pushNodesByBackendIdsToFrontend(new Set([backendNodeId]), fulfi ll));
522 var node = nodes.get(backendNodeId);
523 if (node)
524 node.highlight();
525 }
526
527 /**
528 * @override
529 * @param {number} entryIndex
497 * @return {string} 530 * @return {string}
498 */ 531 */
499 entryColor(entryIndex) { 532 entryColor(entryIndex) {
500 // This is not annotated due to closure compiler failure to properly infer c ache container's template type. 533 // This is not annotated due to closure compiler failure to properly infer c ache container's template type.
501 function patchColorAndCache(cache, key, lookupColor) { 534 function patchColorAndCache(cache, key, lookupColor) {
502 var color = cache.get(key); 535 var color = cache.get(key);
503 if (color) 536 if (color)
504 return color; 537 return color;
505 var parsedColor = Common.Color.parse(lookupColor(key)); 538 var parsedColor = Common.Color.parse(lookupColor(key));
506 color = parsedColor.setAlpha(0.7).asString(Common.Color.Format.RGBA) || '' ; 539 color = parsedColor.setAlpha(0.7).asString(Common.Color.Format.RGBA) || '' ;
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 * @return {boolean} 828 * @return {boolean}
796 */ 829 */
797 _isVisible(event) { 830 _isVisible(event) {
798 return this._filters.every(function(filter) { 831 return this._filters.every(function(filter) {
799 return filter.accept(event); 832 return filter.accept(event);
800 }); 833 });
801 } 834 }
802 }; 835 };
803 836
804 Timeline.TimelineFlameChartDataProvider.InstantEventVisibleDurationMs = 0.001; 837 Timeline.TimelineFlameChartDataProvider.InstantEventVisibleDurationMs = 0.001;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698