blob: 8c5538c6015a488897844f40621b02f38709f4d4 [file] [log] [blame]
<!DOCTYPE html>
<!--
Copyright (c) 2015 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<link rel="import" href="/ui/tracks/chart_track.html">
<link rel="import" href="/ui/tracks/container_track.html">
<link rel="import" href="/ui/tracks/memory_dump_track_util.html">
<script>
'use strict';
tr.exportTo('tr.ui.tracks', function() {
var ALLOCATED_MEMORY_TRACK_HEIGHT = 50;
/**
* A track that displays an array of ProcessMemoryDump objects.
* @constructor
* @extends {ContainerTrack}
*/
var ProcessMemoryDumpTrack = tr.ui.b.define(
'process-memory-dump-track', tr.ui.tracks.ContainerTrack);
ProcessMemoryDumpTrack.prototype = {
__proto__: tr.ui.tracks.ContainerTrack.prototype,
decorate: function(viewport) {
tr.ui.tracks.ContainerTrack.prototype.decorate.call(this, viewport);
this.memoryDumps_ = undefined;
},
get memoryDumps() {
return this.memoryDumps_;
},
set memoryDumps(memoryDumps) {
this.memoryDumps_ = memoryDumps;
this.updateContents_();
},
updateContents_: function() {
this.clearTracks_();
// Show no tracks if there are no dumps.
if (!this.memoryDumps_ || !this.memoryDumps_.length)
return;
this.appendAllocatedMemoryTrack_();
},
appendAllocatedMemoryTrack_: function() {
var series = tr.ui.tracks.buildProcessAllocatedMemoryChartSeries(
this.memoryDumps_);
if (!series)
return;
var track = new tr.ui.tracks.ChartTrack(this.viewport);
track.heading = 'Allocated memory (per allocator)';
track.height = ALLOCATED_MEMORY_TRACK_HEIGHT + 'px';
track.series = series;
track.autoSetAllAxes({expandMax: true});
this.appendChild(track);
}
};
return {
ProcessMemoryDumpTrack: ProcessMemoryDumpTrack
};
});
</script>