OLD | NEW |
| (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::LayerImpl over the course of its lifetime. | |
13 * | |
14 * @constructor | |
15 */ | |
16 function LayerImplHistory(id) { | |
17 this.id = id; | |
18 this.layersBySnapshotNumber = {}; | |
19 this.args = {}; | |
20 this.selected = false; | |
21 } | |
22 | |
23 LayerImplHistory.prototype = { | |
24 get title() { | |
25 return 'LayerImpl ' + this.id; | |
26 }, | |
27 | |
28 getOrCreateLayerImplForLTHI: function(lthi) { | |
29 if (!this.layersBySnapshotNumber[lthi.snapshotNumber]) | |
30 this.layersBySnapshotNumber[lthi.snapshotNumber] = new LayerImpl(this); | |
31 return this.layersBySnapshotNumber[lthi.snapshotNumber]; | |
32 }, | |
33 | |
34 dumpToSimpleObject: function(obj) { | |
35 obj.id = this.id; | |
36 obj.args = this.args; | |
37 } | |
38 }; | |
39 | |
40 /** | |
41 * Represents a cc::LayerImpl at an instant in time. | |
42 * | |
43 * @constructor | |
44 */ | |
45 function LayerImpl(history) { | |
46 this.history = history; | |
47 this.args = {} | |
48 } | |
49 | |
50 LayerImpl.prototype = { | |
51 get id() { | |
52 return this.history.id; | |
53 }, | |
54 | |
55 get title() { | |
56 return 'LayerImpl ' + this.id; | |
57 }, | |
58 | |
59 get selected() { | |
60 return this.history.selected; | |
61 }, | |
62 | |
63 set selected(s) { | |
64 this.history.selected = s; | |
65 }, | |
66 | |
67 dumpToSimpleObject: function(obj) { | |
68 obj.history = {}; | |
69 obj.args = this.args; | |
70 }, | |
71 }; | |
72 | |
73 return { | |
74 LayerImpl: LayerImpl, | |
75 LayerImplHistory: LayerImplHistory | |
76 } | |
77 }); | |
78 | |
OLD | NEW |