Chromium Code Reviews| Index: content/browser/renderer_host/compositor_impl_android.cc |
| diff --git a/content/browser/renderer_host/compositor_impl_android.cc b/content/browser/renderer_host/compositor_impl_android.cc |
| index fd3a6261e3cf5b938bf50805887de79c2eef44c0..76ba3de50e744105b699b0bc7383269754a0c8fb 100644 |
| --- a/content/browser/renderer_host/compositor_impl_android.cc |
| +++ b/content/browser/renderer_host/compositor_impl_android.cc |
| @@ -466,6 +466,7 @@ void CompositorImpl::SetVisible(bool visible) { |
| host_->SetVisible(false); |
| host_->ReleaseCompositorFrameSink(); |
| + has_compositor_frame_sink_ = false; |
| pending_swapbuffers_ = 0; |
| display_.reset(); |
| } else { |
| @@ -531,7 +532,12 @@ void CompositorImpl::RequestNewCompositorFrameSink() { |
| } |
| void CompositorImpl::DidInitializeCompositorFrameSink() { |
| - compositor_frame_sink_request_pending_ = false; |
| + compositor_frame_sink_request_pending_ = true; |
|
boliu
2017/01/30 17:20:22
why flip this?
Alex Z.
2017/01/30 20:37:49
Done.
|
| + has_compositor_frame_sink_ = true; |
| + for (auto& frame_sink_id : pending_child_frame_sink_ids_) { |
|
Fady Samuel
2017/01/29 15:43:01
no need for {, } if the block is a single statemen
Alex Z.
2017/01/30 20:37:49
Done.
|
| + AddChildFrameSink(frame_sink_id); |
| + } |
| + pending_child_frame_sink_ids_.clear(); |
| } |
| void CompositorImpl::DidFailToInitializeCompositorFrameSink() { |
| @@ -671,7 +677,6 @@ void CompositorImpl::InitializeDisplay( |
| frame_sink_id_, manager, display_.get(), context_provider, |
| nullptr, BrowserGpuMemoryBufferManager::current(), |
| HostSharedBitmapManager::current()); |
| - |
|
Fady Samuel
2017/01/29 15:43:01
Please avoid unnecessary code churn and restore th
|
| display_->SetVisible(true); |
| display_->Resize(size_); |
| host_->SetCompositorFrameSink(std::move(compositor_frame_sink)); |
| @@ -706,6 +711,7 @@ void CompositorImpl::DidReceiveCompositorFrameAck() { |
| void CompositorImpl::DidLoseCompositorFrameSink() { |
| TRACE_EVENT0("compositor", "CompositorImpl::DidLoseCompositorFrameSink"); |
| + has_compositor_frame_sink_ = false; |
| client_->OnSwapBuffersCompleted(0); |
| } |
| @@ -735,6 +741,16 @@ cc::FrameSinkId CompositorImpl::GetFrameSinkId() { |
| return frame_sink_id_; |
| } |
| +void CompositorImpl::AddChildFrameSink(cc::FrameSinkId frame_sink_id) { |
|
Fady Samuel
2017/01/29 15:43:01
const cc::FrameSinkId&
Alex Z.
2017/01/30 20:37:49
Done.
|
| + if (has_compositor_frame_sink_) { |
| + ui::ContextProviderFactory::GetInstance() |
| + ->GetSurfaceManager() |
| + ->RegisterFrameSinkHierarchy(frame_sink_id_, frame_sink_id); |
| + } else { |
| + pending_child_frame_sink_ids_.insert(frame_sink_id); |
| + } |
| +} |
| + |
| bool CompositorImpl::HavePendingReadbacks() { |
| return !readback_layer_tree_->children().empty(); |
| } |