Upstream version 9.37.197.0
[platform/framework/web/crosswalk.git] / src / third_party / trace-viewer / trace_viewer / system_stats / system_stats_snapshot.js
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 'use strict';
6
7 tvcm.require('cc.util');
8
9 tvcm.exportTo('system_stats', function() {
10   var ObjectSnapshot = tracing.trace_model.ObjectSnapshot;
11
12   /**
13    * @constructor
14    */
15   function SystemStatsSnapshot() {
16     ObjectSnapshot.apply(this, arguments);
17   }
18
19   /**
20    * @constructor
21    */
22   function SystemStatsSnapshot(objectInstance, ts, args) {
23     this.objectInstance = objectInstance;
24     this.ts = ts;
25     this.args = args;
26     this.stats = args;
27   }
28
29   SystemStatsSnapshot.prototype = {
30     __proto__: ObjectSnapshot.prototype,
31
32     initialize: function() {
33       if (this.args.length == 0)
34         throw new Error('No system stats snapshot data.');
35       this.stats_ = this.args;
36     },
37
38     getStats: function() {
39       return this.stats_;
40     },
41
42     setStats: function(stats) {
43       this.stats_ = stats;
44     }
45   };
46
47   ObjectSnapshot.register('base::TraceEventSystemStatsMonitor::SystemStats',
48                           SystemStatsSnapshot);
49
50   return {
51     SystemStatsSnapshot: SystemStatsSnapshot
52   };
53 });