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 752f72344cfa462ec18928f2ab52ce6e54a1641c..26c011a65f829872968707a14996ffa11c8b3c21 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; |
|
boliu
2017/01/26 22:39:41
why set this to false here?
Alex Z.
2017/01/27 20:27:02
host_->ReleaseCompositorFrameSink() calls DirectCo
|
| pending_swapbuffers_ = 0; |
| display_.reset(); |
| } else { |
| @@ -532,6 +533,11 @@ void CompositorImpl::RequestNewCompositorFrameSink() { |
| void CompositorImpl::DidInitializeCompositorFrameSink() { |
| compositor_frame_sink_request_pending_ = false; |
| + for (auto& frame_sink_id : pending_child_frame_sink_ids_) { |
| + AddChildFrameSink(frame_sink_id); |
|
boliu
2017/01/26 22:39:41
this makes no sense to me.. has_compositor_frame_s
Alex Z.
2017/01/27 20:27:02
My bad. has_compositor_frame_sink_ should be set t
|
| + } |
| + pending_child_frame_sink_ids_.clear(); |
| + has_compositor_frame_sink_ = true; |
| } |
| void CompositorImpl::DidFailToInitializeCompositorFrameSink() { |
| @@ -671,7 +677,6 @@ void CompositorImpl::InitializeDisplay( |
| frame_sink_id_, manager, display_.get(), context_provider, |
| nullptr, BrowserGpuMemoryBufferManager::current(), |
| HostSharedBitmapManager::current()); |
| - |
| 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,19 @@ cc::FrameSinkId CompositorImpl::GetFrameSinkId() { |
| return frame_sink_id_; |
| } |
| +void CompositorImpl::AddChildFrameSink(cc::FrameSinkId frame_sink_id) { |
| + if (!has_compositor_frame_sink_) { |
| + pending_child_frame_sink_ids_.insert(frame_sink_id); |
| + } else { |
| + // All pending child frame sink ids should be added upon the creation of |
| + // compositor frame sink. |
| + DCHECK(pending_child_frame_sink_ids_.empty()); |
| + ui::ContextProviderFactory::GetInstance() |
| + ->GetSurfaceManager() |
| + ->RegisterFrameSinkHierarchy(frame_sink_id_, frame_sink_id); |
| + } |
| +} |
| + |
| bool CompositorImpl::HavePendingReadbacks() { |
| return !readback_layer_tree_->children().empty(); |
| } |