Chromium Code Reviews| Index: cc/layers/delegated_renderer_layer.cc |
| diff --git a/cc/layers/delegated_renderer_layer.cc b/cc/layers/delegated_renderer_layer.cc |
| index 5286874cc6b12b138e35d72faece48f940ff383f..a0e51b029f6e6bacca5ecafa5bf4390ff095ffc9 100644 |
| --- a/cc/layers/delegated_renderer_layer.cc |
| +++ b/cc/layers/delegated_renderer_layer.cc |
| @@ -64,19 +64,21 @@ void DelegatedRendererLayer::PushPropertiesTo(LayerImpl* impl) { |
| delegated_impl->SetDisplaySize(display_size_); |
| + delegated_impl->CreateChildIdIfNeeded( |
| + base::Bind(&DelegatedRendererLayer::ReceiveUnusedResources, this)); |
|
piman
2013/09/20 01:55:01
Layer is only RefCounted, not RefCountedThreadSafe
danakj
2013/09/20 14:54:52
Oh, right. I will use a WeakPtrFactory.
danakj
2013/09/20 15:39:21
Ugh thread issues. The right way to do this is to
danakj
2013/09/20 17:35:12
Ok done. Used a WeakPtrFactory and a BlockingTaskR
|
| + |
| if (frame_data_) |
| delegated_impl->SetFrameData(frame_data_.Pass(), damage_in_frame_); |
| frame_data_.reset(); |
| damage_in_frame_ = gfx::RectF(); |
| - delegated_impl->CollectUnusedResources( |
| - &unused_resources_for_child_compositor_); |
| - |
| + // The ResourceProvider will have the new frame as soon as we push it to the |
| + // pending tree. So unused resources will be returned as well. |
| if (client_) |
| client_->DidCommitFrameData(); |
| - // TODO(danakj): TakeUnusedResourcesForChildCompositor requires a push |
| - // properties to happen in order to collect unused resources returned |
| + // TODO(danakj): The DidCommitFrameData() notification requires a push |
| + // properties to happen in order to notify about unused resources returned |
| // from the parent compositor. crbug.com/259090 |
| needs_push_properties_ = true; |
| } |
| @@ -90,6 +92,8 @@ void DelegatedRendererLayer::SetDisplaySize(gfx::Size size) { |
| void DelegatedRendererLayer::SetFrameData( |
| scoped_ptr<DelegatedFrameData> new_frame_data) { |
| + DCHECK(new_frame_data); |
| + |
| if (frame_data_) { |
| // Copy the resources from the last provided frame into the unused resources |
| // list, as the new frame will provide its own resources. |
| @@ -136,7 +140,17 @@ void DelegatedRendererLayer::TakeUnusedResourcesForChildCompositor( |
| DCHECK(array->empty()); |
| array->clear(); |
| + base::AutoLock lock(unused_resources_lock_); |
| array->swap(unused_resources_for_child_compositor_); |
| } |
| +void DelegatedRendererLayer::ReceiveUnusedResources( |
| + const ReturnedResourceArray& unused) { |
| + base::AutoLock lock(unused_resources_lock_); |
| + unused_resources_for_child_compositor_.insert( |
| + unused_resources_for_child_compositor_.end(), |
| + unused.begin(), |
| + unused.end()); |
| +} |
| + |
| } // namespace cc |