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 4b70c9b455256ea72c1591beb3dc358d60782cc5..3decfef28ae77f9c0c62edcf997646123f2a483a 100644 |
--- a/content/browser/android/in_process/synchronous_compositor_impl.cc |
+++ b/content/browser/android/in_process/synchronous_compositor_impl.cc |
@@ -6,11 +6,14 @@ |
#include "base/lazy_instance.h" |
#include "base/message_loop.h" |
+#include "cc/input/layer_scroll_offset_delegate.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 { |
@@ -31,7 +34,7 @@ int GetInProcessRendererId() { |
return id; |
} |
-class SynchronousCompositorFactoryImpl : public SynchronousCompositorFactory { |
+class SynchronousCompositorFactoryImpl: public SynchronousCompositorFactory { |
joth
2013/06/01 02:11:35
undo edit
mkosiba (inactive)
2013/06/06 17:55:10
why? was the space in front of the colon intention
joth
2013/06/06 20:19:32
Of course! We always have a space either side of t
|
public: |
SynchronousCompositorFactoryImpl() { |
SynchronousCompositorFactory::SetInstance(this); |
@@ -75,6 +78,10 @@ SynchronousCompositorImpl::SynchronousCompositorImpl(WebContents* contents) |
: compositor_client_(NULL), |
output_surface_(NULL), |
contents_(contents) { |
+ DCHECK(RenderThread::Get()->GetMessageLoop() == base::MessageLoop::current()); |
joth
2013/06/01 02:11:35
I can't work out why this would be. There's only o
mkosiba (inactive)
2013/06/06 17:55:10
I think you misunderstood me about which main thre
joth
2013/06/06 20:19:32
Opps! sorry for confusion.
(I've learnt the new me
|
+ |
+ input_handler_manager_ = RenderThreadImpl::current()->input_handler_manager(); |
+ // TODO(mkosiba): DCHECK(input_handler_manager_); after Jared's patches land. |
} |
SynchronousCompositorImpl::~SynchronousCompositorImpl() { |
@@ -118,11 +125,18 @@ void SynchronousCompositorImpl::DidBindOutputSurface( |
output_surface_ = output_surface; |
if (compositor_client_) |
compositor_client_->DidInitializeCompositor(this); |
+ |
+ if (input_handler_manager_) |
+ input_handler_manager_->SetRootLayerScrollDelegate(routing_id_, this); |
} |
void SynchronousCompositorImpl::DidDestroySynchronousOutputSurface( |
SynchronousCompositorOutputSurface* output_surface) { |
DCHECK(CalledOnValidThread()); |
+ |
+ if (input_handler_manager_) |
+ input_handler_manager_->SetRootLayerScrollDelegate(routing_id_, NULL); |
+ |
// Allow for transient hand-over when two output surfaces may refer to |
// a single delegate. |
if (output_surface_ == output_surface) { |
@@ -139,6 +153,20 @@ void SynchronousCompositorImpl::SetContinuousInvalidate(bool enable) { |
compositor_client_->SetContinuousInvalidate(enable); |
} |
+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(); |
+} |
+ |
// 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 { |