OLD | NEW |
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 21 matching lines...) Expand all Loading... |
32 /** | 32 /** |
33 * @constructor | 33 * @constructor |
34 * @implements {WebInspector.FlameChartDataProvider} | 34 * @implements {WebInspector.FlameChartDataProvider} |
35 * @param {?WebInspector.Target} target | 35 * @param {?WebInspector.Target} target |
36 */ | 36 */ |
37 WebInspector.ProfileFlameChartDataProvider = function(target) | 37 WebInspector.ProfileFlameChartDataProvider = function(target) |
38 { | 38 { |
39 WebInspector.FlameChartDataProvider.call(this); | 39 WebInspector.FlameChartDataProvider.call(this); |
40 this._target = target; | 40 this._target = target; |
41 this._colorGenerator = WebInspector.ProfileFlameChartDataProvider.colorGener
ator(); | 41 this._colorGenerator = WebInspector.ProfileFlameChartDataProvider.colorGener
ator(); |
42 } | 42 }; |
43 | 43 |
44 WebInspector.ProfileFlameChartDataProvider.prototype = { | 44 WebInspector.ProfileFlameChartDataProvider.prototype = { |
45 /** | 45 /** |
46 * @override | 46 * @override |
47 * @return {number} | 47 * @return {number} |
48 */ | 48 */ |
49 barHeight: function() | 49 barHeight: function() |
50 { | 50 { |
51 return 15; | 51 return 15; |
52 }, | 52 }, |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 | 234 |
235 /** | 235 /** |
236 * @override | 236 * @override |
237 * @param {number} entryIndex | 237 * @param {number} entryIndex |
238 * @return {string} | 238 * @return {string} |
239 */ | 239 */ |
240 textColor: function(entryIndex) | 240 textColor: function(entryIndex) |
241 { | 241 { |
242 return "#333"; | 242 return "#333"; |
243 } | 243 } |
244 } | 244 }; |
245 | 245 |
246 | 246 |
247 /** | 247 /** |
248 * @return {!WebInspector.FlameChart.ColorGenerator} | 248 * @return {!WebInspector.FlameChart.ColorGenerator} |
249 */ | 249 */ |
250 WebInspector.ProfileFlameChartDataProvider.colorGenerator = function() | 250 WebInspector.ProfileFlameChartDataProvider.colorGenerator = function() |
251 { | 251 { |
252 if (!WebInspector.ProfileFlameChartDataProvider._colorGenerator) { | 252 if (!WebInspector.ProfileFlameChartDataProvider._colorGenerator) { |
253 var colorGenerator = new WebInspector.FlameChart.ColorGenerator( | 253 var colorGenerator = new WebInspector.FlameChart.ColorGenerator( |
254 { min: 30, max: 330 }, | 254 { min: 30, max: 330 }, |
255 { min: 50, max: 80, count: 5 }, | 255 { min: 50, max: 80, count: 5 }, |
256 { min: 80, max: 90, count: 3 }); | 256 { min: 80, max: 90, count: 3 }); |
257 | 257 |
258 colorGenerator.setColorForID("(idle)", "hsl(0, 0%, 94%)"); | 258 colorGenerator.setColorForID("(idle)", "hsl(0, 0%, 94%)"); |
259 colorGenerator.setColorForID("(program)", "hsl(0, 0%, 80%)"); | 259 colorGenerator.setColorForID("(program)", "hsl(0, 0%, 80%)"); |
260 colorGenerator.setColorForID("(garbage collector)", "hsl(0, 0%, 80%)"); | 260 colorGenerator.setColorForID("(garbage collector)", "hsl(0, 0%, 80%)"); |
261 WebInspector.ProfileFlameChartDataProvider._colorGenerator = colorGenera
tor; | 261 WebInspector.ProfileFlameChartDataProvider._colorGenerator = colorGenera
tor; |
262 } | 262 } |
263 return WebInspector.ProfileFlameChartDataProvider._colorGenerator; | 263 return WebInspector.ProfileFlameChartDataProvider._colorGenerator; |
264 } | 264 }; |
265 | 265 |
266 | 266 |
267 /** | 267 /** |
268 * @constructor | 268 * @constructor |
269 * @implements {WebInspector.Searchable} | 269 * @implements {WebInspector.Searchable} |
270 * @extends {WebInspector.VBox} | 270 * @extends {WebInspector.VBox} |
271 * @param {!WebInspector.SearchableView} searchableView | 271 * @param {!WebInspector.SearchableView} searchableView |
272 * @param {!WebInspector.FlameChartDataProvider} dataProvider | 272 * @param {!WebInspector.FlameChartDataProvider} dataProvider |
273 */ | 273 */ |
274 WebInspector.CPUProfileFlameChart = function(searchableView, dataProvider) | 274 WebInspector.CPUProfileFlameChart = function(searchableView, dataProvider) |
275 { | 275 { |
276 WebInspector.VBox.call(this); | 276 WebInspector.VBox.call(this); |
277 this.element.id = "cpu-flame-chart"; | 277 this.element.id = "cpu-flame-chart"; |
278 | 278 |
279 this._searchableView = searchableView; | 279 this._searchableView = searchableView; |
280 this._overviewPane = new WebInspector.CPUProfileFlameChart.OverviewPane(data
Provider); | 280 this._overviewPane = new WebInspector.CPUProfileFlameChart.OverviewPane(data
Provider); |
281 this._overviewPane.show(this.element); | 281 this._overviewPane.show(this.element); |
282 | 282 |
283 this._mainPane = new WebInspector.FlameChart(dataProvider, this._overviewPan
e); | 283 this._mainPane = new WebInspector.FlameChart(dataProvider, this._overviewPan
e); |
284 this._mainPane.show(this.element); | 284 this._mainPane.show(this.element); |
285 this._mainPane.addEventListener(WebInspector.FlameChart.Events.EntrySelected
, this._onEntrySelected, this); | 285 this._mainPane.addEventListener(WebInspector.FlameChart.Events.EntrySelected
, this._onEntrySelected, this); |
286 this._overviewPane.addEventListener(WebInspector.OverviewGrid.Events.WindowC
hanged, this._onWindowChanged, this); | 286 this._overviewPane.addEventListener(WebInspector.OverviewGrid.Events.WindowC
hanged, this._onWindowChanged, this); |
287 this._dataProvider = dataProvider; | 287 this._dataProvider = dataProvider; |
288 this._searchResults = []; | 288 this._searchResults = []; |
289 } | 289 }; |
290 | 290 |
291 WebInspector.CPUProfileFlameChart.prototype = { | 291 WebInspector.CPUProfileFlameChart.prototype = { |
292 focus: function() | 292 focus: function() |
293 { | 293 { |
294 this._mainPane.focus(); | 294 this._mainPane.focus(); |
295 }, | 295 }, |
296 | 296 |
297 /** | 297 /** |
298 * @param {!WebInspector.Event} event | 298 * @param {!WebInspector.Event} event |
299 */ | 299 */ |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 __proto__: WebInspector.VBox.prototype | 408 __proto__: WebInspector.VBox.prototype |
409 }; | 409 }; |
410 | 410 |
411 /** | 411 /** |
412 * @constructor | 412 * @constructor |
413 * @implements {WebInspector.TimelineGrid.Calculator} | 413 * @implements {WebInspector.TimelineGrid.Calculator} |
414 */ | 414 */ |
415 WebInspector.CPUProfileFlameChart.OverviewCalculator = function(dataProvider) | 415 WebInspector.CPUProfileFlameChart.OverviewCalculator = function(dataProvider) |
416 { | 416 { |
417 this._dataProvider = dataProvider; | 417 this._dataProvider = dataProvider; |
418 } | 418 }; |
419 | 419 |
420 WebInspector.CPUProfileFlameChart.OverviewCalculator.prototype = { | 420 WebInspector.CPUProfileFlameChart.OverviewCalculator.prototype = { |
421 /** | 421 /** |
422 * @override | 422 * @override |
423 * @return {number} | 423 * @return {number} |
424 */ | 424 */ |
425 paddingLeft: function() | 425 paddingLeft: function() |
426 { | 426 { |
427 return 0; | 427 return 0; |
428 }, | 428 }, |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 }, | 487 }, |
488 | 488 |
489 /** | 489 /** |
490 * @override | 490 * @override |
491 * @return {number} | 491 * @return {number} |
492 */ | 492 */ |
493 boundarySpan: function() | 493 boundarySpan: function() |
494 { | 494 { |
495 return this._maximumBoundaries - this._minimumBoundaries; | 495 return this._maximumBoundaries - this._minimumBoundaries; |
496 } | 496 } |
497 } | 497 }; |
498 | 498 |
499 /** | 499 /** |
500 * @constructor | 500 * @constructor |
501 * @extends {WebInspector.VBox} | 501 * @extends {WebInspector.VBox} |
502 * @implements {WebInspector.FlameChartDelegate} | 502 * @implements {WebInspector.FlameChartDelegate} |
503 * @param {!WebInspector.FlameChartDataProvider} dataProvider | 503 * @param {!WebInspector.FlameChartDataProvider} dataProvider |
504 */ | 504 */ |
505 WebInspector.CPUProfileFlameChart.OverviewPane = function(dataProvider) | 505 WebInspector.CPUProfileFlameChart.OverviewPane = function(dataProvider) |
506 { | 506 { |
507 WebInspector.VBox.call(this); | 507 WebInspector.VBox.call(this); |
508 this.element.classList.add("cpu-profile-flame-chart-overview-pane"); | 508 this.element.classList.add("cpu-profile-flame-chart-overview-pane"); |
509 this._overviewContainer = this.element.createChild("div", "cpu-profile-flame
-chart-overview-container"); | 509 this._overviewContainer = this.element.createChild("div", "cpu-profile-flame
-chart-overview-container"); |
510 this._overviewGrid = new WebInspector.OverviewGrid("cpu-profile-flame-chart"
); | 510 this._overviewGrid = new WebInspector.OverviewGrid("cpu-profile-flame-chart"
); |
511 this._overviewGrid.element.classList.add("fill"); | 511 this._overviewGrid.element.classList.add("fill"); |
512 this._overviewCanvas = this._overviewContainer.createChild("canvas", "cpu-pr
ofile-flame-chart-overview-canvas"); | 512 this._overviewCanvas = this._overviewContainer.createChild("canvas", "cpu-pr
ofile-flame-chart-overview-canvas"); |
513 this._overviewContainer.appendChild(this._overviewGrid.element); | 513 this._overviewContainer.appendChild(this._overviewGrid.element); |
514 this._overviewCalculator = new WebInspector.CPUProfileFlameChart.OverviewCal
culator(dataProvider); | 514 this._overviewCalculator = new WebInspector.CPUProfileFlameChart.OverviewCal
culator(dataProvider); |
515 this._dataProvider = dataProvider; | 515 this._dataProvider = dataProvider; |
516 this._overviewGrid.addEventListener(WebInspector.OverviewGrid.Events.WindowC
hanged, this._onWindowChanged, this); | 516 this._overviewGrid.addEventListener(WebInspector.OverviewGrid.Events.WindowC
hanged, this._onWindowChanged, this); |
517 } | 517 }; |
518 | 518 |
519 WebInspector.CPUProfileFlameChart.OverviewPane.prototype = { | 519 WebInspector.CPUProfileFlameChart.OverviewPane.prototype = { |
520 /** | 520 /** |
521 * @override | 521 * @override |
522 * @param {number} windowStartTime | 522 * @param {number} windowStartTime |
523 * @param {number} windowEndTime | 523 * @param {number} windowEndTime |
524 */ | 524 */ |
525 requestWindowTimes: function(windowStartTime, windowEndTime) | 525 requestWindowTimes: function(windowStartTime, windowEndTime) |
526 { | 526 { |
527 this._selectRange(windowStartTime, windowEndTime); | 527 this._selectRange(windowStartTime, windowEndTime); |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
654 _resetCanvas: function(width, height) | 654 _resetCanvas: function(width, height) |
655 { | 655 { |
656 var ratio = window.devicePixelRatio; | 656 var ratio = window.devicePixelRatio; |
657 this._overviewCanvas.width = width * ratio; | 657 this._overviewCanvas.width = width * ratio; |
658 this._overviewCanvas.height = height * ratio; | 658 this._overviewCanvas.height = height * ratio; |
659 this._overviewCanvas.style.width = width + "px"; | 659 this._overviewCanvas.style.width = width + "px"; |
660 this._overviewCanvas.style.height = height + "px"; | 660 this._overviewCanvas.style.height = height + "px"; |
661 }, | 661 }, |
662 | 662 |
663 __proto__: WebInspector.VBox.prototype | 663 __proto__: WebInspector.VBox.prototype |
664 } | 664 }; |
OLD | NEW |