OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef CC_RESOURCES_MANAGED_TILE_STATE_H_ | 5 #ifndef CC_RESOURCES_MANAGED_TILE_STATE_H_ |
6 #define CC_RESOURCES_MANAGED_TILE_STATE_H_ | 6 #define CC_RESOURCES_MANAGED_TILE_STATE_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "cc/resources/platform_color.h" | 9 #include "cc/resources/platform_color.h" |
10 #include "cc/resources/raster_mode.h" | |
11 #include "cc/resources/rasterizer.h" | 10 #include "cc/resources/rasterizer.h" |
12 #include "cc/resources/resource_pool.h" | 11 #include "cc/resources/resource_pool.h" |
13 #include "cc/resources/resource_provider.h" | 12 #include "cc/resources/resource_provider.h" |
14 #include "cc/resources/scoped_resource.h" | 13 #include "cc/resources/scoped_resource.h" |
15 #include "cc/resources/tile_priority.h" | 14 #include "cc/resources/tile_priority.h" |
16 | 15 |
17 namespace cc { | 16 namespace cc { |
18 | 17 |
19 class TileManager; | 18 class TileManager; |
20 | 19 |
(...skipping 10 matching lines...) Expand all Loading... |
31 NUM_BINS = 8 | 30 NUM_BINS = 8 |
32 // NOTE: Be sure to update ManagedTileBinAsValue and kBinPolicyMap when adding | 31 // NOTE: Be sure to update ManagedTileBinAsValue and kBinPolicyMap when adding |
33 // or reordering fields. | 32 // or reordering fields. |
34 }; | 33 }; |
35 scoped_ptr<base::Value> ManagedTileBinAsValue(ManagedTileBin bin); | 34 scoped_ptr<base::Value> ManagedTileBinAsValue(ManagedTileBin bin); |
36 | 35 |
37 // This is state that is specific to a tile that is | 36 // This is state that is specific to a tile that is |
38 // managed by the TileManager. | 37 // managed by the TileManager. |
39 class CC_EXPORT ManagedTileState { | 38 class CC_EXPORT ManagedTileState { |
40 public: | 39 public: |
41 class CC_EXPORT TileVersion { | 40 class CC_EXPORT TileDrawInfo { |
42 public: | 41 public: |
43 enum Mode { RESOURCE_MODE, SOLID_COLOR_MODE, PICTURE_PILE_MODE }; | 42 enum Mode { RESOURCE_MODE, SOLID_COLOR_MODE, PICTURE_PILE_MODE }; |
44 | 43 |
45 TileVersion(); | 44 TileDrawInfo(); |
46 ~TileVersion(); | 45 ~TileDrawInfo(); |
47 | 46 |
48 Mode mode() const { return mode_; } | 47 Mode mode() const { return mode_; } |
49 | 48 |
50 bool IsReadyToDraw() const; | 49 bool IsReadyToDraw() const; |
51 | 50 |
52 ResourceProvider::ResourceId get_resource_id() const { | 51 ResourceProvider::ResourceId get_resource_id() const { |
53 DCHECK(mode_ == RESOURCE_MODE); | 52 DCHECK(mode_ == RESOURCE_MODE); |
54 DCHECK(resource_); | 53 DCHECK(resource_); |
55 | 54 |
56 return resource_->id(); | 55 return resource_->id(); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 scoped_ptr<ScopedResource> resource_; | 99 scoped_ptr<ScopedResource> resource_; |
101 scoped_refptr<RasterTask> raster_task_; | 100 scoped_refptr<RasterTask> raster_task_; |
102 }; | 101 }; |
103 | 102 |
104 ManagedTileState(); | 103 ManagedTileState(); |
105 ~ManagedTileState(); | 104 ~ManagedTileState(); |
106 | 105 |
107 void AsValueInto(base::debug::TracedValue* dict) const; | 106 void AsValueInto(base::debug::TracedValue* dict) const; |
108 | 107 |
109 // Persisted state: valid all the time. | 108 // Persisted state: valid all the time. |
110 TileVersion tile_versions[NUM_RASTER_MODES]; | 109 TileDrawInfo draw_info_; |
111 RasterMode raster_mode; | |
112 | 110 |
113 ManagedTileBin bin; | 111 ManagedTileBin bin; |
114 | 112 |
115 TileResolution resolution; | 113 TileResolution resolution; |
116 bool required_for_activation; | 114 bool required_for_activation; |
117 TilePriority::PriorityBin priority_bin; | 115 TilePriority::PriorityBin priority_bin; |
118 float distance_to_visible; | 116 float distance_to_visible; |
119 bool visible_and_ready_to_draw; | 117 bool visible_and_ready_to_draw; |
120 | 118 |
121 // Priority for this state from the last time we assigned memory. | 119 // Priority for this state from the last time we assigned memory. |
122 unsigned scheduled_priority; | 120 unsigned scheduled_priority; |
123 }; | 121 }; |
124 | 122 |
125 } // namespace cc | 123 } // namespace cc |
126 | 124 |
127 #endif // CC_RESOURCES_MANAGED_TILE_STATE_H_ | 125 #endif // CC_RESOURCES_MANAGED_TILE_STATE_H_ |
OLD | NEW |