OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/tile.h" | 5 #include "cc/tile.h" |
6 | 6 |
7 #include "base/stringprintf.h" | 7 #include "base/stringprintf.h" |
8 #include "cc/tile_manager.h" | 8 #include "cc/tile_manager.h" |
9 #include "third_party/khronos/GLES2/gl2.h" | 9 #include "third_party/khronos/GLES2/gl2.h" |
10 | 10 |
11 namespace cc { | 11 namespace cc { |
12 | 12 |
13 Tile::Tile(TileManager* tile_manager, | 13 Tile::Tile(TileManager* tile_manager, |
14 PicturePileImpl* picture_pile, | 14 PicturePileImpl* picture_pile, |
15 gfx::Size tile_size, | 15 gfx::Size tile_size, |
16 GLenum format, | 16 GLenum format, |
17 gfx::Rect content_rect, | 17 gfx::Rect content_rect, |
18 gfx::Rect opaque_rect, | 18 gfx::Rect opaque_rect, |
19 float contents_scale) | 19 float contents_scale) |
20 : tile_manager_(tile_manager), | 20 : tile_manager_(tile_manager), |
21 picture_pile_(picture_pile), | 21 picture_pile_(picture_pile), |
22 tile_size_(tile_size), | 22 tile_size_(tile_size), |
23 format_(format), | 23 format_(format), |
24 content_rect_(content_rect), | 24 content_rect_(content_rect), |
25 opaque_rect_(opaque_rect), | 25 opaque_rect_(opaque_rect), |
26 contents_scale_(contents_scale) { | 26 contents_scale_(contents_scale), |
27 tile_manager_->RegisterTile(this); | 27 managed_state_(NULL) { |
28 } | 28 } |
29 | 29 |
30 Tile::~Tile() { | 30 Tile::~Tile() { |
31 tile_manager_->UnregisterTile(this); | 31 DCHECK(!managed_state_); |
32 } | 32 } |
33 | 33 |
34 scoped_ptr<base::Value> Tile::AsValue() const { | 34 scoped_ptr<base::Value> Tile::AsValue() const { |
35 scoped_ptr<base::DictionaryValue> res(new base::DictionaryValue()); | 35 scoped_ptr<base::DictionaryValue> res(new base::DictionaryValue()); |
36 res->SetString("id", base::StringPrintf("%p", this)); | 36 res->SetString("id", base::StringPrintf("%p", this)); |
37 res->SetString("picture_pile", base::StringPrintf("%p", | 37 res->SetString("picture_pile", base::StringPrintf("%p", |
38 picture_pile_.get())); | 38 picture_pile_.get())); |
39 res->SetDouble("contents_scale", contents_scale_); | 39 res->SetDouble("contents_scale", contents_scale_); |
40 res->Set("priority.0", priority_[ACTIVE_TREE].AsValue().release()); | 40 res->Set("priority.0", priority_[ACTIVE_TREE].AsValue().release()); |
41 res->Set("priority.1", priority_[PENDING_TREE].AsValue().release()); | 41 res->Set("priority.1", priority_[PENDING_TREE].AsValue().release()); |
42 res->Set("managed_state", managed_state_.AsValue().release()); | 42 res->Set("managed_state", managed_state_->AsValue().release()); |
43 return res.PassAs<base::Value>(); | 43 return res.PassAs<base::Value>(); |
44 } | 44 } |
45 | 45 |
46 } // namespace cc | 46 } // namespace cc |
OLD | NEW |