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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
227 return view_->GetCompositingSurface(); | 227 return view_->GetCompositingSurface(); |
228 return gfx::GLSurfaceHandle(); | 228 return gfx::GLSurfaceHandle(); |
229 } | 229 } |
230 | 230 |
231 void RenderWidgetHostImpl::CompositingSurfaceUpdated() { | 231 void RenderWidgetHostImpl::CompositingSurfaceUpdated() { |
232 GpuSurfaceTracker::Get()->SetSurfaceHandle( | 232 GpuSurfaceTracker::Get()->SetSurfaceHandle( |
233 surface_id_, GetCompositingSurface()); | 233 surface_id_, GetCompositingSurface()); |
234 process_->SurfaceUpdated(surface_id_); | 234 process_->SurfaceUpdated(surface_id_); |
235 } | 235 } |
236 | 236 |
237 void RenderWidgetHostImpl::ResetFlags() { | |
rjkroege
2012/08/22 21:57:38
must reset the GestureEventFilter too
lazyboy
2012/08/23 00:45:22
reset gesture_event_filter to new GestureEventFilt
| |
238 // Must reset these to ensure that mouse move/wheel events work with a new | |
239 // renderer. | |
240 mouse_move_pending_ = false; | |
241 next_mouse_move_.reset(); | |
242 mouse_wheel_pending_ = false; | |
243 coalesced_mouse_wheel_events_.clear(); | |
244 | |
245 // Must reset these to ensure that keyboard events work with a new renderer. | |
246 key_queue_.clear(); | |
247 suppress_next_char_events_ = false; | |
248 | |
249 // Reset some fields in preparation for recovering from a crash. | |
250 resize_ack_pending_ = false; | |
251 repaint_ack_pending_ = false; | |
252 | |
253 in_flight_size_.SetSize(0, 0); | |
254 current_size_.SetSize(0, 0); | |
255 is_hidden_ = false; | |
256 is_accelerated_compositing_active_ = false; | |
257 | |
258 // Reset this to ensure the hung renderer mechanism is working properly. | |
259 in_flight_event_count_ = 0; | |
260 } | |
261 | |
237 void RenderWidgetHostImpl::Init() { | 262 void RenderWidgetHostImpl::Init() { |
238 DCHECK(process_->HasConnection()); | 263 DCHECK(process_->HasConnection()); |
239 | 264 |
240 renderer_initialized_ = true; | 265 renderer_initialized_ = true; |
241 | 266 |
242 GpuSurfaceTracker::Get()->SetSurfaceHandle( | 267 GpuSurfaceTracker::Get()->SetSurfaceHandle( |
243 surface_id_, GetCompositingSurface()); | 268 surface_id_, GetCompositingSurface()); |
244 | 269 |
245 // Send the ack along with the information on placement. | 270 // Send the ack along with the information on placement. |
246 Send(new ViewMsg_CreatingNew_ACK(routing_id_, GetNativeViewId())); | 271 Send(new ViewMsg_CreatingNew_ACK(routing_id_, GetNativeViewId())); |
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1069 void RenderWidgetHostImpl::SetDeviceScaleFactor(float scale) { | 1094 void RenderWidgetHostImpl::SetDeviceScaleFactor(float scale) { |
1070 Send(new ViewMsg_SetDeviceScaleFactor(GetRoutingID(), scale)); | 1095 Send(new ViewMsg_SetDeviceScaleFactor(GetRoutingID(), scale)); |
1071 } | 1096 } |
1072 | 1097 |
1073 void RenderWidgetHostImpl::RendererExited(base::TerminationStatus status, | 1098 void RenderWidgetHostImpl::RendererExited(base::TerminationStatus status, |
1074 int exit_code) { | 1099 int exit_code) { |
1075 // Clearing this flag causes us to re-create the renderer when recovering | 1100 // Clearing this flag causes us to re-create the renderer when recovering |
1076 // from a crashed renderer. | 1101 // from a crashed renderer. |
1077 renderer_initialized_ = false; | 1102 renderer_initialized_ = false; |
1078 | 1103 |
1079 // Must reset these to ensure that mouse move/wheel events work with a new | 1104 ResetFlags(); |
1080 // renderer. | |
1081 mouse_move_pending_ = false; | |
1082 next_mouse_move_.reset(); | |
1083 mouse_wheel_pending_ = false; | |
1084 coalesced_mouse_wheel_events_.clear(); | |
1085 | |
1086 // Must reset these to ensure that gesture events work with a new renderer. | |
1087 gesture_event_filter_->Reset(); | |
1088 | |
1089 // Must reset these to ensure that keyboard events work with a new renderer. | |
1090 key_queue_.clear(); | |
1091 suppress_next_char_events_ = false; | |
1092 | |
1093 // Reset some fields in preparation for recovering from a crash. | |
1094 resize_ack_pending_ = false; | |
1095 repaint_ack_pending_ = false; | |
1096 | |
1097 in_flight_size_.SetSize(0, 0); | |
1098 current_size_.SetSize(0, 0); | |
1099 is_hidden_ = false; | |
1100 is_accelerated_compositing_active_ = false; | |
1101 | |
1102 // Reset this to ensure the hung renderer mechanism is working properly. | |
1103 in_flight_event_count_ = 0; | |
1104 | 1105 |
1105 if (view_) { | 1106 if (view_) { |
1106 GpuSurfaceTracker::Get()->SetSurfaceHandle(surface_id_, | 1107 GpuSurfaceTracker::Get()->SetSurfaceHandle(surface_id_, |
1107 gfx::GLSurfaceHandle()); | 1108 gfx::GLSurfaceHandle()); |
1108 view_->RenderViewGone(status, exit_code); | 1109 view_->RenderViewGone(status, exit_code); |
1109 view_ = NULL; // The View should be deleted by RenderViewGone. | 1110 view_ = NULL; // The View should be deleted by RenderViewGone. |
1110 } | 1111 } |
1111 | 1112 |
1112 BackingStoreManager::RemoveBackingStore(this); | 1113 BackingStoreManager::RemoveBackingStore(this); |
1113 } | 1114 } |
(...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1985 // indicate that no callback is in progress (i.e. without this line | 1986 // indicate that no callback is in progress (i.e. without this line |
1986 // DelayedAutoResized will not get called again). | 1987 // DelayedAutoResized will not get called again). |
1987 new_auto_size_.SetSize(0, 0); | 1988 new_auto_size_.SetSize(0, 0); |
1988 if (!should_auto_resize_) | 1989 if (!should_auto_resize_) |
1989 return; | 1990 return; |
1990 | 1991 |
1991 OnRenderAutoResized(new_size); | 1992 OnRenderAutoResized(new_size); |
1992 } | 1993 } |
1993 | 1994 |
1994 } // namespace content | 1995 } // namespace content |
OLD | NEW |