Chromium Code Reviews| 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 8fa47017afb71151426a3276f863516d3b3585ff..50d43366f2b8776f3ce58885b1261cb73b8ab25e 100644 |
| --- a/content/browser/android/in_process/synchronous_compositor_impl.cc |
| +++ b/content/browser/android/in_process/synchronous_compositor_impl.cc |
| @@ -6,12 +6,16 @@ |
| #include "base/lazy_instance.h" |
| #include "base/message_loop.h" |
| +#include "cc/input/input_handler.h" |
| +#include "cc/input/layer_scroll_offset_delegate.h" |
| #include "content/browser/android/in_process/synchronous_input_event_filter.h" |
| #include "content/public/browser/android/synchronous_compositor_client.h" |
| #include "content/public/browser/browser_thread.h" |
| #include "content/public/browser/render_process_host.h" |
| #include "content/public/browser/render_view_host.h" |
| #include "content/renderer/android/synchronous_compositor_factory.h" |
| +#include "content/renderer/gpu/input_handler_manager.h" |
| +#include "content/renderer/render_thread_impl.h" |
| namespace content { |
| @@ -32,7 +36,7 @@ int GetInProcessRendererId() { |
| return id; |
| } |
| -class SynchronousCompositorFactoryImpl : public SynchronousCompositorFactory { |
| +class SynchronousCompositorFactoryImpl: public SynchronousCompositorFactory { |
|
joth
2013/06/06 20:19:32
reminder: revert me
mkosiba (inactive)
2013/06/07 16:18:27
Thanks! Done.
|
| public: |
| SynchronousCompositorFactoryImpl() { |
| SynchronousCompositorFactory::SetInstance(this); |
| @@ -124,6 +128,11 @@ bool SynchronousCompositorImpl::DemandDrawHw( |
| return output_surface_->DemandDrawHw(view_size, transform, damage_area); |
| } |
| +void SynchronousCompositorImpl::DidChangeRootLayerScrollOffset() { |
| + if (input_handler_.get()) |
| + input_handler_->OnRootLayerDelegatedScrollOffsetChanged(); |
| +} |
| + |
| void SynchronousCompositorImpl::DidBindOutputSurface( |
| SynchronousCompositorOutputSurface* output_surface) { |
| DCHECK(CalledOnValidThread()); |
| @@ -135,6 +144,7 @@ void SynchronousCompositorImpl::DidBindOutputSurface( |
| void SynchronousCompositorImpl::DidDestroySynchronousOutputSurface( |
| SynchronousCompositorOutputSurface* output_surface) { |
| DCHECK(CalledOnValidThread()); |
| + |
| // Allow for transient hand-over when two output surfaces may refer to |
| // a single delegate. |
| if (output_surface_ == output_surface) { |
| @@ -145,6 +155,19 @@ void SynchronousCompositorImpl::DidDestroySynchronousOutputSurface( |
| } |
| } |
| +void SynchronousCompositorImpl::SetInputHandler( |
| + base::WeakPtr<cc::InputHandler> input_handler) { |
| + DCHECK(CalledOnValidThread()); |
| + |
| + if (input_handler_.get()) |
| + input_handler_->SetRootLayerScrollOffsetDelegate(NULL); |
| + |
| + input_handler_ = input_handler; |
| + |
| + if (input_handler_.get()) |
| + input_handler_->SetRootLayerScrollOffsetDelegate(this); |
| +} |
| + |
| void SynchronousCompositorImpl::SetContinuousInvalidate(bool enable) { |
| DCHECK(CalledOnValidThread()); |
| if (compositor_client_) |
| @@ -158,6 +181,20 @@ InputEventAckState SynchronousCompositorImpl::HandleInputEvent( |
| routing_id_, input_event); |
| } |
| +void SynchronousCompositorImpl::SetTotalScrollOffset(gfx::Vector2dF new_value) { |
| + DCHECK(CalledOnValidThread()); |
| + if (compositor_client_) |
| + compositor_client_->SetTotalRootLayerScrollOffset(new_value); |
| +} |
| + |
| +gfx::Vector2dF SynchronousCompositorImpl::GetTotalScrollOffset() { |
| + DCHECK(CalledOnValidThread()); |
| + if (compositor_client_) |
| + return compositor_client_->GetTotalRootLayerScrollOffset(); |
| + else |
| + return gfx::Vector2dF(); |
|
joth
2013/06/06 20:19:32
use { } (or nix the else caluse)
mkosiba (inactive)
2013/06/07 16:18:27
Done.
|
| +} |
| + |
| // Not using base::NonThreadSafe as we want to enforce a more exacting threading |
| // requirement: SynchronousCompositorImpl() must only be used on the UI thread. |
| bool SynchronousCompositorImpl::CalledOnValidThread() const { |