1<!DOCTYPE html>
2<!--
3Copyright (c) 2013 The Chromium Authors. All rights reserved.
4Use of this source code is governed by a BSD-style license that can be
5found in the LICENSE file.
6-->
7
8<link rel="stylesheet" href="/tracing/ui/extras/chrome/gpu/state_view.css">
9
10<link rel="import" href="/tracing/ui/analysis/object_snapshot_view.html">
11
12<script>
13'use strict';
14
15tr.exportTo('tr.ui.e.chrome.gpu', function() {
16  /*
17   * Displays a GPU state snapshot in a human readable form.
18   * @constructor
19   */
20  var StateSnapshotView = tr.ui.b.define(
21      'tr-ui-e-chrome-gpu-state-snapshot-view',
22      tr.ui.analysis.ObjectSnapshotView);
23
24  StateSnapshotView.prototype = {
25    __proto__: tr.ui.analysis.ObjectSnapshotView.prototype,
26
27    decorate: function() {
28      this.classList.add('tr-ui-e-chrome-gpu-state-snapshot-view');
29      this.screenshotImage_ = document.createElement('img');
30      this.appendChild(this.screenshotImage_);
31    },
32
33    updateContents: function() {
34      if (this.objectSnapshot_ && this.objectSnapshot_.screenshot) {
35        this.screenshotImage_.src = 'data:image/png;base64,' +
36            this.objectSnapshot_.screenshot;
37      }
38    }
39  };
40  tr.ui.analysis.ObjectSnapshotView.register(
41    StateSnapshotView,
42    {typeName: 'gpu::State'});
43
44  return {
45    StateSnapshotView: StateSnapshotView
46  };
47});
48</script>
49