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
7base.requireStylesheet('cc.picture_view');
8
9base.require('cc.picture');
10base.require('cc.picture_debugger');
11base.require('tracing.analysis.generic_object_view');
12base.require('tracing.analysis.object_snapshot_view');
13base.require('tracing.analysis.util');
14
15base.exportTo('cc', function() {
16
17  /*
18   * Displays a picture snapshot in a human readable form.
19   * @constructor
20   */
21  var PictureSnapshotView = ui.define(
22      'picture-snapshot-view',
23      tracing.analysis.ObjectSnapshotView);
24
25  PictureSnapshotView.prototype = {
26    __proto__: tracing.analysis.ObjectSnapshotView.prototype,
27
28    decorate: function() {
29      this.classList.add('picture-snapshot-view');
30      this.pictureDebugger_ = new cc.PictureDebugger();
31      this.appendChild(this.pictureDebugger_);
32    },
33
34    updateContents: function() {
35      if (this.objectSnapshot_ && this.pictureDebugger_)
36        this.pictureDebugger_.picture = this.objectSnapshot_;
37    }
38  };
39
40  tracing.analysis.ObjectSnapshotView.register(
41      'cc::Picture', PictureSnapshotView);
42
43  return {
44    PictureSnapshotView: PictureSnapshotView
45  };
46
47});
48