| 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;
|
|
|