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

Side by Side Diff: content/browser/renderer_host/render_widget_host_impl.cc

Issue 20356003: Provided batched input delivery with a BufferedInputRouter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review Created 7 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/render_widget_host_impl.h" 5 #include "content/browser/renderer_host/render_widget_host_impl.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 10 matching lines...) Expand all
21 #include "base/strings/utf_string_conversions.h" 21 #include "base/strings/utf_string_conversions.h"
22 #include "cc/output/compositor_frame.h" 22 #include "cc/output/compositor_frame.h"
23 #include "cc/output/compositor_frame_ack.h" 23 #include "cc/output/compositor_frame_ack.h"
24 #include "content/browser/accessibility/browser_accessibility_state_impl.h" 24 #include "content/browser/accessibility/browser_accessibility_state_impl.h"
25 #include "content/browser/gpu/gpu_process_host.h" 25 #include "content/browser/gpu/gpu_process_host.h"
26 #include "content/browser/gpu/gpu_process_host_ui_shim.h" 26 #include "content/browser/gpu/gpu_process_host_ui_shim.h"
27 #include "content/browser/gpu/gpu_surface_tracker.h" 27 #include "content/browser/gpu/gpu_surface_tracker.h"
28 #include "content/browser/renderer_host/backing_store.h" 28 #include "content/browser/renderer_host/backing_store.h"
29 #include "content/browser/renderer_host/backing_store_manager.h" 29 #include "content/browser/renderer_host/backing_store_manager.h"
30 #include "content/browser/renderer_host/dip_util.h" 30 #include "content/browser/renderer_host/dip_util.h"
31 #include "content/browser/renderer_host/input/buffered_input_router.h"
31 #include "content/browser/renderer_host/input/immediate_input_router.h" 32 #include "content/browser/renderer_host/input/immediate_input_router.h"
32 #include "content/browser/renderer_host/overscroll_controller.h" 33 #include "content/browser/renderer_host/overscroll_controller.h"
33 #include "content/browser/renderer_host/render_process_host_impl.h" 34 #include "content/browser/renderer_host/render_process_host_impl.h"
34 #include "content/browser/renderer_host/render_view_host_impl.h" 35 #include "content/browser/renderer_host/render_view_host_impl.h"
35 #include "content/browser/renderer_host/render_widget_helper.h" 36 #include "content/browser/renderer_host/render_widget_helper.h"
36 #include "content/browser/renderer_host/render_widget_host_delegate.h" 37 #include "content/browser/renderer_host/render_widget_host_delegate.h"
37 #include "content/common/accessibility_messages.h" 38 #include "content/common/accessibility_messages.h"
38 #include "content/common/content_constants_internal.h" 39 #include "content/common/content_constants_internal.h"
39 #include "content/common/gpu/gpu_messages.h" 40 #include "content/common/gpu/gpu_messages.h"
40 #include "content/common/input_messages.h" 41 #include "content/common/input_messages.h"
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 // Because the widget initializes as is_hidden_ == false, 179 // Because the widget initializes as is_hidden_ == false,
179 // tell the process host that we're alive. 180 // tell the process host that we're alive.
180 process_->WidgetRestored(); 181 process_->WidgetRestored();
181 182
182 accessibility_mode_ = 183 accessibility_mode_ =
183 BrowserAccessibilityStateImpl::GetInstance()->accessibility_mode(); 184 BrowserAccessibilityStateImpl::GetInstance()->accessibility_mode();
184 185
185 for (size_t i = 0; i < g_created_callbacks.Get().size(); i++) 186 for (size_t i = 0; i < g_created_callbacks.Get().size(); i++)
186 g_created_callbacks.Get().at(i).Run(this); 187 g_created_callbacks.Get().at(i).Run(this);
187 188
188 input_router_.reset(new ImmediateInputRouter(process, this, routing_id_)); 189 input_router_.reset(
190 new ImmediateInputRouter(process, this, this, routing_id_));
189 191
190 #if defined(USE_AURA) 192 #if defined(USE_AURA)
191 bool overscroll_enabled = CommandLine::ForCurrentProcess()-> 193 bool overscroll_enabled = CommandLine::ForCurrentProcess()->
192 GetSwitchValueASCII(switches::kOverscrollHistoryNavigation) != "0"; 194 GetSwitchValueASCII(switches::kOverscrollHistoryNavigation) != "0";
193 SetOverscrollControllerEnabled(overscroll_enabled); 195 SetOverscrollControllerEnabled(overscroll_enabled);
194 #endif 196 #endif
195 } 197 }
196 198
197 RenderWidgetHostImpl::~RenderWidgetHostImpl() { 199 RenderWidgetHostImpl::~RenderWidgetHostImpl() {
198 SetView(NULL); 200 SetView(NULL);
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 if (!msg_is_ok) { 468 if (!msg_is_ok) {
467 // The message de-serialization failed. Kill the renderer process. 469 // The message de-serialization failed. Kill the renderer process.
468 RecordAction(UserMetricsAction("BadMessageTerminate_RWH")); 470 RecordAction(UserMetricsAction("BadMessageTerminate_RWH"));
469 GetProcess()->ReceivedBadMessage(); 471 GetProcess()->ReceivedBadMessage();
470 } 472 }
471 return handled; 473 return handled;
472 } 474 }
473 475
474 bool RenderWidgetHostImpl::Send(IPC::Message* msg) { 476 bool RenderWidgetHostImpl::Send(IPC::Message* msg) {
475 if (IPC_MESSAGE_ID_CLASS(msg->type()) == InputMsgStart) 477 if (IPC_MESSAGE_ID_CLASS(msg->type()) == InputMsgStart)
476 return input_router_->SendInput(msg); 478 return input_router_->SendInput(make_scoped_ptr(msg));
477 479
478 return process_->Send(msg); 480 return process_->Send(msg);
479 } 481 }
480 482
481 void RenderWidgetHostImpl::WasHidden() { 483 void RenderWidgetHostImpl::WasHidden() {
482 is_hidden_ = true; 484 is_hidden_ = true;
483 485
484 // Don't bother reporting hung state when we aren't active. 486 // Don't bother reporting hung state when we aren't active.
485 StopHangMonitorTimeout(); 487 StopHangMonitorTimeout();
486 488
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after
1193 1195
1194 void RenderWidgetHostImpl::RendererExited(base::TerminationStatus status, 1196 void RenderWidgetHostImpl::RendererExited(base::TerminationStatus status,
1195 int exit_code) { 1197 int exit_code) {
1196 // Clearing this flag causes us to re-create the renderer when recovering 1198 // Clearing this flag causes us to re-create the renderer when recovering
1197 // from a crashed renderer. 1199 // from a crashed renderer.
1198 renderer_initialized_ = false; 1200 renderer_initialized_ = false;
1199 1201
1200 waiting_for_screen_rects_ack_ = false; 1202 waiting_for_screen_rects_ack_ = false;
1201 1203
1202 // Reset to ensure that input routing works with a new renderer. 1204 // Reset to ensure that input routing works with a new renderer.
1203 input_router_.reset(new ImmediateInputRouter(process_, this, routing_id_)); 1205 input_router_.reset(
1206 new ImmediateInputRouter(process_, this, this, routing_id_));
1204 1207
1205 if (overscroll_controller_) 1208 if (overscroll_controller_)
1206 overscroll_controller_->Reset(); 1209 overscroll_controller_->Reset();
1207 1210
1208 // Must reset these to ensure that keyboard events work with a new renderer. 1211 // Must reset these to ensure that keyboard events work with a new renderer.
1209 suppress_next_char_events_ = false; 1212 suppress_next_char_events_ = false;
1210 1213
1211 // Reset some fields in preparation for recovering from a crash. 1214 // Reset some fields in preparation for recovering from a crash.
1212 ResetSizeAndRepaintPendingFlags(); 1215 ResetSizeAndRepaintPendingFlags();
1213 current_size_.SetSize(0, 0); 1216 current_size_.SetSize(0, 0);
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after
2060 } 2063 }
2061 2064
2062 bool RenderWidgetHostImpl::OnSendGestureEventImmediately( 2065 bool RenderWidgetHostImpl::OnSendGestureEventImmediately(
2063 const GestureEventWithLatencyInfo& gesture_event) { 2066 const GestureEventWithLatencyInfo& gesture_event) {
2064 TRACE_EVENT_INSTANT0("input", 2067 TRACE_EVENT_INSTANT0("input",
2065 "RenderWidgetHostImpl::OnSendGestureEventImmediately", 2068 "RenderWidgetHostImpl::OnSendGestureEventImmediately",
2066 TRACE_EVENT_SCOPE_THREAD); 2069 TRACE_EVENT_SCOPE_THREAD);
2067 return !IgnoreInputEvents(); 2070 return !IgnoreInputEvents();
2068 } 2071 }
2069 2072
2073 void RenderWidgetHostImpl::SetNeedsFlush() {
2074 }
2075
2076 void RenderWidgetHostImpl::DidFlush() {
2077 }
2078
2070 void RenderWidgetHostImpl::OnKeyboardEventAck( 2079 void RenderWidgetHostImpl::OnKeyboardEventAck(
2071 const NativeWebKeyboardEvent& event, 2080 const NativeWebKeyboardEvent& event,
2072 InputEventAckState ack_result) { 2081 InputEventAckState ack_result) {
2073 #if defined(OS_MACOSX) 2082 #if defined(OS_MACOSX)
2074 if (!is_hidden() && view_ && view_->PostProcessEventForPluginIme(event)) 2083 if (!is_hidden() && view_ && view_->PostProcessEventForPluginIme(event))
2075 return; 2084 return;
2076 #endif 2085 #endif
2077 2086
2078 // We only send unprocessed key event upwards if we are not hidden, 2087 // We only send unprocessed key event upwards if we are not hidden,
2079 // because the user has moved away from us and no longer expect any effect 2088 // because the user has moved away from us and no longer expect any effect
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
2476 int process_id = (b->first.second >> 32) & 0xffffffff; 2485 int process_id = (b->first.second >> 32) & 0xffffffff;
2477 RenderWidgetHost* rwh = 2486 RenderWidgetHost* rwh =
2478 RenderWidgetHost::FromID(process_id, routing_id); 2487 RenderWidgetHost::FromID(process_id, routing_id);
2479 if (!rwh) 2488 if (!rwh)
2480 continue; 2489 continue;
2481 RenderWidgetHostImpl::From(rwh)->FrameSwapped(latency_info); 2490 RenderWidgetHostImpl::From(rwh)->FrameSwapped(latency_info);
2482 } 2491 }
2483 } 2492 }
2484 2493
2485 } // namespace content 2494 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698