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

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

Issue 2393763002: [DevTools] Cleanup DOMExtension.js. (Closed)
Patch Set: review comments Created 4 years, 2 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 * 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 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 this._frameToImagePromise.set(frame, imagePromise); 481 this._frameToImagePromise.set(frame, imagePromise);
482 } 482 }
483 return imagePromise; 483 return imagePromise;
484 484
485 /** 485 /**
486 * @param {?string} data 486 * @param {?string} data
487 * @return {!Promise<!HTMLImageElement>} 487 * @return {!Promise<!HTMLImageElement>}
488 */ 488 */
489 function createImage(data) 489 function createImage(data)
490 { 490 {
491 var fulfill;
492 var promise = new Promise(f => fulfill = f);
493
491 var image = /** @type {!HTMLImageElement} */ (createElement("img")); 494 var image = /** @type {!HTMLImageElement} */ (createElement("img"));
492 if (data) 495 if (data)
493 image.src = "data:image/jpg;base64," + data; 496 image.src = "data:image/jpg;base64," + data;
494 return image.completePromise(); 497 if (image.complete) {
498 fulfill(image);
499 } else {
500 image.addEventListener("load", () => fulfill(image));
501 image.addEventListener("error", () => fulfill(image));
502 }
503 return promise;
495 } 504 }
496 }, 505 },
497 506
498 /** 507 /**
499 * @param {number} imageWidth 508 * @param {number} imageWidth
500 * @param {number} imageHeight 509 * @param {number} imageHeight
501 */ 510 */
502 _drawFrames: function(imageWidth, imageHeight) 511 _drawFrames: function(imageWidth, imageHeight)
503 { 512 {
504 if (!imageWidth) 513 if (!imageWidth)
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
809 counters[group] = this._quantDuration; 818 counters[group] = this._quantDuration;
810 this._callback(counters); 819 this._callback(counters);
811 interval -= this._quantDuration; 820 interval -= this._quantDuration;
812 } 821 }
813 this._counters = []; 822 this._counters = [];
814 this._counters[group] = interval; 823 this._counters[group] = interval;
815 this._lastTime = time; 824 this._lastTime = time;
816 this._remainder = this._quantDuration - interval; 825 this._remainder = this._quantDuration - interval;
817 } 826 }
818 } 827 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698