Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(282)

Unified Diff: content/browser/renderer_host/compositor_impl_android.cc

Issue 2612083002: DirectCompositorFrameSink Uses CompositorFrameSinkSupport (Closed)
Patch Set: Addressed comments Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..5935cdf35c47dcb025d88afa2421e3a5fadb4466 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;
+ has_compositor_frame_sink_ = true;
+ for (auto& frame_sink_id : pending_child_frame_sink_ids_) {
+ 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());
-
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_) {
boliu 2017/01/27 23:17:59 reverse the the condition and flip the body, it's
Alex Z. 2017/01/29 14:58:51 Done.
+ 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());
boliu 2017/01/27 23:17:59 this DCHECK clearly doesn't hold when called from
Alex Z. 2017/01/29 14:58:51 My bad. I was thinking of two ways to approach thi
+ ui::ContextProviderFactory::GetInstance()
+ ->GetSurfaceManager()
+ ->RegisterFrameSinkHierarchy(frame_sink_id_, frame_sink_id);
boliu 2017/01/27 23:17:59 it's not immediately clear to me why this can't be
Alex Z. 2017/01/29 14:58:51 ~CompositorFrameSinkSupport() calls InvalidateFram
+ }
+}
+
bool CompositorImpl::HavePendingReadbacks() {
return !readback_layer_tree_->children().empty();
}

Powered by Google App Engine
This is Rietveld 408576698