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/resources/tile.h" | 5 #include "cc/resources/tile.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/debug/trace_event_argument.h" | 9 #include "base/debug/trace_event_argument.h" |
10 #include "cc/base/math_util.h" | 10 #include "cc/base/math_util.h" |
11 #include "cc/debug/traced_value.h" | 11 #include "cc/debug/traced_value.h" |
12 #include "cc/resources/tile_manager.h" | 12 #include "cc/resources/tile_manager.h" |
13 #include "third_party/khronos/GLES2/gl2.h" | 13 #include "third_party/khronos/GLES2/gl2.h" |
14 | 14 |
15 namespace cc { | 15 namespace cc { |
16 | 16 |
17 Tile::Id Tile::s_next_id_ = 0; | 17 Tile::Id Tile::s_next_id_ = 0; |
18 | 18 |
19 Tile::Tile(TileManager* tile_manager, | 19 Tile::Tile(TileManager* tile_manager, |
20 PicturePileImpl* picture_pile, | 20 RasterSource* raster_source, |
21 const gfx::Size& tile_size, | 21 const gfx::Size& tile_size, |
22 const gfx::Rect& content_rect, | 22 const gfx::Rect& content_rect, |
23 float contents_scale, | 23 float contents_scale, |
24 int layer_id, | 24 int layer_id, |
25 int source_frame_number, | 25 int source_frame_number, |
26 int flags) | 26 int flags) |
27 : RefCountedManaged<Tile>(tile_manager), | 27 : RefCountedManaged<Tile>(tile_manager), |
28 tile_manager_(tile_manager), | 28 tile_manager_(tile_manager), |
29 size_(tile_size), | 29 size_(tile_size), |
30 content_rect_(content_rect), | 30 content_rect_(content_rect), |
31 contents_scale_(contents_scale), | 31 contents_scale_(contents_scale), |
32 layer_id_(layer_id), | 32 layer_id_(layer_id), |
33 source_frame_number_(source_frame_number), | 33 source_frame_number_(source_frame_number), |
34 flags_(flags), | 34 flags_(flags), |
35 is_shared_(false), | 35 is_shared_(false), |
36 tiling_i_index_(-1), | 36 tiling_i_index_(-1), |
37 tiling_j_index_(-1), | 37 tiling_j_index_(-1), |
38 required_for_activation_(false), | 38 required_for_activation_(false), |
39 id_(s_next_id_++) { | 39 id_(s_next_id_++) { |
40 set_picture_pile(picture_pile); | 40 set_raster_source(raster_source); |
41 for (int i = 0; i < NUM_TREES; i++) | 41 for (int i = 0; i < NUM_TREES; i++) |
42 is_occluded_[i] = false; | 42 is_occluded_[i] = false; |
43 } | 43 } |
44 | 44 |
45 Tile::~Tile() { | 45 Tile::~Tile() { |
46 TRACE_EVENT_OBJECT_DELETED_WITH_ID( | 46 TRACE_EVENT_OBJECT_DELETED_WITH_ID( |
47 TRACE_DISABLED_BY_DEFAULT("cc.debug"), | 47 TRACE_DISABLED_BY_DEFAULT("cc.debug"), |
48 "cc::Tile", this); | 48 "cc::Tile", this); |
49 } | 49 } |
50 | 50 |
51 void Tile::AsValueInto(base::debug::TracedValue* res) const { | 51 void Tile::AsValueInto(base::debug::TracedValue* res) const { |
52 TracedValue::MakeDictIntoImplicitSnapshotWithCategory( | 52 TracedValue::MakeDictIntoImplicitSnapshotWithCategory( |
53 TRACE_DISABLED_BY_DEFAULT("cc.debug"), res, "cc::Tile", this); | 53 TRACE_DISABLED_BY_DEFAULT("cc.debug"), res, "cc::Tile", this); |
54 TracedValue::SetIDRef(picture_pile_.get(), res, "picture_pile"); | 54 TracedValue::SetIDRef(raster_source_.get(), res, "picture_pile"); |
55 res->SetDouble("contents_scale", contents_scale_); | 55 res->SetDouble("contents_scale", contents_scale_); |
56 | 56 |
57 res->BeginArray("content_rect"); | 57 res->BeginArray("content_rect"); |
58 MathUtil::AddToTracedValue(content_rect_, res); | 58 MathUtil::AddToTracedValue(content_rect_, res); |
59 res->EndArray(); | 59 res->EndArray(); |
60 | 60 |
61 res->SetInteger("layer_id", layer_id_); | 61 res->SetInteger("layer_id", layer_id_); |
62 | 62 |
63 res->BeginDictionary("active_priority"); | 63 res->BeginDictionary("active_priority"); |
64 priority_[ACTIVE_TREE].AsValueInto(res); | 64 priority_[ACTIVE_TREE].AsValueInto(res); |
(...skipping 16 matching lines...) Expand all Loading... |
81 if (managed_state_.draw_info.resource_) | 81 if (managed_state_.draw_info.resource_) |
82 return managed_state_.draw_info.resource_->bytes(); | 82 return managed_state_.draw_info.resource_->bytes(); |
83 return 0; | 83 return 0; |
84 } | 84 } |
85 | 85 |
86 bool Tile::HasRasterTask() const { | 86 bool Tile::HasRasterTask() const { |
87 return !!managed_state_.raster_task.get(); | 87 return !!managed_state_.raster_task.get(); |
88 } | 88 } |
89 | 89 |
90 } // namespace cc | 90 } // namespace cc |
OLD | NEW |