Upstream version 9.37.197.0
[platform/framework/web/crosswalk.git] / src / third_party / trace-viewer / trace_viewer / cc / tile_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.require('cc.tile');
8 tvcm.require('tracing.analysis.generic_object_view');
9 tvcm.require('tracing.analysis.object_snapshot_view');
10 tvcm.require('tracing.analysis.util');
11
12 tvcm.exportTo('cc', function() {
13
14   /*
15    * Displays a tile in a human readable form.
16    * @constructor
17    */
18   var TileSnapshotView = tvcm.ui.define(
19       'tile-snapshot-view',
20       tracing.analysis.ObjectSnapshotView);
21
22   TileSnapshotView.prototype = {
23     __proto__: tracing.analysis.ObjectSnapshotView.prototype,
24
25     decorate: function() {
26       this.classList.add('tile-snapshot-view');
27       this.layerTreeView_ = new cc.LayerTreeHostImplSnapshotView();
28       this.appendChild(this.layerTreeView_);
29     },
30
31     updateContents: function() {
32       var tile = this.objectSnapshot_;
33       var layerTreeHostImpl = tile.containingSnapshot;
34       if (!layerTreeHostImpl)
35         return;
36
37       this.layerTreeView_.objectSnapshot = layerTreeHostImpl;
38       this.layerTreeView_.selection = new cc.TileSelection(tile);
39     }
40   };
41
42   tracing.analysis.ObjectSnapshotView.register(
43       'cc::Tile', TileSnapshotView, {
44         showInTrackView: false
45       });
46
47   return {
48     TileSnapshotView: TileSnapshotView
49   };
50
51 });