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

Side by Side Diff: Source/devtools/front_end/profiler/CPUProfileFlameChart.js

Issue 388303002: DevTools: Get rid of WebInspector.TargetObserver (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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
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 15 matching lines...) Expand all
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 31
32 /** 32 /**
33 * @constructor 33 * @constructor
34 * @implements {WebInspector.FlameChartDataProvider} 34 * @implements {WebInspector.FlameChartDataProvider}
35 * @param {!WebInspector.CPUProfileDataModel} cpuProfile 35 * @param {!WebInspector.CPUProfileDataModel} cpuProfile
36 * @param {?WebInspector.Target} target 36 * @param {!WeakReference.<!WebInspector.Target>} weakTarget
37 */ 37 */
38 WebInspector.CPUFlameChartDataProvider = function(cpuProfile, target) 38 WebInspector.CPUFlameChartDataProvider = function(cpuProfile, weakTarget)
39 { 39 {
40 WebInspector.FlameChartDataProvider.call(this); 40 WebInspector.FlameChartDataProvider.call(this);
41 this._cpuProfile = cpuProfile; 41 this._cpuProfile = cpuProfile;
42 this._targetObserver = new WebInspector.TargetObserver(target); 42 this._weakTarget = weakTarget;
43 this._colorGenerator = WebInspector.CPUFlameChartDataProvider.colorGenerator (); 43 this._colorGenerator = WebInspector.CPUFlameChartDataProvider.colorGenerator ();
44 } 44 }
45 45
46 WebInspector.CPUFlameChartDataProvider.prototype = { 46 WebInspector.CPUFlameChartDataProvider.prototype = {
47 /** 47 /**
48 * @return {number} 48 * @return {number}
49 */ 49 */
50 barHeight: function() 50 barHeight: function()
51 { 51 {
52 return 15; 52 return 15;
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 row.title = title; 217 row.title = title;
218 row.text = text; 218 row.text = text;
219 entryInfo.push(row); 219 entryInfo.push(row);
220 } 220 }
221 221
222 pushEntryInfoRow(WebInspector.UIString("Name"), node.functionName); 222 pushEntryInfoRow(WebInspector.UIString("Name"), node.functionName);
223 var selfTime = this._millisecondsToString(this._entrySelfTimes[entryInde x]); 223 var selfTime = this._millisecondsToString(this._entrySelfTimes[entryInde x]);
224 var totalTime = this._millisecondsToString(timelineData.entryTotalTimes[ entryIndex]); 224 var totalTime = this._millisecondsToString(timelineData.entryTotalTimes[ entryIndex]);
225 pushEntryInfoRow(WebInspector.UIString("Self time"), selfTime); 225 pushEntryInfoRow(WebInspector.UIString("Self time"), selfTime);
226 pushEntryInfoRow(WebInspector.UIString("Total time"), totalTime); 226 pushEntryInfoRow(WebInspector.UIString("Total time"), totalTime);
227 var target = this._targetObserver.target(); 227 var target = this._weakTarget.get();
228 var text = target ? WebInspector.Linkifier.liveLocationText(target, node .scriptId, node.lineNumber, node.columnNumber) : node.url; 228 var text = target ? WebInspector.Linkifier.liveLocationText(target, node .scriptId, node.lineNumber, node.columnNumber) : node.url;
229 pushEntryInfoRow(WebInspector.UIString("URL"), text); 229 pushEntryInfoRow(WebInspector.UIString("URL"), text);
230 pushEntryInfoRow(WebInspector.UIString("Aggregated self time"), Number.s econdsToString(node.selfTime / 1000, true)); 230 pushEntryInfoRow(WebInspector.UIString("Aggregated self time"), Number.s econdsToString(node.selfTime / 1000, true));
231 pushEntryInfoRow(WebInspector.UIString("Aggregated total time"), Number. secondsToString(node.totalTime / 1000, true)); 231 pushEntryInfoRow(WebInspector.UIString("Aggregated total time"), Number. secondsToString(node.totalTime / 1000, true));
232 if (node.deoptReason && node.deoptReason !== "no reason") 232 if (node.deoptReason && node.deoptReason !== "no reason")
233 pushEntryInfoRow(WebInspector.UIString("Not optimized"), node.deoptR eason); 233 pushEntryInfoRow(WebInspector.UIString("Not optimized"), node.deoptR eason);
234 234
235 return entryInfo; 235 return entryInfo;
236 }, 236 },
237 237
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 { 641 {
642 var ratio = window.devicePixelRatio; 642 var ratio = window.devicePixelRatio;
643 this._overviewCanvas.width = width * ratio; 643 this._overviewCanvas.width = width * ratio;
644 this._overviewCanvas.height = height * ratio; 644 this._overviewCanvas.height = height * ratio;
645 this._overviewCanvas.style.width = width + "px"; 645 this._overviewCanvas.style.width = width + "px";
646 this._overviewCanvas.style.height = height + "px"; 646 this._overviewCanvas.style.height = height + "px";
647 }, 647 },
648 648
649 __proto__: WebInspector.VBox.prototype 649 __proto__: WebInspector.VBox.prototype
650 } 650 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698