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

Unified Diff: cc/resources/resource_provider.cc

Issue 207943002: cc: Reduce size of cc::ResourceProvider::Resource class (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« cc/resources/resource_provider.h ('K') | « cc/resources/resource_provider.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/resource_provider.cc
diff --git a/cc/resources/resource_provider.cc b/cc/resources/resource_provider.cc
index 1cb215bd20993c51ead0dc647575d86e6f535eb3..e7d168609cb62cd582a48ab5a262a84d4a8a5199 100644
--- a/cc/resources/resource_provider.cc
+++ b/cc/resources/resource_provider.cc
@@ -210,28 +210,28 @@ ResourceProvider::Resource::Resource()
lock_for_read_count(0),
imported_count(0),
exported_count(0),
+ image_id(0),
+ bound_image_id(0),
+ dirty_image(false),
locked_for_write(false),
- origin(Internal),
+ lost(false),
marked_for_deletion(false),
pending_set_pixels(false),
set_pixels_completion_forced(false),
allocated(false),
enable_read_lock_fences(false),
+ has_shared_bitmap_id(false),
read_lock_fence(NULL),
size(),
+ origin(Internal),
target(0),
original_filter(0),
filter(0),
- image_id(0),
- bound_image_id(0),
- dirty_image(false),
texture_pool(0),
wrap_mode(0),
- lost(false),
hint(TextureUsageAny),
type(InvalidType),
format(RGBA_8888),
- has_shared_bitmap_id(false),
shared_bitmap(NULL) {}
ResourceProvider::Resource::~Resource() {}
@@ -254,28 +254,28 @@ ResourceProvider::Resource::Resource(GLuint texture_id,
lock_for_read_count(0),
imported_count(0),
exported_count(0),
+ image_id(0),
+ bound_image_id(0),
+ dirty_image(false),
locked_for_write(false),
- origin(origin),
+ lost(false),
marked_for_deletion(false),
pending_set_pixels(false),
set_pixels_completion_forced(false),
allocated(false),
enable_read_lock_fences(false),
+ has_shared_bitmap_id(false),
read_lock_fence(NULL),
size(size),
+ origin(origin),
target(target),
original_filter(filter),
filter(filter),
- image_id(0),
- bound_image_id(0),
- dirty_image(false),
texture_pool(texture_pool),
wrap_mode(wrap_mode),
- lost(false),
hint(hint),
type(GLTexture),
format(format),
- has_shared_bitmap_id(false),
shared_bitmap(NULL) {
DCHECK(wrap_mode == GL_CLAMP_TO_EDGE || wrap_mode == GL_REPEAT);
DCHECK_EQ(origin == Internal, !!texture_pool);
@@ -296,28 +296,28 @@ ResourceProvider::Resource::Resource(uint8_t* pixels,
lock_for_read_count(0),
imported_count(0),
exported_count(0),
+ image_id(0),
+ bound_image_id(0),
+ dirty_image(false),
locked_for_write(false),
- origin(origin),
+ lost(false),
marked_for_deletion(false),
pending_set_pixels(false),
set_pixels_completion_forced(false),
allocated(false),
enable_read_lock_fences(false),
+ has_shared_bitmap_id(!!bitmap),
read_lock_fence(NULL),
size(size),
+ origin(origin),
target(0),
original_filter(filter),
filter(filter),
- image_id(0),
- bound_image_id(0),
- dirty_image(false),
texture_pool(0),
wrap_mode(wrap_mode),
- lost(false),
hint(TextureUsageAny),
type(Bitmap),
format(RGBA_8888),
- has_shared_bitmap_id(!!bitmap),
shared_bitmap(bitmap) {
DCHECK(wrap_mode == GL_CLAMP_TO_EDGE || wrap_mode == GL_REPEAT);
DCHECK(origin == Delegated || pixels);
@@ -339,28 +339,28 @@ ResourceProvider::Resource::Resource(const SharedBitmapId& bitmap_id,
lock_for_read_count(0),
imported_count(0),
exported_count(0),
+ image_id(0),
+ bound_image_id(0),
+ dirty_image(false),
locked_for_write(false),
- origin(origin),
+ lost(false),
marked_for_deletion(false),
pending_set_pixels(false),
set_pixels_completion_forced(false),
allocated(false),
enable_read_lock_fences(false),
+ has_shared_bitmap_id(true),
read_lock_fence(NULL),
size(size),
+ origin(origin),
target(0),
original_filter(filter),
filter(filter),
- image_id(0),
- bound_image_id(0),
- dirty_image(false),
texture_pool(0),
wrap_mode(wrap_mode),
- lost(false),
hint(TextureUsageAny),
type(Bitmap),
format(RGBA_8888),
- has_shared_bitmap_id(true),
shared_bitmap_id(bitmap_id),
shared_bitmap(NULL) {
DCHECK(wrap_mode == GL_CLAMP_TO_EDGE || wrap_mode == GL_REPEAT);
@@ -1043,6 +1043,7 @@ const ResourceProvider::Resource* ResourceProvider::LockForRead(ResourceId id) {
DCHECK_EQ(resource->exported_count, 0);
// Uninitialized! Call SetPixels or LockForWrite first.
DCHECK(resource->allocated);
+ DCHECK_NE(resource->lock_for_read_count, std::numeric_limits<uint16>::max());
LazyCreate(resource);
@@ -1348,6 +1349,8 @@ void ResourceProvider::PrepareSendToParent(const ResourceIdArray& resources,
TransferResource(gl, *it, &resource);
if (!resource.mailbox_holder.sync_point && !resource.is_software)
need_sync_point = true;
+ DCHECK_NE(resources_.find(*it)->second.exported_count,
+ std::numeric_limits<uint16>::max());
++resources_.find(*it)->second.exported_count;
list->push_back(resource);
}
@@ -1375,6 +1378,7 @@ void ResourceProvider::ReceiveFromChild(
child_info.child_to_parent_map.find(it->id);
if (resource_in_map_it != child_info.child_to_parent_map.end()) {
Resource& resource = resources_[resource_in_map_it->second];
+ DCHECK_NE(resource.imported_count, std::numeric_limits<uint16>::max());
resource.marked_for_deletion = false;
resource.imported_count++;
continue;
« cc/resources/resource_provider.h ('K') | « cc/resources/resource_provider.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698