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

Unified Diff: content/browser/android/in_process/synchronous_compositor_impl.cc

Issue 1150423003: webview: Initialize synchronous compositor after first activation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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/android/in_process/synchronous_compositor_impl.cc
diff --git a/content/browser/android/in_process/synchronous_compositor_impl.cc b/content/browser/android/in_process/synchronous_compositor_impl.cc
index d3c6b830b7082bf6e2dec32f803b6751d249aa47..7940597124474939cf5bb6f869a21cb5c51e57e4 100644
--- a/content/browser/android/in_process/synchronous_compositor_impl.cc
+++ b/content/browser/android/in_process/synchronous_compositor_impl.cc
@@ -74,6 +74,7 @@ SynchronousCompositorImpl::SynchronousCompositorImpl(WebContents* contents)
contents_(contents),
routing_id_(contents->GetRoutingID()),
input_handler_(NULL),
+ has_initialized_(false),
is_active_(false),
renderer_needs_begin_frames_(false),
weak_ptr_factory_(this) {
@@ -140,11 +141,9 @@ void SynchronousCompositorImpl::DidInitializeRendererObjects(
base::Bind(&SynchronousCompositorImpl::DidActivatePendingTree,
weak_ptr_factory_.GetWeakPtr()));
- OnNeedsBeginFramesChange(begin_frame_source_->NeedsBeginFrames());
-
- compositor_client_->DidInitializeCompositor(this);
-
SetInputHandler(input_handler);
+
+ OnNeedsBeginFramesChange(begin_frame_source_->NeedsBeginFrames());
}
void SynchronousCompositorImpl::DidDestroyRendererObjects() {
@@ -152,6 +151,8 @@ void SynchronousCompositorImpl::DidDestroyRendererObjects() {
DCHECK(begin_frame_source_);
DCHECK(compositor_client_);
+ OnNeedsBeginFramesChange(false);
+
begin_frame_source_->SetCompositor(nullptr);
output_surface_->SetCompositor(nullptr);
SetInputHandler(nullptr);
@@ -263,7 +264,8 @@ void SynchronousCompositorImpl::UpdateNeedsBeginFrames() {
RenderWidgetHostViewAndroid* rwhv = static_cast<RenderWidgetHostViewAndroid*>(
contents_->GetRenderWidgetHostView());
if (rwhv)
- rwhv->OnSetNeedsBeginFrames(is_active_ && renderer_needs_begin_frames_);
+ rwhv->OnSetNeedsBeginFrames((is_active_ || !has_initialized_) &&
+ renderer_needs_begin_frames_);
}
void SynchronousCompositorImpl::SetInputHandler(
@@ -315,6 +317,10 @@ void SynchronousCompositorImpl::DeliverMessages() {
void SynchronousCompositorImpl::DidActivatePendingTree() {
DCHECK(compositor_client_);
+ if (!has_initialized_) {
+ has_initialized_ = true;
+ compositor_client_->DidInitializeCompositor(this);
+ }
compositor_client_->DidUpdateContent();
DeliverMessages();
}

Powered by Google App Engine
This is Rietveld 408576698