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

Unified Diff: cc/resources/resource_provider.cc

Issue 43753002: cc: Keep track of busy resources in ResourcePool (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 2 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 874fe3f641907df4c4e2b198316ce662d639b2a2..ce654f1f889bd16ea06727842e2e790f6b465218 100644
--- a/cc/resources/resource_provider.cc
+++ b/cc/resources/resource_provider.cc
@@ -258,6 +258,11 @@ bool ResourceProvider::IsLost(ResourceId id) {
return resource->lost;
}
+bool ResourceProvider::IsExported(ResourceId id) {
+ Resource* resource = GetResource(id);
+ return resource->exported_count > 0;
+}
+
ResourceProvider::ResourceId ResourceProvider::CreateResource(
gfx::Size size,
GLint wrap_mode,
@@ -792,7 +797,8 @@ ResourceProvider::ResourceProvider(OutputSurface* output_surface,
SharedBitmapManager* shared_bitmap_manager,
int highp_threshold_min,
bool use_rgba_4444_texture_format)
- : output_surface_(output_surface),
+ : client_(NULL),
+ output_surface_(output_surface),
shared_bitmap_manager_(shared_bitmap_manager),
lost_output_surface_(false),
highp_threshold_min_(highp_threshold_min),
@@ -808,6 +814,10 @@ ResourceProvider::ResourceProvider(OutputSurface* output_surface,
DCHECK(output_surface_->HasClient());
}
+void ResourceProvider::SetClient(ResourceProviderClient* client) {
+ client_ = client;
+}
+
void ResourceProvider::InitializeSoftware() {
DCHECK(thread_checker_.CalledOnValidThread());
DCHECK_NE(Bitmap, default_resource_type_);
@@ -924,7 +934,12 @@ void ResourceProvider::PrepareSendToParent(const ResourceIdArray& resources,
TransferResource(context3d, *it, &resource);
if (!resource.sync_point && !resource.is_software)
need_sync_point = true;
- ++resources_.find(*it)->second.exported_count;
+ ResourceMap::iterator resource_it = resources_.find(*it);
+ if (resource_it->second.exported_count == 0) {
+ if (client_)
+ client_->ResourceExported(*it);
+ }
+ ++resource_it->second.exported_count;
list->push_back(resource);
}
if (need_sync_point) {
@@ -1092,6 +1107,10 @@ void ResourceProvider::ReceiveReturnsFromParent(
CHECK_GE(resource->exported_count, returned.count);
resource->exported_count -= returned.count;
+ if (resource->exported_count == 0) {
+ if (client_)
+ client_->ResourceReturned(local_id);
+ }
resource->lost |= returned.lost;
if (resource->exported_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