OLD | NEW |
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 11 matching lines...) Expand all Loading... |
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/compositor_util.h" | 25 #include "content/browser/gpu/compositor_util.h" |
26 #include "content/browser/gpu/gpu_process_host.h" | 26 #include "content/browser/gpu/gpu_process_host.h" |
27 #include "content/browser/gpu/gpu_process_host_ui_shim.h" | 27 #include "content/browser/gpu/gpu_process_host_ui_shim.h" |
28 #include "content/browser/gpu/gpu_surface_tracker.h" | 28 #include "content/browser/gpu/gpu_surface_tracker.h" |
29 #include "content/browser/renderer_host/backing_store.h" | 29 #include "content/browser/renderer_host/backing_store.h" |
30 #include "content/browser/renderer_host/backing_store_manager.h" | 30 #include "content/browser/renderer_host/backing_store_manager.h" |
31 #include "content/browser/renderer_host/dip_util.h" | 31 #include "content/browser/renderer_host/dip_util.h" |
32 #include "content/browser/renderer_host/input/buffered_input_router.h" | |
33 #include "content/browser/renderer_host/input/immediate_input_router.h" | 32 #include "content/browser/renderer_host/input/immediate_input_router.h" |
34 #include "content/browser/renderer_host/overscroll_controller.h" | 33 #include "content/browser/renderer_host/overscroll_controller.h" |
35 #include "content/browser/renderer_host/render_process_host_impl.h" | 34 #include "content/browser/renderer_host/render_process_host_impl.h" |
36 #include "content/browser/renderer_host/render_view_host_impl.h" | 35 #include "content/browser/renderer_host/render_view_host_impl.h" |
37 #include "content/browser/renderer_host/render_widget_helper.h" | 36 #include "content/browser/renderer_host/render_widget_helper.h" |
38 #include "content/browser/renderer_host/render_widget_host_delegate.h" | 37 #include "content/browser/renderer_host/render_widget_host_delegate.h" |
39 #include "content/common/accessibility_messages.h" | 38 #include "content/common/accessibility_messages.h" |
40 #include "content/common/content_constants_internal.h" | 39 #include "content/common/content_constants_internal.h" |
41 #include "content/common/gpu/gpu_messages.h" | 40 #include "content/common/gpu/gpu_messages.h" |
42 #include "content/common/input_messages.h" | 41 #include "content/common/input_messages.h" |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 // Otherwise we'll notify the process host when we are first shown. | 218 // Otherwise we'll notify the process host when we are first shown. |
220 if (!hidden) | 219 if (!hidden) |
221 process_->WidgetRestored(); | 220 process_->WidgetRestored(); |
222 | 221 |
223 accessibility_mode_ = | 222 accessibility_mode_ = |
224 BrowserAccessibilityStateImpl::GetInstance()->accessibility_mode(); | 223 BrowserAccessibilityStateImpl::GetInstance()->accessibility_mode(); |
225 | 224 |
226 for (size_t i = 0; i < g_created_callbacks.Get().size(); i++) | 225 for (size_t i = 0; i < g_created_callbacks.Get().size(); i++) |
227 g_created_callbacks.Get().at(i).Run(this); | 226 g_created_callbacks.Get().at(i).Run(this); |
228 | 227 |
229 input_router_ = CreateInputRouter(); | 228 input_router_.reset( |
| 229 new ImmediateInputRouter(process_, this, this, routing_id_)); |
230 | 230 |
231 #if defined(USE_AURA) | 231 #if defined(USE_AURA) |
232 bool overscroll_enabled = CommandLine::ForCurrentProcess()-> | 232 bool overscroll_enabled = CommandLine::ForCurrentProcess()-> |
233 GetSwitchValueASCII(switches::kOverscrollHistoryNavigation) != "0"; | 233 GetSwitchValueASCII(switches::kOverscrollHistoryNavigation) != "0"; |
234 SetOverscrollControllerEnabled(overscroll_enabled); | 234 SetOverscrollControllerEnabled(overscroll_enabled); |
235 #endif | 235 #endif |
236 } | 236 } |
237 | 237 |
238 RenderWidgetHostImpl::~RenderWidgetHostImpl() { | 238 RenderWidgetHostImpl::~RenderWidgetHostImpl() { |
239 SetView(NULL); | 239 SetView(NULL); |
(...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1273 | 1273 |
1274 void RenderWidgetHostImpl::RendererExited(base::TerminationStatus status, | 1274 void RenderWidgetHostImpl::RendererExited(base::TerminationStatus status, |
1275 int exit_code) { | 1275 int exit_code) { |
1276 // 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 |
1277 // from a crashed renderer. | 1277 // from a crashed renderer. |
1278 renderer_initialized_ = false; | 1278 renderer_initialized_ = false; |
1279 | 1279 |
1280 waiting_for_screen_rects_ack_ = false; | 1280 waiting_for_screen_rects_ack_ = false; |
1281 | 1281 |
1282 // Reset to ensure that input routing works with a new renderer. | 1282 // Reset to ensure that input routing works with a new renderer. |
1283 input_router_ = CreateInputRouter(); | 1283 input_router_.reset( |
| 1284 new ImmediateInputRouter(process_, this, this, routing_id_)); |
1284 | 1285 |
1285 if (overscroll_controller_) | 1286 if (overscroll_controller_) |
1286 overscroll_controller_->Reset(); | 1287 overscroll_controller_->Reset(); |
1287 | 1288 |
1288 // Must reset these to ensure that keyboard events work with a new renderer. | 1289 // Must reset these to ensure that keyboard events work with a new renderer. |
1289 suppress_next_char_events_ = false; | 1290 suppress_next_char_events_ = false; |
1290 | 1291 |
1291 // Reset some fields in preparation for recovering from a crash. | 1292 // Reset some fields in preparation for recovering from a crash. |
1292 ResetSizeAndRepaintPendingFlags(); | 1293 ResetSizeAndRepaintPendingFlags(); |
1293 current_size_.SetSize(0, 0); | 1294 current_size_.SetSize(0, 0); |
(...skipping 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2463 // Clear the new_auto_size_ since the empty value is used as a flag to | 2464 // Clear the new_auto_size_ since the empty value is used as a flag to |
2464 // indicate that no callback is in progress (i.e. without this line | 2465 // indicate that no callback is in progress (i.e. without this line |
2465 // DelayedAutoResized will not get called again). | 2466 // DelayedAutoResized will not get called again). |
2466 new_auto_size_.SetSize(0, 0); | 2467 new_auto_size_.SetSize(0, 0); |
2467 if (!should_auto_resize_) | 2468 if (!should_auto_resize_) |
2468 return; | 2469 return; |
2469 | 2470 |
2470 OnRenderAutoResized(new_size); | 2471 OnRenderAutoResized(new_size); |
2471 } | 2472 } |
2472 | 2473 |
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 | |
2484 void RenderWidgetHostImpl::DetachDelegate() { | 2474 void RenderWidgetHostImpl::DetachDelegate() { |
2485 delegate_ = NULL; | 2475 delegate_ = NULL; |
2486 } | 2476 } |
2487 | 2477 |
2488 void RenderWidgetHostImpl::ComputeTouchLatency( | 2478 void RenderWidgetHostImpl::ComputeTouchLatency( |
2489 const ui::LatencyInfo& latency_info) { | 2479 const ui::LatencyInfo& latency_info) { |
2490 ui::LatencyInfo::LatencyComponent ui_component; | 2480 ui::LatencyInfo::LatencyComponent ui_component; |
2491 ui::LatencyInfo::LatencyComponent rwh_component; | 2481 ui::LatencyInfo::LatencyComponent rwh_component; |
2492 ui::LatencyInfo::LatencyComponent acked_component; | 2482 ui::LatencyInfo::LatencyComponent acked_component; |
2493 | 2483 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2593 int process_id = (b->first.second >> 32) & 0xffffffff; | 2583 int process_id = (b->first.second >> 32) & 0xffffffff; |
2594 RenderWidgetHost* rwh = | 2584 RenderWidgetHost* rwh = |
2595 RenderWidgetHost::FromID(process_id, routing_id); | 2585 RenderWidgetHost::FromID(process_id, routing_id); |
2596 if (!rwh) | 2586 if (!rwh) |
2597 continue; | 2587 continue; |
2598 RenderWidgetHostImpl::From(rwh)->FrameSwapped(latency_info); | 2588 RenderWidgetHostImpl::From(rwh)->FrameSwapped(latency_info); |
2599 } | 2589 } |
2600 } | 2590 } |
2601 | 2591 |
2602 } // namespace content | 2592 } // namespace content |
OLD | NEW |