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

Side by Side Diff: cc/resources/managed_tile_state.h

Issue 16190002: cc: Add new RasterWorkerPool interface. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Move SkDevice creation to RasterWorkerPool implementation Created 7 years, 6 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 unified diff | Download patch
OLDNEW
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_worker_pool.h" 10 #include "cc/resources/raster_worker_pool.h"
(...skipping 27 matching lines...) Expand all
38 ~TileVersion(); 38 ~TileVersion();
39 39
40 Mode mode() const { 40 Mode mode() const {
41 return mode_; 41 return mode_;
42 } 42 }
43 43
44 bool IsReadyToDraw() const; 44 bool IsReadyToDraw() const;
45 45
46 ResourceProvider::ResourceId get_resource_id() const { 46 ResourceProvider::ResourceId get_resource_id() const {
47 DCHECK(mode_ == RESOURCE_MODE); 47 DCHECK(mode_ == RESOURCE_MODE);
48 DCHECK(resource_); 48 DCHECK(resource_id_);
49 DCHECK(memory_state_ == USING_RELEASABLE_MEMORY || forced_upload_); 49 DCHECK(memory_state_ == USING_RELEASABLE_MEMORY || forced_upload_);
50 return resource_->id(); 50 return resource_id_;
51 } 51 }
52 52
53 SkColor get_solid_color() const { 53 SkColor get_solid_color() const {
54 DCHECK(mode_ == SOLID_COLOR_MODE); 54 DCHECK(mode_ == SOLID_COLOR_MODE);
55 55
56 return solid_color_; 56 return solid_color_;
57 } 57 }
58 58
59 bool contents_swizzled() const { 59 bool contents_swizzled() const {
60 return !PlatformColor::SameComponentOrder(resource_format_); 60 return !PlatformColor::SameComponentOrder(resource_format_);
(...skipping 22 matching lines...) Expand all
83 void set_use_resource() { 83 void set_use_resource() {
84 mode_ = RESOURCE_MODE; 84 mode_ = RESOURCE_MODE;
85 if (memory_state_ == NOT_ALLOWED_TO_USE_MEMORY) 85 if (memory_state_ == NOT_ALLOWED_TO_USE_MEMORY)
86 memory_state_ = CAN_USE_MEMORY; 86 memory_state_ = CAN_USE_MEMORY;
87 } 87 }
88 88
89 void set_solid_color(const SkColor& color) { 89 void set_solid_color(const SkColor& color) {
90 mode_ = SOLID_COLOR_MODE; 90 mode_ = SOLID_COLOR_MODE;
91 solid_color_ = color; 91 solid_color_ = color;
92 memory_state_ = NOT_ALLOWED_TO_USE_MEMORY; 92 memory_state_ = NOT_ALLOWED_TO_USE_MEMORY;
93 resource_id_ = 0;
93 } 94 }
94 95
95 void set_rasterize_on_demand() { 96 void set_rasterize_on_demand() {
96 mode_ = PICTURE_PILE_MODE; 97 mode_ = PICTURE_PILE_MODE;
97 memory_state_ = NOT_ALLOWED_TO_USE_MEMORY; 98 memory_state_ = NOT_ALLOWED_TO_USE_MEMORY;
99 resource_id_ = 0;
98 } 100 }
99 101
100 Mode mode_; 102 Mode mode_;
101 SkColor solid_color_; 103 SkColor solid_color_;
102 104
105 ResourceProvider::ResourceId resource_id_;
103 scoped_ptr<ResourcePool::Resource> resource_; 106 scoped_ptr<ResourcePool::Resource> resource_;
104 GLenum resource_format_; 107 GLenum resource_format_;
105 TileVersionMemoryState memory_state_; 108 TileVersionMemoryState memory_state_;
106 bool forced_upload_; 109 bool forced_upload_;
107 }; 110 };
108 111
109 112
110 ManagedTileState(); 113 ManagedTileState();
111 ~ManagedTileState(); 114 ~ManagedTileState();
112 115
113 scoped_ptr<base::Value> AsValue() const; 116 scoped_ptr<base::Value> AsValue() const;
114 117
115 // Persisted state: valid all the time. 118 // Persisted state: valid all the time.
116 TileVersion tile_version; 119 TileVersion tile_version;
117 bool picture_pile_analyzed; 120 bool picture_pile_analyzed;
118 PicturePileImpl::Analysis picture_pile_analysis; 121 PicturePileImpl::Analysis picture_pile_analysis;
119 RasterWorkerPool::Task raster_task; 122 RasterWorkerPool::RasterTask raster_task;
120 123
121 // Ephemeral state, valid only during TileManager::ManageTiles. 124 // Ephemeral state, valid only during TileManager::ManageTiles.
122 bool is_in_never_bin_on_both_trees() const { 125 bool is_in_never_bin_on_both_trees() const {
123 return bin[HIGH_PRIORITY_BIN] == NEVER_BIN && 126 return bin[HIGH_PRIORITY_BIN] == NEVER_BIN &&
124 bin[LOW_PRIORITY_BIN] == NEVER_BIN; 127 bin[LOW_PRIORITY_BIN] == NEVER_BIN;
125 } 128 }
126 bool is_in_now_bin_on_either_tree() const { 129 bool is_in_now_bin_on_either_tree() const {
127 return bin[HIGH_PRIORITY_BIN] == NOW_BIN || 130 return bin[HIGH_PRIORITY_BIN] == NOW_BIN ||
128 bin[LOW_PRIORITY_BIN] == NOW_BIN; 131 bin[LOW_PRIORITY_BIN] == NOW_BIN;
129 } 132 }
130 133
131 TileManagerBin bin[NUM_BIN_PRIORITIES]; 134 TileManagerBin bin[NUM_BIN_PRIORITIES];
132 TileManagerBin tree_bin[NUM_TREES]; 135 TileManagerBin tree_bin[NUM_TREES];
133 136
134 // The bin that the tile would have if the GPU memory manager had 137 // The bin that the tile would have if the GPU memory manager had
135 // a maximally permissive policy, send to the GPU memory manager 138 // a maximally permissive policy, send to the GPU memory manager
136 // to determine policy. 139 // to determine policy.
137 TileManagerBin gpu_memmgr_stats_bin; 140 TileManagerBin gpu_memmgr_stats_bin;
138 TileResolution resolution; 141 TileResolution resolution;
139 bool required_for_activation; 142 bool required_for_activation;
140 float time_to_needed_in_seconds; 143 float time_to_needed_in_seconds;
141 float distance_to_visible_in_pixels; 144 float distance_to_visible_in_pixels;
142 }; 145 };
143 146
144 } // namespace cc 147 } // namespace cc
145 148
146 #endif // CC_RESOURCES_MANAGED_TILE_STATE_H_ 149 #endif // CC_RESOURCES_MANAGED_TILE_STATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698