OLD | NEW |
---|---|
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 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
456 WebInspector.TimelineOverviewBase.call(this, model); | 456 WebInspector.TimelineOverviewBase.call(this, model); |
457 this.element.id = "timeline-overview-memory"; | 457 this.element.id = "timeline-overview-memory"; |
458 | 458 |
459 this._maxHeapSizeLabel = this.element.createChild("div", "max memory-graph-l abel"); | 459 this._maxHeapSizeLabel = this.element.createChild("div", "max memory-graph-l abel"); |
460 this._minHeapSizeLabel = this.element.createChild("div", "min memory-graph-l abel"); | 460 this._minHeapSizeLabel = this.element.createChild("div", "min memory-graph-l abel"); |
461 } | 461 } |
462 | 462 |
463 WebInspector.TimelineMemoryOverview.prototype = { | 463 WebInspector.TimelineMemoryOverview.prototype = { |
464 update: function() | 464 update: function() |
465 { | 465 { |
466 this._resetCanvas(); | |
467 | |
468 var ctx = this._context; | |
469 this._clear(ctx); | |
470 | |
466 var records = this._model.records; | 471 var records = this._model.records; |
467 if (!records.length) | 472 if (!records.length) |
468 return; | 473 return; |
469 | 474 |
470 this._resetCanvas(); | |
471 | |
472 const lowerOffset = 3; | 475 const lowerOffset = 3; |
473 var maxUsedHeapSize = 0; | 476 var maxUsedHeapSize = 0; |
474 var minUsedHeapSize = 100000000000; | 477 var minUsedHeapSize = 100000000000; |
475 var minTime = this._model.minimumRecordTime(); | 478 var minTime = this._model.minimumRecordTime(); |
476 var maxTime = this._model.maximumRecordTime(); | 479 var maxTime = this._model.maximumRecordTime(); |
477 WebInspector.TimelinePresentationModel.forAllRecords(records, function(r ) { | 480 WebInspector.TimelinePresentationModel.forAllRecords(records, function(r ) { |
478 maxUsedHeapSize = Math.max(maxUsedHeapSize, r.usedHeapSize || maxUse dHeapSize); | 481 maxUsedHeapSize = Math.max(maxUsedHeapSize, r.usedHeapSize || maxUse dHeapSize); |
479 minUsedHeapSize = Math.min(minUsedHeapSize, r.usedHeapSize || minUse dHeapSize); | 482 minUsedHeapSize = Math.min(minUsedHeapSize, r.usedHeapSize || minUse dHeapSize); |
480 }); | 483 }); |
481 minUsedHeapSize = Math.min(minUsedHeapSize, maxUsedHeapSize); | 484 minUsedHeapSize = Math.min(minUsedHeapSize, maxUsedHeapSize); |
482 | 485 |
483 var width = this._canvas.width; | 486 var width = this._canvas.width; |
484 var height = this._canvas.height - lowerOffset; | 487 var height = this._canvas.height - lowerOffset; |
485 var xFactor = width / (maxTime - minTime); | 488 var xFactor = width / (maxTime - minTime); |
486 var yFactor = height / Math.max(maxUsedHeapSize - minUsedHeapSize, 1); | 489 var yFactor = height / Math.max(maxUsedHeapSize - minUsedHeapSize, 1); |
487 | 490 |
488 var histogram = new Array(width); | 491 var histogram = new Array(width); |
489 WebInspector.TimelinePresentationModel.forAllRecords(records, function(r ) { | 492 WebInspector.TimelinePresentationModel.forAllRecords(records, function(r ) { |
490 if (!r.usedHeapSize) | 493 if (!r.usedHeapSize) |
491 return; | 494 return; |
492 var x = Math.round((WebInspector.TimelineModel.endTimeInSeconds(r) - minTime) * xFactor); | 495 var x = Math.round((WebInspector.TimelineModel.endTimeInSeconds(r) - minTime) * xFactor); |
493 var y = Math.round((r.usedHeapSize - minUsedHeapSize) * yFactor); | 496 var y = Math.round((r.usedHeapSize - minUsedHeapSize) * yFactor); |
494 histogram[x] = Math.max(histogram[x] || 0, y); | 497 histogram[x] = Math.max(histogram[x] || 0, y); |
495 }); | 498 }); |
496 | 499 |
eustas
2013/07/24 06:08:20
Remove second empty line, please.
| |
497 var ctx = this._context; | |
498 this._clear(ctx); | |
499 | 500 |
500 height++; // +1 so that the border always fit into the canvas area. | 501 height++; // +1 so that the border always fit into the canvas area. |
501 | 502 |
502 var y = 0; | 503 var y = 0; |
503 var isFirstPoint = true; | 504 var isFirstPoint = true; |
504 ctx.beginPath(); | 505 ctx.beginPath(); |
505 ctx.moveTo(0, this._canvas.height); | 506 ctx.moveTo(0, this._canvas.height); |
506 for (var x = 0; x < histogram.length; x++) { | 507 for (var x = 0; x < histogram.length; x++) { |
507 if (typeof histogram[x] === "undefined") | 508 if (typeof histogram[x] === "undefined") |
508 continue; | 509 continue; |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
963 WebInspector.TimelineWindowFilter.prototype = { | 964 WebInspector.TimelineWindowFilter.prototype = { |
964 /** | 965 /** |
965 * @param {!WebInspector.TimelinePresentationModel.Record} record | 966 * @param {!WebInspector.TimelinePresentationModel.Record} record |
966 * @return {boolean} | 967 * @return {boolean} |
967 */ | 968 */ |
968 accept: function(record) | 969 accept: function(record) |
969 { | 970 { |
970 return record.lastChildEndTime >= this._pane._windowStartTime && record. startTime <= this._pane._windowEndTime; | 971 return record.lastChildEndTime >= this._pane._windowStartTime && record. startTime <= this._pane._windowEndTime; |
971 } | 972 } |
972 } | 973 } |
OLD | NEW |