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

Unified Diff: content/browser/renderer_host/render_widget_host_impl.cc

Issue 19220002: [WIP] BufferedInputRouter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix client assignment Created 7 years, 3 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/renderer_host/render_widget_host_impl.cc
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc
index a3c9a01ca84a525c587ee4a36cc119c102ab4e9f..2593ce52316fcd9f8487e653257f13849aa854bf 100644
--- a/content/browser/renderer_host/render_widget_host_impl.cc
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -29,6 +29,7 @@
#include "content/browser/renderer_host/backing_store.h"
#include "content/browser/renderer_host/backing_store_manager.h"
#include "content/browser/renderer_host/dip_util.h"
+#include "content/browser/renderer_host/input/buffered_input_router.h"
#include "content/browser/renderer_host/input/immediate_input_router.h"
#include "content/browser/renderer_host/overscroll_controller.h"
#include "content/browser/renderer_host/render_process_host_impl.h"
@@ -189,7 +190,7 @@ RenderWidgetHostImpl::RenderWidgetHostImpl(RenderWidgetHostDelegate* delegate,
for (size_t i = 0; i < g_created_callbacks.Get().size(); i++)
g_created_callbacks.Get().at(i).Run(this);
- input_router_.reset(new ImmediateInputRouter(process, this, routing_id_));
+ input_router_ = CreateInputRouter();
#if defined(USE_AURA)
bool overscroll_enabled = CommandLine::ForCurrentProcess()->
@@ -378,6 +379,10 @@ void RenderWidgetHostImpl::SuppressNextCharEvents() {
suppress_next_char_events_ = true;
}
+void RenderWidgetHostImpl::FlushInput() {
+ input_router_->Flush();
+}
+
void RenderWidgetHostImpl::Init() {
DCHECK(process_->HasConnection());
@@ -478,7 +483,7 @@ bool RenderWidgetHostImpl::OnMessageReceived(const IPC::Message &msg) {
bool RenderWidgetHostImpl::Send(IPC::Message* msg) {
if (IPC_MESSAGE_ID_CLASS(msg->type()) == InputMsgStart)
- return input_router_->SendInput(msg);
+ return input_router_->SendInput(make_scoped_ptr(msg));
return process_->Send(msg);
}
@@ -1235,7 +1240,7 @@ void RenderWidgetHostImpl::RendererExited(base::TerminationStatus status,
waiting_for_screen_rects_ack_ = false;
// Reset to ensure that input routing works with a new renderer.
- input_router_.reset(new ImmediateInputRouter(process_, this, routing_id_));
+ input_router_ = CreateInputRouter();
if (overscroll_controller_)
overscroll_controller_->Reset();
@@ -2102,6 +2107,16 @@ bool RenderWidgetHostImpl::OnSendGestureEventImmediately(
return !IgnoreInputEvents();
}
+void RenderWidgetHostImpl::SetNeedsFlush() {
+ if (view_)
+ view_->OnSetNeedsFlushInput();
+}
+
+void RenderWidgetHostImpl::DidFlush() {
+ if (view_)
+ view_->OnDidFlushInput();
+}
+
void RenderWidgetHostImpl::OnKeyboardEventAck(
const NativeWebKeyboardEvent& event,
InputEventAckState ack_result) {
@@ -2399,6 +2414,17 @@ void RenderWidgetHostImpl::DelayedAutoResized() {
OnRenderAutoResized(new_size);
}
+scoped_ptr<InputRouter> RenderWidgetHostImpl::CreateInputRouter() {
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableBufferedInputRouter)) {
+ return scoped_ptr<InputRouter>(
+ new BufferedInputRouter(process_, this, this, routing_id_));
+ } else {
+ return scoped_ptr<InputRouter>(
+ new ImmediateInputRouter(process_, this, this, routing_id_));
+ }
+}
+
void RenderWidgetHostImpl::DetachDelegate() {
delegate_ = NULL;
}
« no previous file with comments | « content/browser/renderer_host/render_widget_host_impl.h ('k') | content/browser/renderer_host/render_widget_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698