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

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

Issue 15002007: Delegate root layer scroll offset to android_webview. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix unittest compile Created 7 years, 6 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 425788b99bffc26cf810eb18f40be38a4a1d1367..594906b951a0cdf7e19cd73e41d4f39f7d7c77bf 100644
--- a/content/browser/android/in_process/synchronous_compositor_impl.cc
+++ b/content/browser/android/in_process/synchronous_compositor_impl.cc
@@ -6,6 +6,8 @@
#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"
@@ -111,7 +113,8 @@ SynchronousCompositorImpl* SynchronousCompositorImpl::FromRoutingID(
SynchronousCompositorImpl::SynchronousCompositorImpl(WebContents* contents)
: compositor_client_(NULL),
output_surface_(NULL),
- contents_(contents) {
+ contents_(contents),
+ input_handler_(NULL) {
DCHECK(contents);
}
@@ -149,6 +152,11 @@ bool SynchronousCompositorImpl::DemandDrawSw(SkCanvas* canvas) {
return output_surface_->DemandDrawSw(canvas);
}
+void SynchronousCompositorImpl::DidChangeRootLayerScrollOffset() {
+ if (input_handler_)
+ input_handler_->OnRootLayerDelegatedScrollOffsetChanged();
+}
+
void SynchronousCompositorImpl::DidBindOutputSurface(
SynchronousCompositorOutputSurface* output_surface) {
DCHECK(CalledOnValidThread());
@@ -160,6 +168,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) {
@@ -170,6 +179,19 @@ void SynchronousCompositorImpl::DidDestroySynchronousOutputSurface(
}
}
+void SynchronousCompositorImpl::SetInputHandler(
+ cc::InputHandler* input_handler) {
+ DCHECK(CalledOnValidThread());
+
+ if (input_handler_)
+ input_handler_->SetRootLayerScrollOffsetDelegate(NULL);
+
+ input_handler_ = input_handler;
+
+ if (input_handler_)
+ input_handler_->SetRootLayerScrollOffsetDelegate(this);
+}
+
void SynchronousCompositorImpl::SetContinuousInvalidate(bool enable) {
DCHECK(CalledOnValidThread());
if (compositor_client_)
@@ -183,6 +205,19 @@ InputEventAckState SynchronousCompositorImpl::HandleInputEvent(
contents_->GetRoutingID(), 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();
+ 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 {

Powered by Google App Engine
This is Rietveld 408576698