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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/profiler/CPUProfileView.js

Issue 2466123002: DevTools: reformat front-end code to match chromium style. (Closed)
Patch Set: Created 4 years, 1 month 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) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 * @extends {WebInspector.ProfileFlameChartDataProvider} 359 * @extends {WebInspector.ProfileFlameChartDataProvider}
360 * @param {!WebInspector.CPUProfileDataModel} cpuProfile 360 * @param {!WebInspector.CPUProfileDataModel} cpuProfile
361 * @param {?WebInspector.Target} target 361 * @param {?WebInspector.Target} target
362 */ 362 */
363 WebInspector.CPUFlameChartDataProvider = function(cpuProfile, target) 363 WebInspector.CPUFlameChartDataProvider = function(cpuProfile, target)
364 { 364 {
365 WebInspector.ProfileFlameChartDataProvider.call(this, target); 365 WebInspector.ProfileFlameChartDataProvider.call(this, target);
366 this._cpuProfile = cpuProfile; 366 this._cpuProfile = cpuProfile;
367 }; 367 };
368 368
369 /**
370 * @constructor
371 * @param {number} depth
372 * @param {number} duration
373 * @param {number} startTime
374 * @param {number} selfTime
375 * @param {!WebInspector.CPUProfileNode} node
376 */
377 WebInspector.CPUFlameChartDataProvider.ChartEntry = function(depth, duration, st artTime, selfTime, node)
378 {
379 this.depth = depth;
380 this.duration = duration;
381 this.startTime = startTime;
382 this.selfTime = selfTime;
383 this.node = node;
384 };
385
369 WebInspector.CPUFlameChartDataProvider.prototype = { 386 WebInspector.CPUFlameChartDataProvider.prototype = {
370 /** 387 /**
371 * @override 388 * @override
372 * @return {!WebInspector.FlameChart.TimelineData} 389 * @return {!WebInspector.FlameChart.TimelineData}
373 */ 390 */
374 _calculateTimelineData: function() 391 _calculateTimelineData: function()
375 { 392 {
376 /** 393 /** @type {!Array.<?WebInspector.CPUFlameChartDataProvider.ChartEntry>} */
377 * @constructor
378 * @param {number} depth
379 * @param {number} duration
380 * @param {number} startTime
381 * @param {number} selfTime
382 * @param {!WebInspector.CPUProfileNode} node
383 */
384 function ChartEntry(depth, duration, startTime, selfTime, node)
385 {
386 this.depth = depth;
387 this.duration = duration;
388 this.startTime = startTime;
389 this.selfTime = selfTime;
390 this.node = node;
391 }
392
393 /** @type {!Array.<?ChartEntry>} */
394 var entries = []; 394 var entries = [];
395 /** @type {!Array.<number>} */ 395 /** @type {!Array.<number>} */
396 var stack = []; 396 var stack = [];
397 var maxDepth = 5; 397 var maxDepth = 5;
398 398
399 function onOpenFrame() 399 function onOpenFrame()
400 { 400 {
401 stack.push(entries.length); 401 stack.push(entries.length);
402 // Reserve space for the entry, as they have to be ordered by startT ime. 402 // Reserve space for the entry, as they have to be ordered by startT ime.
403 // The entry itself will be put there in onCloseFrame. 403 // The entry itself will be put there in onCloseFrame.
404 entries.push(null); 404 entries.push(null);
405 } 405 }
406 /** 406 /**
407 * @param {number} depth 407 * @param {number} depth
408 * @param {!WebInspector.CPUProfileNode} node 408 * @param {!WebInspector.CPUProfileNode} node
409 * @param {number} startTime 409 * @param {number} startTime
410 * @param {number} totalTime 410 * @param {number} totalTime
411 * @param {number} selfTime 411 * @param {number} selfTime
412 */ 412 */
413 function onCloseFrame(depth, node, startTime, totalTime, selfTime) 413 function onCloseFrame(depth, node, startTime, totalTime, selfTime)
414 { 414 {
415 var index = stack.pop(); 415 var index = stack.pop();
416 entries[index] = new ChartEntry(depth, totalTime, startTime, selfTim e, node); 416 entries[index] = new WebInspector.CPUFlameChartDataProvider.ChartEnt ry(depth, totalTime, startTime, selfTime, node);
417 maxDepth = Math.max(maxDepth, depth); 417 maxDepth = Math.max(maxDepth, depth);
418 } 418 }
419 this._cpuProfile.forEachFrame(onOpenFrame, onCloseFrame); 419 this._cpuProfile.forEachFrame(onOpenFrame, onCloseFrame);
420 420
421 /** @type {!Array<!WebInspector.CPUProfileNode>} */ 421 /** @type {!Array<!WebInspector.CPUProfileNode>} */
422 var entryNodes = new Array(entries.length); 422 var entryNodes = new Array(entries.length);
423 var entryLevels = new Uint16Array(entries.length); 423 var entryLevels = new Uint16Array(entries.length);
424 var entryTotalTimes = new Float32Array(entries.length); 424 var entryTotalTimes = new Float32Array(entries.length);
425 var entrySelfTimes = new Float32Array(entries.length); 425 var entrySelfTimes = new Float32Array(entries.length);
426 var entryStartTimes = new Float64Array(entries.length); 426 var entryStartTimes = new Float64Array(entries.length);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 pushEntryInfoRow(WebInspector.UIString("Aggregated self time"), Number.s econdsToString(node.self / 1000, true)); 493 pushEntryInfoRow(WebInspector.UIString("Aggregated self time"), Number.s econdsToString(node.self / 1000, true));
494 pushEntryInfoRow(WebInspector.UIString("Aggregated total time"), Number. secondsToString(node.total / 1000, true)); 494 pushEntryInfoRow(WebInspector.UIString("Aggregated total time"), Number. secondsToString(node.total / 1000, true));
495 if (node.deoptReason) 495 if (node.deoptReason)
496 pushEntryInfoRow(WebInspector.UIString("Not optimized"), node.deoptR eason); 496 pushEntryInfoRow(WebInspector.UIString("Not optimized"), node.deoptR eason);
497 497
498 return WebInspector.ProfileView.buildPopoverTable(entryInfo); 498 return WebInspector.ProfileView.buildPopoverTable(entryInfo);
499 }, 499 },
500 500
501 __proto__: WebInspector.ProfileFlameChartDataProvider.prototype 501 __proto__: WebInspector.ProfileFlameChartDataProvider.prototype
502 }; 502 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698