summaryrefslogtreecommitdiffstats
path: root/cc/resources/managed_tile_state.h
diff options
context:
space:
mode:
authorreveman@chromium.org <reveman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-14 07:18:53 +0000
committerreveman@chromium.org <reveman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-14 07:18:53 +0000
commit282dc515172f46f41fc8511e29a9a5b0a92e48fb (patch)
tree5dfe3129a8861ca1fd99d7af716cdad6f78c9b03 /cc/resources/managed_tile_state.h
parent103994e87aa95172b922dbbf6be9fe4ce0e08585 (diff)
downloadchromium_src-282dc515172f46f41fc8511e29a9a5b0a92e48fb.zip
chromium_src-282dc515172f46f41fc8511e29a9a5b0a92e48fb.tar.gz
chromium_src-282dc515172f46f41fc8511e29a9a5b0a92e48fb.tar.bz2
cc: Refactor force upload mechanism to allow proper resource ownership passing.
Makes ResourceProvider changes required to allow reuse of resources immediately after forcing "set pixels" to complete and removes AbortSetPixels() which is no longer needed. Improves the efficiency of forced uploads by issuing the "wait-for" command as soon as we know that the upload can be forced. It also provides a significant cleanup to RasterWorkerPool interface and tile management. BUG=245767 Review URL: https://chromiumcodereview.appspot.com/16926002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@206352 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/resources/managed_tile_state.h')
-rw-r--r--cc/resources/managed_tile_state.h29
1 files changed, 6 insertions, 23 deletions
diff --git a/cc/resources/managed_tile_state.h b/cc/resources/managed_tile_state.h
index 200997b..4effe1d2 100644
--- a/cc/resources/managed_tile_state.h
+++ b/cc/resources/managed_tile_state.h
@@ -38,15 +38,9 @@ class CC_EXPORT ManagedTileState {
ResourceProvider::ResourceId get_resource_id() const {
DCHECK(mode_ == RESOURCE_MODE);
+ DCHECK(resource_);
- // We have to have a resource ID here.
- DCHECK(resource_id_);
- // If we have a resource, it implies IDs are equal.
- DCHECK(!resource_ || (resource_id_ == resource_->id()));
- // If we don't have a resource, it implies that we're in forced upload.
- DCHECK(resource_ || (resource_id_ && forced_upload_));
-
- return resource_id_;
+ return resource_->id();
}
SkColor get_solid_color() const {
@@ -56,7 +50,8 @@ class CC_EXPORT ManagedTileState {
}
bool contents_swizzled() const {
- return !PlatformColor::SameComponentOrder(resource_format_);
+ DCHECK(resource_);
+ return !PlatformColor::SameComponentOrder(resource_->format());
}
bool requires_resource() const {
@@ -68,11 +63,10 @@ class CC_EXPORT ManagedTileState {
void SetResourceForTesting(scoped_ptr<ResourcePool::Resource> resource) {
resource_ = resource.Pass();
- resource_id_ = resource_->id();
}
- scoped_ptr<ResourcePool::Resource>& GetResourceForTesting() {
- return resource_;
+ const ResourcePool::Resource* GetResourceForTesting() const {
+ return resource_.get();
}
private:
@@ -87,7 +81,6 @@ class CC_EXPORT ManagedTileState {
void set_solid_color(const SkColor& color) {
mode_ = SOLID_COLOR_MODE;
solid_color_ = color;
- resource_id_ = 0;
}
void set_has_text(bool has_text) {
@@ -96,25 +89,15 @@ class CC_EXPORT ManagedTileState {
void set_rasterize_on_demand() {
mode_ = PICTURE_PILE_MODE;
- resource_id_ = 0;
}
Mode mode_;
SkColor solid_color_;
bool has_text_;
-
- // TODO(reveman): Eliminate the need for |resource_id_|
- // and |resource_format_| and | forced_upload_| by re-factoring
- // the "force upload" mechanism. crbug.com/245767
- ResourceProvider::ResourceId resource_id_;
- GLenum resource_format_;
- bool forced_upload_;
-
scoped_ptr<ResourcePool::Resource> resource_;
RasterWorkerPool::RasterTask raster_task_;
};
-
ManagedTileState();
~ManagedTileState();