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

Side by Side Diff: Source/devtools/front_end/TimelineUIUtils.js

Issue 195813010: DevTools: avoid using stale front-end node ids. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebased Created 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/devtools/front_end/LayerTreeModel.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 } 437 }
438 438
439 /** 439 /**
440 * @param {!WebInspector.TimelineModel.Record} record 440 * @param {!WebInspector.TimelineModel.Record} record
441 * @param {!WebInspector.Linkifier} linkifier 441 * @param {!WebInspector.Linkifier} linkifier
442 * @param {function(!DocumentFragment)} callback 442 * @param {function(!DocumentFragment)} callback
443 */ 443 */
444 WebInspector.TimelineUIUtils.generatePopupContent = function(record, linkifier, callback) 444 WebInspector.TimelineUIUtils.generatePopupContent = function(record, linkifier, callback)
445 { 445 {
446 var imageElement = /** @type {?Element} */ (record.getUserObject("TimelineUI Utils::preview-element") || null); 446 var imageElement = /** @type {?Element} */ (record.getUserObject("TimelineUI Utils::preview-element") || null);
447 var relatedNode = /** @type {?WebInspector.DOMNode} */ (record.getUserObject ("TimelineUIUtils::related-node") || null); 447 var relatedNode = null;
448 448
449 var barrier = new CallbackBarrier(); 449 var barrier = new CallbackBarrier();
450 if (!imageElement && WebInspector.TimelineUIUtils.needsPreviewElement(record .type)) 450 if (!imageElement && WebInspector.TimelineUIUtils.needsPreviewElement(record .type))
451 WebInspector.DOMPresentationUtils.buildImagePreviewContents(record.url, false, barrier.createCallback(saveImage)); 451 WebInspector.DOMPresentationUtils.buildImagePreviewContents(record.url, false, barrier.createCallback(saveImage));
452 if (!relatedNode && record.relatedBackendNodeId()) 452 if (record.relatedBackendNodeId())
453 WebInspector.domAgent.pushNodesByBackendIdsToFrontend([record.relatedBac kendNodeId()], barrier.createCallback(saveNode)); 453 WebInspector.domAgent.pushNodesByBackendIdsToFrontend([record.relatedBac kendNodeId()], barrier.createCallback(setRelatedNode));
454 barrier.callWhenDone(callbackWrapper); 454 barrier.callWhenDone(callbackWrapper);
455 455
456 /** 456 /**
457 * @param {!Element=} element 457 * @param {!Element=} element
458 */ 458 */
459 function saveImage(element) 459 function saveImage(element)
460 { 460 {
461 imageElement = element || null; 461 imageElement = element || null;
462 record.setUserObject("TimelineUIUtils::preview-element", element); 462 record.setUserObject("TimelineUIUtils::preview-element", element);
463 } 463 }
464 464
465 /** 465 /**
466 * @param {?Array.<!DOMAgent.NodeId>} nodeIds 466 * @param {?Array.<!DOMAgent.NodeId>} nodeIds
467 */ 467 */
468 function saveNode(nodeIds) 468 function setRelatedNode(nodeIds)
469 { 469 {
470 if (nodeIds !== null) { 470 if (nodeIds)
471 relatedNode = WebInspector.domAgent.nodeForId(nodeIds[0]); 471 relatedNode = WebInspector.domAgent.nodeForId(nodeIds[0]);
472 record.setUserObject("TimelineUIUtils::related-node", relatedNode);
473 }
474 } 472 }
475 473
476 function callbackWrapper() 474 function callbackWrapper()
477 { 475 {
478 callback(WebInspector.TimelineUIUtils._generatePopupContentSynchronously (record, linkifier, imageElement, relatedNode)); 476 callback(WebInspector.TimelineUIUtils._generatePopupContentSynchronously (record, linkifier, imageElement, relatedNode));
479 } 477 }
480 } 478 }
481 479
482 /** 480 /**
483 * @param {!WebInspector.TimelineModel.Record} record 481 * @param {!WebInspector.TimelineModel.Record} record
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
966 for (var i = 0; i < stackTrace.length; ++i) { 964 for (var i = 0; i < stackTrace.length; ++i) {
967 var stackFrame = stackTrace[i]; 965 var stackFrame = stackTrace[i];
968 var row = stackTraceElement.createChild("div"); 966 var row = stackTraceElement.createChild("div");
969 row.createTextChild(stackFrame.functionName || WebInspector.UIString ("(anonymous function)")); 967 row.createTextChild(stackFrame.functionName || WebInspector.UIString ("(anonymous function)"));
970 row.createTextChild(" @ "); 968 row.createTextChild(" @ ");
971 var urlElement = this._linkifier.linkifyLocation(stackFrame.url, sta ckFrame.lineNumber - 1); 969 var urlElement = this._linkifier.linkifyLocation(stackFrame.url, sta ckFrame.lineNumber - 1);
972 row.appendChild(urlElement); 970 row.appendChild(urlElement);
973 } 971 }
974 } 972 }
975 } 973 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/LayerTreeModel.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698