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 <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 1176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1187 } | 1187 } |
1188 | 1188 |
1189 void RenderWidgetHostImpl::RendererExited(base::TerminationStatus status, | 1189 void RenderWidgetHostImpl::RendererExited(base::TerminationStatus status, |
1190 int exit_code) { | 1190 int exit_code) { |
1191 // Clearing this flag causes us to re-create the renderer when recovering | 1191 // Clearing this flag causes us to re-create the renderer when recovering |
1192 // from a crashed renderer. | 1192 // from a crashed renderer. |
1193 renderer_initialized_ = false; | 1193 renderer_initialized_ = false; |
1194 | 1194 |
1195 waiting_for_screen_rects_ack_ = false; | 1195 waiting_for_screen_rects_ack_ = false; |
1196 | 1196 |
1197 // Reset to ensure that input routing works with a new renderer. | |
1198 input_router_.reset(new InputRouterImpl( | |
1199 process_, this, this, routing_id_, GetInputRouterConfigForPlatform())); | |
1200 | |
1201 // Must reset these to ensure that keyboard events work with a new renderer. | 1197 // Must reset these to ensure that keyboard events work with a new renderer. |
1202 suppress_next_char_events_ = false; | 1198 suppress_next_char_events_ = false; |
1203 | 1199 |
1204 // Reset some fields in preparation for recovering from a crash. | 1200 // Reset some fields in preparation for recovering from a crash. |
1205 ResetSizeAndRepaintPendingFlags(); | 1201 ResetSizeAndRepaintPendingFlags(); |
1206 current_size_.SetSize(0, 0); | 1202 current_size_.SetSize(0, 0); |
1207 is_hidden_ = false; | 1203 is_hidden_ = false; |
1208 | 1204 |
1209 // Reset this to ensure the hung renderer mechanism is working properly. | 1205 // Reset this to ensure the hung renderer mechanism is working properly. |
1210 in_flight_event_count_ = 0; | 1206 in_flight_event_count_ = 0; |
1211 | 1207 |
1212 if (view_) { | 1208 if (view_) { |
1213 GpuSurfaceTracker::Get()->SetSurfaceHandle(surface_id_, | 1209 GpuSurfaceTracker::Get()->SetSurfaceHandle(surface_id_, |
1214 gfx::GLSurfaceHandle()); | 1210 gfx::GLSurfaceHandle()); |
1215 view_->RenderProcessGone(status, exit_code); | 1211 view_->RenderProcessGone(status, exit_code); |
1216 view_ = NULL; // The View should be deleted by RenderProcessGone. | 1212 view_ = NULL; // The View should be deleted by RenderProcessGone. |
1217 } | 1213 } |
1218 | 1214 |
| 1215 // Reconstruct the input router to ensure that it has fresh state for a new |
| 1216 // renderer. Otherwise it may be stuck waiting for the old renderer to ack an |
| 1217 // event. (In particular, the above call to view_->RenderProcessGone will |
| 1218 // destroy the aura window, which may dispatch a synthetic mouse move.) |
| 1219 input_router_.reset(new InputRouterImpl( |
| 1220 process_, this, this, routing_id_, GetInputRouterConfigForPlatform())); |
| 1221 |
1219 synthetic_gesture_controller_.reset(); | 1222 synthetic_gesture_controller_.reset(); |
1220 } | 1223 } |
1221 | 1224 |
1222 void RenderWidgetHostImpl::UpdateTextDirection(WebTextDirection direction) { | 1225 void RenderWidgetHostImpl::UpdateTextDirection(WebTextDirection direction) { |
1223 text_direction_updated_ = true; | 1226 text_direction_updated_ = true; |
1224 text_direction_ = direction; | 1227 text_direction_ = direction; |
1225 } | 1228 } |
1226 | 1229 |
1227 void RenderWidgetHostImpl::CancelUpdateTextDirection() { | 1230 void RenderWidgetHostImpl::CancelUpdateTextDirection() { |
1228 if (text_direction_updated_) | 1231 if (text_direction_updated_) |
(...skipping 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2341 } | 2344 } |
2342 } | 2345 } |
2343 | 2346 |
2344 SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() { | 2347 SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() { |
2345 if (view_) | 2348 if (view_) |
2346 return view_->PreferredReadbackFormat(); | 2349 return view_->PreferredReadbackFormat(); |
2347 return kN32_SkColorType; | 2350 return kN32_SkColorType; |
2348 } | 2351 } |
2349 | 2352 |
2350 } // namespace content | 2353 } // namespace content |
OLD | NEW |