- add third_party src.
[platform/framework/web/crosswalk.git] / src / third_party / trace-viewer / src / gpu / state.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 base.require('tracing.trace_model.object_instance');
8
9 base.exportTo('gpu', function() {
10
11   var ObjectSnapshot = tracing.trace_model.ObjectSnapshot;
12
13   /**
14    * @constructor
15    */
16   function StateSnapshot() {
17     ObjectSnapshot.apply(this, arguments);
18   }
19
20   StateSnapshot.prototype = {
21     __proto__: ObjectSnapshot.prototype,
22
23     preInitialize: function() {
24       this.screenshot_ = undefined;
25     },
26
27     initialize: function() {
28       if (this.args.screenshot)
29         this.screenshot_ = this.args.screenshot;
30     },
31
32     /**
33      * @return {String} a base64 encoded screenshot if available.
34      */
35     get screenshot() {
36       return this.screenshot_;
37     }
38   };
39
40   ObjectSnapshot.register('gpu::State', StateSnapshot);
41
42   return {
43     StateSnapshot: StateSnapshot
44   };
45 });