| 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 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 * @return {!Promise<!DocumentFragment>} | 683 * @return {!Promise<!DocumentFragment>} |
| 684 */ | 684 */ |
| 685 static async buildTraceEventDetails(event, model, linkifier, detailed) { | 685 static async buildTraceEventDetails(event, model, linkifier, detailed) { |
| 686 var maybeTarget = model.targetByEvent(event); | 686 var maybeTarget = model.targetByEvent(event); |
| 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 (typeof event[Timeline.TimelineUIUtils._previewElementSymbol] === 'undefi
ned') { |
| 694 var previewElement = null; |
| 694 var url = TimelineModel.TimelineData.forEvent(event).url; | 695 var url = TimelineModel.TimelineData.forEvent(event).url; |
| 695 event[Timeline.TimelineUIUtils._previewElementSymbol] = await new Promise(
fulfill => { | 696 if (url) |
| 696 if (url) | 697 previewElement = await Components.DOMPresentationUtils.buildImagePreview
Contents(target, url, false); |
| 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 previewElement = await Timeline.TimelineUIUtils.buildPicturePreviewConte
nt(event, target); |
| 699 Timeline.TimelineUIUtils.buildPicturePreviewContent(event, target, ful
fill); | 700 event[Timeline.TimelineUIUtils._previewElementSymbol] = previewElement; |
| 700 else | |
| 701 fulfill(); | |
| 702 }) || null; | |
| 703 } | 701 } |
| 704 | 702 |
| 705 var nodeIdsToResolve = new Set(); | 703 var nodeIdsToResolve = new Set(); |
| 706 var timelineData = TimelineModel.TimelineData.forEvent(event); | 704 var timelineData = TimelineModel.TimelineData.forEvent(event); |
| 707 if (timelineData.backendNodeId) | 705 if (timelineData.backendNodeId) |
| 708 nodeIdsToResolve.add(timelineData.backendNodeId); | 706 nodeIdsToResolve.add(timelineData.backendNodeId); |
| 709 var invalidationTrackingEvents = TimelineModel.InvalidationTracker.invalidat
ionEventsFor(event); | 707 var invalidationTrackingEvents = TimelineModel.InvalidationTracker.invalidat
ionEventsFor(event); |
| 710 if (invalidationTrackingEvents) | 708 if (invalidationTrackingEvents) |
| 711 Timeline.TimelineUIUtils._collectInvalidationNodeIds(nodeIdsToResolve, inv
alidationTrackingEvents); | 709 Timeline.TimelineUIUtils._collectInvalidationNodeIds(nodeIdsToResolve, inv
alidationTrackingEvents); |
| 712 var relatedNodes = null; | 710 var relatedNodes = null; |
| (...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1375 total['idle'] = Math.max(0, event.endTime - event.startTime - aggregated
Total); | 1373 total['idle'] = Math.max(0, event.endTime - event.startTime - aggregated
Total); |
| 1376 } | 1374 } |
| 1377 return false; | 1375 return false; |
| 1378 } | 1376 } |
| 1379 return hasChildren; | 1377 return hasChildren; |
| 1380 } | 1378 } |
| 1381 | 1379 |
| 1382 /** | 1380 /** |
| 1383 * @param {!SDK.TracingModel.Event} event | 1381 * @param {!SDK.TracingModel.Event} event |
| 1384 * @param {!SDK.Target} target | 1382 * @param {!SDK.Target} target |
| 1385 * @param {function(!Element=)} callback | 1383 * @return {!Promise<?Element>} |
| 1386 */ | 1384 */ |
| 1387 static buildPicturePreviewContent(event, target, callback) { | 1385 static async buildPicturePreviewContent(event, target) { |
| 1388 new TimelineModel.LayerPaintEvent(event, target).snapshotPromise().then(onSn
apshotLoaded); | 1386 var snapshotWithRect = await new TimelineModel.LayerPaintEvent(event, target
).snapshotPromise(); |
| 1389 /** | 1387 if (!snapshotWithRect) |
| 1390 * @param {?SDK.SnapshotWithRect} snapshotWithRect | 1388 return null; |
| 1391 */ | 1389 var imageURLPromise = snapshotWithRect.snapshot.replay(null, null, 1); |
| 1392 function onSnapshotLoaded(snapshotWithRect) { | 1390 snapshotWithRect.snapshot.release(); |
| 1393 if (!snapshotWithRect) { | 1391 var imageURL = await imageURLPromise; |
| 1394 callback(); | 1392 if (!imageURL) |
| 1395 return; | 1393 return null; |
| 1396 } | 1394 var container = createElement('div'); |
| 1397 snapshotWithRect.snapshot.replay(null, null, 1).then(imageURL => onGotImag
e(imageURL)); | 1395 UI.appendStyle(container, 'components/imagePreview.css'); |
| 1398 snapshotWithRect.snapshot.release(); | 1396 container.classList.add('image-preview-container', 'vbox', 'link'); |
| 1399 } | 1397 var img = container.createChild('img'); |
| 1400 | 1398 img.src = imageURL; |
| 1401 /** | 1399 var paintProfilerButton = container.createChild('a'); |
| 1402 * @param {?string} imageURL | 1400 paintProfilerButton.textContent = Common.UIString('Paint Profiler'); |
| 1403 */ | 1401 container.addEventListener('click', showPaintProfiler, false); |
| 1404 function onGotImage(imageURL) { | 1402 return container; |
| 1405 if (!imageURL) { | |
| 1406 callback(); | |
| 1407 return; | |
| 1408 } | |
| 1409 var container = createElement('div'); | |
| 1410 UI.appendStyle(container, 'components/imagePreview.css'); | |
| 1411 container.classList.add('image-preview-container', 'vbox', 'link'); | |
| 1412 var img = container.createChild('img'); | |
| 1413 img.src = imageURL; | |
| 1414 var paintProfilerButton = container.createChild('a'); | |
| 1415 paintProfilerButton.textContent = Common.UIString('Paint Profiler'); | |
| 1416 container.addEventListener('click', showPaintProfiler, false); | |
| 1417 callback(container); | |
| 1418 } | |
| 1419 | 1403 |
| 1420 function showPaintProfiler() { | 1404 function showPaintProfiler() { |
| 1421 Timeline.TimelinePanel.instance().select( | 1405 Timeline.TimelinePanel.instance().select( |
| 1422 Timeline.TimelineSelection.fromTraceEvent(event), Timeline.TimelineDet
ailsView.Tab.PaintProfiler); | 1406 Timeline.TimelineSelection.fromTraceEvent(event), Timeline.TimelineDet
ailsView.Tab.PaintProfiler); |
| 1423 } | 1407 } |
| 1424 } | 1408 } |
| 1425 | 1409 |
| 1426 /** | 1410 /** |
| 1427 * @param {!SDK.TracingModel.Event} event | 1411 * @param {!SDK.TracingModel.Event} event |
| 1428 * @param {number} zeroTime | 1412 * @param {number} zeroTime |
| (...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2302 * @param {string=} warningType | 2286 * @param {string=} warningType |
| 2303 */ | 2287 */ |
| 2304 appendWarningRow(event, warningType) { | 2288 appendWarningRow(event, warningType) { |
| 2305 var warning = Timeline.TimelineUIUtils.eventWarning(event, warningType); | 2289 var warning = Timeline.TimelineUIUtils.eventWarning(event, warningType); |
| 2306 if (warning) | 2290 if (warning) |
| 2307 this.appendElementRow(Common.UIString('Warning'), warning, true); | 2291 this.appendElementRow(Common.UIString('Warning'), warning, true); |
| 2308 } | 2292 } |
| 2309 }; | 2293 }; |
| 2310 | 2294 |
| 2311 Timeline.TimelineUIUtils._categoryBreakdownCacheSymbol = Symbol('categoryBreakdo
wnCache'); | 2295 Timeline.TimelineUIUtils._categoryBreakdownCacheSymbol = Symbol('categoryBreakdo
wnCache'); |
| OLD | NEW |