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

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

Issue 2747553002: [DevTools] Rework Popover API (Closed)
Patch Set: rebased 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) 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 676 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 if (!maybeTarget) { 687 if (!maybeTarget) {
688 return Timeline.TimelineUIUtils._buildTraceEventDetailsSynchronously( 688 return Timeline.TimelineUIUtils._buildTraceEventDetailsSynchronously(
689 event, model, linkifier, detailed, null); 689 event, model, linkifier, detailed, null);
690 } 690 }
691 691
692 var target = /** @type {!SDK.Target} */ (maybeTarget); 692 var target = /** @type {!SDK.Target} */ (maybeTarget);
693 if (!event[Timeline.TimelineUIUtils._previewElementSymbol]) { 693 if (!event[Timeline.TimelineUIUtils._previewElementSymbol]) {
694 var url = TimelineModel.TimelineData.forEvent(event).url; 694 var url = TimelineModel.TimelineData.forEvent(event).url;
695 event[Timeline.TimelineUIUtils._previewElementSymbol] = await new Promise( fulfill => { 695 event[Timeline.TimelineUIUtils._previewElementSymbol] = await new Promise( fulfill => {
696 if (url) 696 if (url)
697 Components.DOMPresentationUtils.buildImagePreviewContents(target, url, false, fulfill); 697 Components.DOMPresentationUtils.buildImagePreviewContents(target, url, false).then(fulfill);
698 else if (TimelineModel.TimelineData.forEvent(event).picture) 698 else if (TimelineModel.TimelineData.forEvent(event).picture)
699 Timeline.TimelineUIUtils.buildPicturePreviewContent(event, target, ful fill); 699 Timeline.TimelineUIUtils.buildPicturePreviewContent(event, target, ful fill);
700 else 700 else
701 fulfill(); 701 fulfill();
702 }) || null; 702 }) || null;
703 } 703 }
704 704
705 var nodeIdsToResolve = new Set(); 705 var nodeIdsToResolve = new Set();
706 var timelineData = TimelineModel.TimelineData.forEvent(event); 706 var timelineData = TimelineModel.TimelineData.forEvent(event);
707 if (timelineData.backendNodeId) 707 if (timelineData.backendNodeId)
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
1124 if (link) 1124 if (link)
1125 contentHelper.appendElementRow(title, link); 1125 contentHelper.appendElementRow(title, link);
1126 } 1126 }
1127 } 1127 }
1128 } 1128 }
1129 1129
1130 /** 1130 /**
1131 * @param {function(?Element)} fulfill 1131 * @param {function(?Element)} fulfill
1132 */ 1132 */
1133 function action(fulfill) { 1133 function action(fulfill) {
1134 Components.DOMPresentationUtils.buildImagePreviewContents( 1134 Components.DOMPresentationUtils
1135 /** @type {!SDK.Target} */ (target), request.url, false, saveImage); 1135 .buildImagePreviewContents(
1136 /** @type {!SDK.Target} */ (target), request.url, false)
1137 .then(saveImage);
1136 /** 1138 /**
1137 * @param {!Element=} element 1139 * @param {?Element} element
1138 */ 1140 */
1139 function saveImage(element) { 1141 function saveImage(element) {
1140 request.previewElement = element || null; 1142 request.previewElement = element;
1141 fulfill(request.previewElement); 1143 fulfill(request.previewElement);
1142 } 1144 }
1143 } 1145 }
1144 var previewPromise; 1146 var previewPromise;
1145 if (request.previewElement) 1147 if (request.previewElement)
1146 previewPromise = Promise.resolve(request.previewElement); 1148 previewPromise = Promise.resolve(request.previewElement);
1147 else 1149 else
1148 previewPromise = request.url && target ? new Promise(action) : Promise.res olve(null); 1150 previewPromise = request.url && target ? new Promise(action) : Promise.res olve(null);
1149 /** 1151 /**
1150 * @param {?Element} element 1152 * @param {?Element} element
(...skipping 1149 matching lines...) Expand 10 before | Expand all | Expand 10 after
2300 * @param {string=} warningType 2302 * @param {string=} warningType
2301 */ 2303 */
2302 appendWarningRow(event, warningType) { 2304 appendWarningRow(event, warningType) {
2303 var warning = Timeline.TimelineUIUtils.eventWarning(event, warningType); 2305 var warning = Timeline.TimelineUIUtils.eventWarning(event, warningType);
2304 if (warning) 2306 if (warning)
2305 this.appendElementRow(Common.UIString('Warning'), warning, true); 2307 this.appendElementRow(Common.UIString('Warning'), warning, true);
2306 } 2308 }
2307 }; 2309 };
2308 2310
2309 Timeline.TimelineUIUtils._categoryBreakdownCacheSymbol = Symbol('categoryBreakdo wnCache'); 2311 Timeline.TimelineUIUtils._categoryBreakdownCacheSymbol = Symbol('categoryBreakdo wnCache');
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698