Chromium Code Reviews| Index: content/renderer/android/synchronous_compositor_frame_sink.cc |
| diff --git a/content/renderer/android/synchronous_compositor_frame_sink.cc b/content/renderer/android/synchronous_compositor_frame_sink.cc |
| index 4113e6210d05e592ebc7534a07c63e7f8867d2cf..11418a1adc29b76f9142c016457f39acb2dd4c75 100644 |
| --- a/content/renderer/android/synchronous_compositor_frame_sink.cc |
| +++ b/content/renderer/android/synchronous_compositor_frame_sink.cc |
| @@ -122,7 +122,9 @@ SynchronousCompositorFrameSink::SynchronousCompositorFrameSink( |
| frame_swap_message_queue_(frame_swap_message_queue), |
| surface_manager_(new cc::SurfaceManager), |
| surface_id_allocator_(new cc::SurfaceIdAllocator()), |
| - surface_factory_( |
| + root_factory_( |
| + new cc::SurfaceFactory(kFrameSinkId, surface_manager_.get(), this)), |
|
boliu
2016/11/11 23:50:45
is re-using the same kFrameSinkId for two differen
Fady Samuel
2016/11/11 23:57:33
Good catch! No we shouldn't reuse the same FrameSi
Saman Sami
2016/11/14 23:39:01
Done.
|
| + child_factory_( |
| new cc::SurfaceFactory(kFrameSinkId, surface_manager_.get(), this)), |
| begin_frame_source_(std::move(begin_frame_source)) { |
| DCHECK(registry_); |
| @@ -198,15 +200,14 @@ void SynchronousCompositorFrameSink::DetachFromClient() { |
| begin_frame_source_ = nullptr; |
| registry_->UnregisterCompositorFrameSink(routing_id_, this); |
| client_->SetTreeActivationCallback(base::Closure()); |
| - if (root_local_frame_id_.is_valid()) { |
| - surface_factory_->Destroy(root_local_frame_id_); |
| - surface_factory_->Destroy(child_local_frame_id_); |
| - } |
| + root_factory_->EvictFrame(); |
| + child_factory_->EvictFrame(); |
| surface_manager_->UnregisterSurfaceFactoryClient(kFrameSinkId); |
| surface_manager_->InvalidateFrameSinkId(kFrameSinkId); |
| software_output_surface_ = nullptr; |
| display_ = nullptr; |
| - surface_factory_ = nullptr; |
| + child_factory_ = nullptr; |
| + root_factory_ = nullptr; |
| surface_id_allocator_ = nullptr; |
| surface_manager_ = nullptr; |
| cc::CompositorFrameSink::DetachFromClient(); |
| @@ -237,9 +238,7 @@ void SynchronousCompositorFrameSink::SubmitCompositorFrame( |
| if (!root_local_frame_id_.is_valid()) { |
| root_local_frame_id_ = surface_id_allocator_->GenerateId(); |
| - surface_factory_->Create(root_local_frame_id_); |
| child_local_frame_id_ = surface_id_allocator_->GenerateId(); |
| - surface_factory_->Create(child_local_frame_id_); |
| } |
| display_->SetLocalFrameId(root_local_frame_id_, |
| @@ -288,11 +287,11 @@ void SynchronousCompositorFrameSink::SubmitCompositorFrame( |
| gfx::Rect(child_size), |
| cc::SurfaceId(kFrameSinkId, child_local_frame_id_)); |
| - surface_factory_->SubmitCompositorFrame( |
| + child_factory_->SubmitCompositorFrame( |
| child_local_frame_id_, std::move(frame), base::Bind(&NoOpDrawCallback)); |
| - surface_factory_->SubmitCompositorFrame(root_local_frame_id_, |
| - std::move(embed_frame), |
| - base::Bind(&NoOpDrawCallback)); |
| + root_factory_->SubmitCompositorFrame(root_local_frame_id_, |
| + std::move(embed_frame), |
| + base::Bind(&NoOpDrawCallback)); |
| display_->DrawAndSwap(); |
| } else { |
| // For hardware draws we send the whole frame to the client so it can draw |