Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / third_party / trace-viewer / src / cc / picture_view.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.requireStylesheet('cc.picture_view');
8
9 tvcm.require('cc.picture');
10 tvcm.require('cc.picture_debugger');
11 tvcm.require('tracing.analysis.generic_object_view');
12 tvcm.require('tracing.analysis.object_snapshot_view');
13 tvcm.require('tracing.analysis.util');
14
15 tvcm.exportTo('cc', function() {
16
17   /*
18    * Displays a picture snapshot in a human readable form.
19    * @constructor
20    */
21   var PictureSnapshotView = tvcm.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   tracing.analysis.ObjectSnapshotView.register(
43       'cc::LayeredPicture', PictureSnapshotView);
44
45   return {
46     PictureSnapshotView: PictureSnapshotView
47   };
48
49 });