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

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

Issue 23983036: [Android] Provide synchronized input flush with BeginFrame (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 7 years, 2 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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 // Otherwise we'll notify the process host when we are first shown. 219 // Otherwise we'll notify the process host when we are first shown.
220 if (!hidden) 220 if (!hidden)
221 process_->WidgetRestored(); 221 process_->WidgetRestored();
222 222
223 accessibility_mode_ = 223 accessibility_mode_ =
224 BrowserAccessibilityStateImpl::GetInstance()->accessibility_mode(); 224 BrowserAccessibilityStateImpl::GetInstance()->accessibility_mode();
225 225
226 for (size_t i = 0; i < g_created_callbacks.Get().size(); i++) 226 for (size_t i = 0; i < g_created_callbacks.Get().size(); i++)
227 g_created_callbacks.Get().at(i).Run(this); 227 g_created_callbacks.Get().at(i).Run(this);
228 228
229 input_router_.reset( 229 input_router_ = CreateInputRouter();
230 new ImmediateInputRouter(process_, this, this, routing_id_));
231 230
232 #if defined(USE_AURA) 231 #if defined(USE_AURA)
233 bool overscroll_enabled = CommandLine::ForCurrentProcess()-> 232 bool overscroll_enabled = CommandLine::ForCurrentProcess()->
234 GetSwitchValueASCII(switches::kOverscrollHistoryNavigation) != "0"; 233 GetSwitchValueASCII(switches::kOverscrollHistoryNavigation) != "0";
235 SetOverscrollControllerEnabled(overscroll_enabled); 234 SetOverscrollControllerEnabled(overscroll_enabled);
236 #endif 235 #endif
237 } 236 }
238 237
239 RenderWidgetHostImpl::~RenderWidgetHostImpl() { 238 RenderWidgetHostImpl::~RenderWidgetHostImpl() {
240 SetView(NULL); 239 SetView(NULL);
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 if (!enabled) 411 if (!enabled)
413 overscroll_controller_.reset(); 412 overscroll_controller_.reset();
414 else if (!overscroll_controller_) 413 else if (!overscroll_controller_)
415 overscroll_controller_.reset(new OverscrollController(this)); 414 overscroll_controller_.reset(new OverscrollController(this));
416 } 415 }
417 416
418 void RenderWidgetHostImpl::SuppressNextCharEvents() { 417 void RenderWidgetHostImpl::SuppressNextCharEvents() {
419 suppress_next_char_events_ = true; 418 suppress_next_char_events_ = true;
420 } 419 }
421 420
421 void RenderWidgetHostImpl::FlushInput() {
422 input_router_->Flush();
423 }
424
422 void RenderWidgetHostImpl::Init() { 425 void RenderWidgetHostImpl::Init() {
423 DCHECK(process_->HasConnection()); 426 DCHECK(process_->HasConnection());
424 427
425 renderer_initialized_ = true; 428 renderer_initialized_ = true;
426 429
427 GpuSurfaceTracker::Get()->SetSurfaceHandle( 430 GpuSurfaceTracker::Get()->SetSurfaceHandle(
428 surface_id_, GetCompositingSurface()); 431 surface_id_, GetCompositingSurface());
429 432
430 // Send the ack along with the information on placement. 433 // Send the ack along with the information on placement.
431 Send(new ViewMsg_CreatingNew_ACK(routing_id_)); 434 Send(new ViewMsg_CreatingNew_ACK(routing_id_));
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after
1270 1273
1271 void RenderWidgetHostImpl::RendererExited(base::TerminationStatus status, 1274 void RenderWidgetHostImpl::RendererExited(base::TerminationStatus status,
1272 int exit_code) { 1275 int exit_code) {
1273 // Clearing this flag causes us to re-create the renderer when recovering 1276 // Clearing this flag causes us to re-create the renderer when recovering
1274 // from a crashed renderer. 1277 // from a crashed renderer.
1275 renderer_initialized_ = false; 1278 renderer_initialized_ = false;
1276 1279
1277 waiting_for_screen_rects_ack_ = false; 1280 waiting_for_screen_rects_ack_ = false;
1278 1281
1279 // Reset to ensure that input routing works with a new renderer. 1282 // Reset to ensure that input routing works with a new renderer.
1280 input_router_.reset( 1283 input_router_ = CreateInputRouter();
1281 new ImmediateInputRouter(process_, this, this, routing_id_));
1282 1284
1283 if (overscroll_controller_) 1285 if (overscroll_controller_)
1284 overscroll_controller_->Reset(); 1286 overscroll_controller_->Reset();
1285 1287
1286 // Must reset these to ensure that keyboard events work with a new renderer. 1288 // Must reset these to ensure that keyboard events work with a new renderer.
1287 suppress_next_char_events_ = false; 1289 suppress_next_char_events_ = false;
1288 1290
1289 // Reset some fields in preparation for recovering from a crash. 1291 // Reset some fields in preparation for recovering from a crash.
1290 ResetSizeAndRepaintPendingFlags(); 1292 ResetSizeAndRepaintPendingFlags();
1291 current_size_.SetSize(0, 0); 1293 current_size_.SetSize(0, 0);
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after
2146 2148
2147 bool RenderWidgetHostImpl::OnSendGestureEventImmediately( 2149 bool RenderWidgetHostImpl::OnSendGestureEventImmediately(
2148 const GestureEventWithLatencyInfo& gesture_event) { 2150 const GestureEventWithLatencyInfo& gesture_event) {
2149 TRACE_EVENT_INSTANT0("input", 2151 TRACE_EVENT_INSTANT0("input",
2150 "RenderWidgetHostImpl::OnSendGestureEventImmediately", 2152 "RenderWidgetHostImpl::OnSendGestureEventImmediately",
2151 TRACE_EVENT_SCOPE_THREAD); 2153 TRACE_EVENT_SCOPE_THREAD);
2152 return !IgnoreInputEvents(); 2154 return !IgnoreInputEvents();
2153 } 2155 }
2154 2156
2155 void RenderWidgetHostImpl::SetNeedsFlush() { 2157 void RenderWidgetHostImpl::SetNeedsFlush() {
2158 if (view_)
2159 view_->OnSetNeedsFlushInput();
2156 } 2160 }
2157 2161
2158 void RenderWidgetHostImpl::DidFlush() { 2162 void RenderWidgetHostImpl::DidFlush() {
2163 if (view_)
2164 view_->OnDidFlushInput();
2159 } 2165 }
2160 2166
2161 void RenderWidgetHostImpl::OnKeyboardEventAck( 2167 void RenderWidgetHostImpl::OnKeyboardEventAck(
2162 const NativeWebKeyboardEvent& event, 2168 const NativeWebKeyboardEvent& event,
2163 InputEventAckState ack_result) { 2169 InputEventAckState ack_result) {
2164 #if defined(OS_MACOSX) 2170 #if defined(OS_MACOSX)
2165 if (!is_hidden() && view_ && view_->PostProcessEventForPluginIme(event)) 2171 if (!is_hidden() && view_ && view_->PostProcessEventForPluginIme(event))
2166 return; 2172 return;
2167 #endif 2173 #endif
2168 2174
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
2457 // Clear the new_auto_size_ since the empty value is used as a flag to 2463 // Clear the new_auto_size_ since the empty value is used as a flag to
2458 // indicate that no callback is in progress (i.e. without this line 2464 // indicate that no callback is in progress (i.e. without this line
2459 // DelayedAutoResized will not get called again). 2465 // DelayedAutoResized will not get called again).
2460 new_auto_size_.SetSize(0, 0); 2466 new_auto_size_.SetSize(0, 0);
2461 if (!should_auto_resize_) 2467 if (!should_auto_resize_)
2462 return; 2468 return;
2463 2469
2464 OnRenderAutoResized(new_size); 2470 OnRenderAutoResized(new_size);
2465 } 2471 }
2466 2472
2473 scoped_ptr<InputRouter> RenderWidgetHostImpl::CreateInputRouter() {
2474 if (CommandLine::ForCurrentProcess()->HasSwitch(
2475 switches::kEnableBufferedInputRouter)) {
2476 return scoped_ptr<InputRouter>(
2477 new BufferedInputRouter(process_, this, this, routing_id_));
2478 } else {
2479 return scoped_ptr<InputRouter>(
2480 new ImmediateInputRouter(process_, this, this, routing_id_));
2481 }
2482 }
2483
2467 void RenderWidgetHostImpl::DetachDelegate() { 2484 void RenderWidgetHostImpl::DetachDelegate() {
2468 delegate_ = NULL; 2485 delegate_ = NULL;
2469 } 2486 }
2470 2487
2471 void RenderWidgetHostImpl::ComputeTouchLatency( 2488 void RenderWidgetHostImpl::ComputeTouchLatency(
2472 const ui::LatencyInfo& latency_info) { 2489 const ui::LatencyInfo& latency_info) {
2473 ui::LatencyInfo::LatencyComponent ui_component; 2490 ui::LatencyInfo::LatencyComponent ui_component;
2474 ui::LatencyInfo::LatencyComponent rwh_component; 2491 ui::LatencyInfo::LatencyComponent rwh_component;
2475 ui::LatencyInfo::LatencyComponent acked_component; 2492 ui::LatencyInfo::LatencyComponent acked_component;
2476 2493
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
2576 int process_id = (b->first.second >> 32) & 0xffffffff; 2593 int process_id = (b->first.second >> 32) & 0xffffffff;
2577 RenderWidgetHost* rwh = 2594 RenderWidgetHost* rwh =
2578 RenderWidgetHost::FromID(process_id, routing_id); 2595 RenderWidgetHost::FromID(process_id, routing_id);
2579 if (!rwh) 2596 if (!rwh)
2580 continue; 2597 continue;
2581 RenderWidgetHostImpl::From(rwh)->FrameSwapped(latency_info); 2598 RenderWidgetHostImpl::From(rwh)->FrameSwapped(latency_info);
2582 } 2599 }
2583 } 2600 }
2584 2601
2585 } // namespace content 2602 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698