summaryrefslogtreecommitdiff
path: root/chromium/third_party/trace-viewer/src/gpu/state.js
blob: a31d551511df096ea2048bb6c889fca35c2c9a0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright (c) 2013 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.

'use strict';

base.require('tracing.trace_model.object_instance');

base.exportTo('gpu', function() {

  var ObjectSnapshot = tracing.trace_model.ObjectSnapshot;

  /**
   * @constructor
   */
  function StateSnapshot() {
    ObjectSnapshot.apply(this, arguments);
  }

  StateSnapshot.prototype = {
    __proto__: ObjectSnapshot.prototype,

    preInitialize: function() {
      this.screenshot_ = undefined;
    },

    initialize: function() {
      if (this.args.screenshot)
        this.screenshot_ = this.args.screenshot;
    },

    /**
     * @return {String} a base64 encoded screenshot if available.
     */
    get screenshot() {
      return this.screenshot_;
    }
  };

  ObjectSnapshot.register('gpu::State', StateSnapshot);

  return {
    StateSnapshot: StateSnapshot
  };
});