Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Side by Side Diff: tools/cc-frame-viewer/src/model/tile.js

Issue 12225131: [cc] Initial checkin of cc-frame-viewer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 /* Copyright (c) 2012 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 base.require('model.constants');
8
9 base.exportTo('ccfv.model', function() {
10
11 /**
12 * Represents a cc::Tile over the course of its lifetime.
13 *
14 * @constructor
15 */
16 function TileHistory(id) {
17 this.id = id;
18 this.tilesBySnapshotNumber = {};
19 this.picturePile = undefined;
20 this.contentsScale = undefined;
21
22 this.selected = false;
23 }
24
25 TileHistory.prototype = {
26 get title() {
27 return 'TileHistory ' + this.id;
28 },
29
30 getOrCreateTileForLTHI: function(lthi) {
31 if (!this.tilesBySnapshotNumber[lthi.snapshotNumber])
32 this.tilesBySnapshotNumber[lthi.snapshotNumber] = new Tile(this);
33 return this.tilesBySnapshotNumber[lthi.snapshotNumber];
34 },
35
36 dumpToSimpleObject: function(obj) {
37 obj.id = this.id;
38 obj.picturePile = this.picturePile;
39 obj.contentsScale = this.contentsScale;
40 }
41 };
42
43 /**
44 * Represents a cc::Tile at an instant in time.
45 *
46 * @constructor
47 */
48 function Tile(history) {
49 this.history = history;
50 this.managedState = undefined;
51 this.priority = [undefined, undefined];
52 }
53
54 Tile.prototype = {
55 get id() {
56 return this.history.id;
57 },
58
59 get contentsScale() {
60 return this.history.contents_scale;
61 },
62
63 get picturePile() {
64 return this.history.picture_pile;
65 },
66
67 get title() {
68 return 'Tile ' + this.id;
69 },
70
71 get selected() {
72 return this.history.selected;
73 },
74
75 set selected(s) {
76 this.history.selected = s;
77 },
78
79 dumpToSimpleObject: function(obj) {
80 obj.history = {};
81 this.history.dumpToSimpleObject(obj.history);
82 obj.managedState = this.managedState;
83 obj.priority = [{}, {}];
84 dumpAllButQuadToSimpleObject.call(this.priority[0], obj.priority[0]);
85 dumpAllButQuadToSimpleObject.call(this.priority[1], obj.priority[1]);
86 },
87 };
88
89 // Called with priority object as context.
90 function dumpAllButQuadToSimpleObject(obj) {
91 for (var k in this) {
92 if (k == 'current_screen_quad')
93 continue;
94 obj[k] = this[k];
95 }
96 }
97
98 return {
99 Tile: Tile,
100 TileHistory: TileHistory
101 }
102 });
103
OLDNEW
« no previous file with comments | « tools/cc-frame-viewer/src/model/layer_tree_impl.js ('k') | tools/cc-frame-viewer/src/model_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698