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

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: Compile fix 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 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 853 matching lines...) Expand 10 before | Expand all | Expand 10 after
2145 } 2147 }
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() {
brianderson 2013/09/13 21:49:27 I see that this function existed before, but was e
jdduke (slow) 2013/09/16 15:16:04 Nobody, currently; this was added in the patch tha
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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
2448 // Clear the new_auto_size_ since the empty value is used as a flag to 2454 // Clear the new_auto_size_ since the empty value is used as a flag to
2449 // indicate that no callback is in progress (i.e. without this line 2455 // indicate that no callback is in progress (i.e. without this line
2450 // DelayedAutoResized will not get called again). 2456 // DelayedAutoResized will not get called again).
2451 new_auto_size_.SetSize(0, 0); 2457 new_auto_size_.SetSize(0, 0);
2452 if (!should_auto_resize_) 2458 if (!should_auto_resize_)
2453 return; 2459 return;
2454 2460
2455 OnRenderAutoResized(new_size); 2461 OnRenderAutoResized(new_size);
2456 } 2462 }
2457 2463
2464 scoped_ptr<InputRouter> RenderWidgetHostImpl::CreateInputRouter() {
2465 if (CommandLine::ForCurrentProcess()->HasSwitch(
2466 switches::kEnableBufferedInputRouter)) {
2467 return scoped_ptr<InputRouter>(
2468 new BufferedInputRouter(process_, this, this, routing_id_));
2469 } else {
2470 return scoped_ptr<InputRouter>(
2471 new ImmediateInputRouter(process_, this, this, routing_id_));
2472 }
2473 }
2474
2458 void RenderWidgetHostImpl::DetachDelegate() { 2475 void RenderWidgetHostImpl::DetachDelegate() {
2459 delegate_ = NULL; 2476 delegate_ = NULL;
2460 } 2477 }
2461 2478
2462 void RenderWidgetHostImpl::ComputeTouchLatency( 2479 void RenderWidgetHostImpl::ComputeTouchLatency(
2463 const ui::LatencyInfo& latency_info) { 2480 const ui::LatencyInfo& latency_info) {
2464 ui::LatencyInfo::LatencyComponent ui_component; 2481 ui::LatencyInfo::LatencyComponent ui_component;
2465 ui::LatencyInfo::LatencyComponent rwh_component; 2482 ui::LatencyInfo::LatencyComponent rwh_component;
2466 ui::LatencyInfo::LatencyComponent acked_component; 2483 ui::LatencyInfo::LatencyComponent acked_component;
2467 2484
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
2567 int process_id = (b->first.second >> 32) & 0xffffffff; 2584 int process_id = (b->first.second >> 32) & 0xffffffff;
2568 RenderWidgetHost* rwh = 2585 RenderWidgetHost* rwh =
2569 RenderWidgetHost::FromID(process_id, routing_id); 2586 RenderWidgetHost::FromID(process_id, routing_id);
2570 if (!rwh) 2587 if (!rwh)
2571 continue; 2588 continue;
2572 RenderWidgetHostImpl::From(rwh)->FrameSwapped(latency_info); 2589 RenderWidgetHostImpl::From(rwh)->FrameSwapped(latency_info);
2573 } 2590 }
2574 } 2591 }
2575 2592
2576 } // namespace content 2593 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698