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

Unified 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/cc-frame-viewer/src/model/tile.js
diff --git a/tools/cc-frame-viewer/src/model/tile.js b/tools/cc-frame-viewer/src/model/tile.js
new file mode 100644
index 0000000000000000000000000000000000000000..2b8ab179a5d1a40c7fdb7587012a1d1c21c44670
--- /dev/null
+++ b/tools/cc-frame-viewer/src/model/tile.js
@@ -0,0 +1,103 @@
+/* Copyright (c) 2012 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+'use strict';
+
+base.require('model.constants');
+
+base.exportTo('ccfv.model', function() {
+
+ /**
+ * Represents a cc::Tile over the course of its lifetime.
+ *
+ * @constructor
+ */
+ function TileHistory(id) {
+ this.id = id;
+ this.tilesBySnapshotNumber = {};
+ this.picturePile = undefined;
+ this.contentsScale = undefined;
+
+ this.selected = false;
+ }
+
+ TileHistory.prototype = {
+ get title() {
+ return 'TileHistory ' + this.id;
+ },
+
+ getOrCreateTileForLTHI: function(lthi) {
+ if (!this.tilesBySnapshotNumber[lthi.snapshotNumber])
+ this.tilesBySnapshotNumber[lthi.snapshotNumber] = new Tile(this);
+ return this.tilesBySnapshotNumber[lthi.snapshotNumber];
+ },
+
+ dumpToSimpleObject: function(obj) {
+ obj.id = this.id;
+ obj.picturePile = this.picturePile;
+ obj.contentsScale = this.contentsScale;
+ }
+ };
+
+ /**
+ * Represents a cc::Tile at an instant in time.
+ *
+ * @constructor
+ */
+ function Tile(history) {
+ this.history = history;
+ this.managedState = undefined;
+ this.priority = [undefined, undefined];
+ }
+
+ Tile.prototype = {
+ get id() {
+ return this.history.id;
+ },
+
+ get contentsScale() {
+ return this.history.contents_scale;
+ },
+
+ get picturePile() {
+ return this.history.picture_pile;
+ },
+
+ get title() {
+ return 'Tile ' + this.id;
+ },
+
+ get selected() {
+ return this.history.selected;
+ },
+
+ set selected(s) {
+ this.history.selected = s;
+ },
+
+ dumpToSimpleObject: function(obj) {
+ obj.history = {};
+ this.history.dumpToSimpleObject(obj.history);
+ obj.managedState = this.managedState;
+ obj.priority = [{}, {}];
+ dumpAllButQuadToSimpleObject.call(this.priority[0], obj.priority[0]);
+ dumpAllButQuadToSimpleObject.call(this.priority[1], obj.priority[1]);
+ },
+ };
+
+ // Called with priority object as context.
+ function dumpAllButQuadToSimpleObject(obj) {
+ for (var k in this) {
+ if (k == 'current_screen_quad')
+ continue;
+ obj[k] = this[k];
+ }
+ }
+
+ return {
+ Tile: Tile,
+ TileHistory: TileHistory
+ }
+});
+
« 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