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

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

Issue 15920002: Fix WebView compositor input handling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Avoid DCHECKs when retrieving process ID 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 4b70c9b455256ea72c1591beb3dc358d60782cc5..ea72bc79bc179123c272a454bf0dfe2524c4ed52 100644
--- a/content/browser/android/in_process/synchronous_compositor_impl.cc
+++ b/content/browser/android/in_process/synchronous_compositor_impl.cc
@@ -6,6 +6,7 @@
#include "base/lazy_instance.h"
#include "base/message_loop.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"
@@ -49,6 +50,17 @@ class SynchronousCompositorFactoryImpl : public SynchronousCompositorFactory {
new SynchronousCompositorOutputSurface(routing_id));
return output_surface.PassAs<cc::OutputSurface>();
}
+
+ virtual InputHandlerManagerClient* GetInputHandlerManagerClient() OVERRIDE {
+ return synchronous_input_event_filter();
+ }
+
+ SynchronousInputEventFilter* synchronous_input_event_filter() {
+ return &synchronous_input_event_filter_;
+ }
+
+ private:
+ SynchronousInputEventFilter synchronous_input_event_filter_;
};
base::LazyInstance<SynchronousCompositorFactoryImpl>::Leaky g_factory =
@@ -59,10 +71,11 @@ base::LazyInstance<SynchronousCompositorFactoryImpl>::Leaky g_factory =
DEFINE_WEB_CONTENTS_USER_DATA_KEY(SynchronousCompositorImpl);
// static
-SynchronousCompositorImpl* SynchronousCompositorImpl::FromRoutingID(
- int routing_id) {
- RenderViewHost* rvh = RenderViewHost::FromID(GetInProcessRendererId(),
- routing_id);
+SynchronousCompositorImpl* SynchronousCompositorImpl::FromID(int process_id,
+ int routing_id) {
+ if (g_factory == NULL)
+ return NULL;
+ RenderViewHost* rvh = RenderViewHost::FromID(process_id, routing_id);
if (!rvh)
return NULL;
WebContents* contents = WebContents::FromRenderViewHost(rvh);
@@ -71,6 +84,11 @@ SynchronousCompositorImpl* SynchronousCompositorImpl::FromRoutingID(
return FromWebContents(contents);
}
+SynchronousCompositorImpl* SynchronousCompositorImpl::FromRoutingID(
+ int routing_id) {
+ return FromID(GetInProcessRendererId(), routing_id);
+}
+
SynchronousCompositorImpl::SynchronousCompositorImpl(WebContents* contents)
: compositor_client_(NULL),
output_surface_(NULL),
@@ -139,6 +157,13 @@ void SynchronousCompositorImpl::SetContinuousInvalidate(bool enable) {
compositor_client_->SetContinuousInvalidate(enable);
}
+InputEventAckState SynchronousCompositorImpl::HandleInputEvent(
+ const WebKit::WebInputEvent& input_event) {
+ DCHECK(CalledOnValidThread());
+ return g_factory.Get().synchronous_input_event_filter()->HandleInputEvent(
+ routing_id_, input_event);
+}
+
// 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