diff options
Diffstat (limited to 'content/browser/android/in_process/synchronous_compositor_impl.cc')
-rw-r--r-- | content/browser/android/in_process/synchronous_compositor_impl.cc | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/content/browser/android/in_process/synchronous_compositor_impl.cc b/content/browser/android/in_process/synchronous_compositor_impl.cc index 06d622c..9846672 100644 --- a/content/browser/android/in_process/synchronous_compositor_impl.cc +++ b/content/browser/android/in_process/synchronous_compositor_impl.cc @@ -8,7 +8,6 @@ #include "base/bind.h" #include "base/lazy_instance.h" #include "base/message_loop/message_loop.h" -#include "cc/input/input_handler.h" #include "content/browser/android/in_process/synchronous_compositor_external_begin_frame_source.h" #include "content/browser/android/in_process/synchronous_compositor_factory_impl.h" #include "content/browser/android/in_process/synchronous_compositor_registry.h" @@ -21,6 +20,7 @@ #include "content/public/browser/browser_thread.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/render_view_host.h" +#include "ui/gfx/geometry/scroll_offset.h" #include "ui/gl/gl_surface.h" namespace content { @@ -79,7 +79,7 @@ SynchronousCompositorImpl::SynchronousCompositorImpl(WebContents* contents) begin_frame_source_(nullptr), contents_(contents), routing_id_(contents->GetRoutingID()), - input_handler_(nullptr), + synchronous_input_handler_proxy_(nullptr), registered_with_client_(false), is_active_(true), renderer_needs_begin_frames_(false), @@ -92,7 +92,7 @@ SynchronousCompositorImpl::SynchronousCompositorImpl(WebContents* contents) SynchronousCompositorImpl::~SynchronousCompositorImpl() { DCHECK(!output_surface_); DCHECK(!begin_frame_source_); - DCHECK(!input_handler_); + DCHECK(!synchronous_input_handler_proxy_); } void SynchronousCompositorImpl::SetClient( @@ -120,7 +120,7 @@ void SynchronousCompositorImpl::RegisterWithClient() { DCHECK(CalledOnValidThread()); DCHECK(compositor_client_); DCHECK(output_surface_); - DCHECK(input_handler_); + DCHECK(synchronous_input_handler_proxy_); DCHECK(!registered_with_client_); registered_with_client_ = true; @@ -130,12 +130,10 @@ void SynchronousCompositorImpl::RegisterWithClient() { base::Bind(&SynchronousCompositorImpl::DidActivatePendingTree, weak_ptr_factory_.GetWeakPtr())); - // Setting the delegate causes UpdateRootLayerState immediately so do it - // after setting the client. - input_handler_->SetRootLayerScrollOffsetDelegate(this); // This disables the input system from animating inputs autonomously, instead // routing all input animations through the SynchronousInputHandler, which is - // |this| class. + // |this| class. Calling this causes an UpdateRootLayerState() immediately so, + // do it after setting the client. synchronous_input_handler_proxy_->SetOnlySynchronouslyAnimateRootFlings(this); } @@ -155,19 +153,16 @@ void SynchronousCompositor::SetUseIpcCommandBuffer() { void SynchronousCompositorImpl::DidInitializeRendererObjects( SynchronousCompositorOutputSurface* output_surface, SynchronousCompositorExternalBeginFrameSource* begin_frame_source, - cc::InputHandler* input_handler, SynchronousInputHandlerProxy* synchronous_input_handler_proxy) { DCHECK(!output_surface_); DCHECK(!begin_frame_source_); DCHECK(output_surface); DCHECK(begin_frame_source); DCHECK(compositor_client_); - DCHECK(input_handler); DCHECK(synchronous_input_handler_proxy); output_surface_ = output_surface; begin_frame_source_ = begin_frame_source; - input_handler_ = input_handler; synchronous_input_handler_proxy_ = synchronous_input_handler_proxy; output_surface_->SetCompositor(this); @@ -180,16 +175,18 @@ void SynchronousCompositorImpl::DidDestroyRendererObjects() { DCHECK(compositor_client_); if (registered_with_client_) { - input_handler_->SetRootLayerScrollOffsetDelegate(nullptr); output_surface_->SetTreeActivationCallback(base::Closure()); compositor_client_->DidDestroyCompositor(this); registered_with_client_ = false; } + // This object is being destroyed, so remove pointers to it. begin_frame_source_->SetCompositor(nullptr); output_surface_->SetCompositor(nullptr); + synchronous_input_handler_proxy_->SetOnlySynchronouslyAnimateRootFlings( + nullptr); - input_handler_ = nullptr; + synchronous_input_handler_proxy_ = nullptr; begin_frame_source_ = nullptr; output_surface_ = nullptr; // Don't propogate this signal from one renderer to the next. @@ -276,9 +273,10 @@ void SynchronousCompositorImpl::PostInvalidate() { void SynchronousCompositorImpl::DidChangeRootLayerScrollOffset( const gfx::ScrollOffset& root_offset) { DCHECK(CalledOnValidThread()); - if (!input_handler_) + if (!synchronous_input_handler_proxy_) return; - input_handler_->OnRootLayerDelegatedScrollOffsetChanged(root_offset); + synchronous_input_handler_proxy_->SynchronouslySetRootScrollOffset( + root_offset); } void SynchronousCompositorImpl::SetIsActive(bool is_active) { |