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.require('cc.tile');
8base.require('tracing.analysis.generic_object_view');
9base.require('tracing.analysis.object_snapshot_view');
10base.require('tracing.analysis.util');
11
12base.exportTo('cc', function() {
13
14  /*
15   * Displays a tile in a human readable form.
16   * @constructor
17   */
18  var TileSnapshotView = 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});
52