| 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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 return view_->GetCompositingSurface(); | 228 return view_->GetCompositingSurface(); |
| 229 return gfx::GLSurfaceHandle(); | 229 return gfx::GLSurfaceHandle(); |
| 230 } | 230 } |
| 231 | 231 |
| 232 void RenderWidgetHostImpl::CompositingSurfaceUpdated() { | 232 void RenderWidgetHostImpl::CompositingSurfaceUpdated() { |
| 233 GpuSurfaceTracker::Get()->SetSurfaceHandle( | 233 GpuSurfaceTracker::Get()->SetSurfaceHandle( |
| 234 surface_id_, GetCompositingSurface()); | 234 surface_id_, GetCompositingSurface()); |
| 235 process_->SurfaceUpdated(surface_id_); | 235 process_->SurfaceUpdated(surface_id_); |
| 236 } | 236 } |
| 237 | 237 |
| 238 void RenderWidgetHostImpl::ResetFlags() { |
| 239 // Must reset these to ensure that mouse move/wheel events work with a new |
| 240 // renderer. |
| 241 mouse_move_pending_ = false; |
| 242 next_mouse_move_.reset(); |
| 243 mouse_wheel_pending_ = false; |
| 244 coalesced_mouse_wheel_events_.clear(); |
| 245 |
| 246 // Must reset these to ensure that SelectRange works with a new renderer. |
| 247 select_range_pending_ = false; |
| 248 next_selection_range_.reset(); |
| 249 |
| 250 // Must reset these to ensure that gesture events work with a new renderer. |
| 251 gesture_event_filter_->Reset(); |
| 252 |
| 253 // Must reset these to ensure that keyboard events work with a new renderer. |
| 254 key_queue_.clear(); |
| 255 suppress_next_char_events_ = false; |
| 256 |
| 257 // Reset some fields in preparation for recovering from a crash. |
| 258 resize_ack_pending_ = false; |
| 259 repaint_ack_pending_ = false; |
| 260 |
| 261 in_flight_size_.SetSize(0, 0); |
| 262 current_size_.SetSize(0, 0); |
| 263 is_hidden_ = false; |
| 264 is_accelerated_compositing_active_ = false; |
| 265 |
| 266 // Reset this to ensure the hung renderer mechanism is working properly. |
| 267 in_flight_event_count_ = 0; |
| 268 } |
| 269 |
| 238 void RenderWidgetHostImpl::Init() { | 270 void RenderWidgetHostImpl::Init() { |
| 239 DCHECK(process_->HasConnection()); | 271 DCHECK(process_->HasConnection()); |
| 240 | 272 |
| 241 renderer_initialized_ = true; | 273 renderer_initialized_ = true; |
| 242 | 274 |
| 243 GpuSurfaceTracker::Get()->SetSurfaceHandle( | 275 GpuSurfaceTracker::Get()->SetSurfaceHandle( |
| 244 surface_id_, GetCompositingSurface()); | 276 surface_id_, GetCompositingSurface()); |
| 245 | 277 |
| 246 // Send the ack along with the information on placement. | 278 // Send the ack along with the information on placement. |
| 247 Send(new ViewMsg_CreatingNew_ACK(routing_id_, GetNativeViewId())); | 279 Send(new ViewMsg_CreatingNew_ACK(routing_id_, GetNativeViewId())); |
| (...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1071 void RenderWidgetHostImpl::SetDeviceScaleFactor(float scale) { | 1103 void RenderWidgetHostImpl::SetDeviceScaleFactor(float scale) { |
| 1072 Send(new ViewMsg_SetDeviceScaleFactor(GetRoutingID(), scale)); | 1104 Send(new ViewMsg_SetDeviceScaleFactor(GetRoutingID(), scale)); |
| 1073 } | 1105 } |
| 1074 | 1106 |
| 1075 void RenderWidgetHostImpl::RendererExited(base::TerminationStatus status, | 1107 void RenderWidgetHostImpl::RendererExited(base::TerminationStatus status, |
| 1076 int exit_code) { | 1108 int exit_code) { |
| 1077 // Clearing this flag causes us to re-create the renderer when recovering | 1109 // Clearing this flag causes us to re-create the renderer when recovering |
| 1078 // from a crashed renderer. | 1110 // from a crashed renderer. |
| 1079 renderer_initialized_ = false; | 1111 renderer_initialized_ = false; |
| 1080 | 1112 |
| 1081 // Must reset these to ensure that mouse move/wheel events work with a new | 1113 ResetFlags(); |
| 1082 // renderer. | |
| 1083 mouse_move_pending_ = false; | |
| 1084 next_mouse_move_.reset(); | |
| 1085 mouse_wheel_pending_ = false; | |
| 1086 coalesced_mouse_wheel_events_.clear(); | |
| 1087 | |
| 1088 // Must reset these to ensure that SelectRange works with a new renderer. | |
| 1089 select_range_pending_ = false; | |
| 1090 next_selection_range_.reset(); | |
| 1091 | |
| 1092 // Must reset these to ensure that gesture events work with a new renderer. | |
| 1093 gesture_event_filter_->Reset(); | |
| 1094 | |
| 1095 // Must reset these to ensure that keyboard events work with a new renderer. | |
| 1096 key_queue_.clear(); | |
| 1097 suppress_next_char_events_ = false; | |
| 1098 | |
| 1099 // Reset some fields in preparation for recovering from a crash. | |
| 1100 resize_ack_pending_ = false; | |
| 1101 repaint_ack_pending_ = false; | |
| 1102 | |
| 1103 in_flight_size_.SetSize(0, 0); | |
| 1104 current_size_.SetSize(0, 0); | |
| 1105 is_hidden_ = false; | |
| 1106 is_accelerated_compositing_active_ = false; | |
| 1107 | |
| 1108 // Reset this to ensure the hung renderer mechanism is working properly. | |
| 1109 in_flight_event_count_ = 0; | |
| 1110 | 1114 |
| 1111 if (view_) { | 1115 if (view_) { |
| 1112 GpuSurfaceTracker::Get()->SetSurfaceHandle(surface_id_, | 1116 GpuSurfaceTracker::Get()->SetSurfaceHandle(surface_id_, |
| 1113 gfx::GLSurfaceHandle()); | 1117 gfx::GLSurfaceHandle()); |
| 1114 view_->RenderViewGone(status, exit_code); | 1118 view_->RenderViewGone(status, exit_code); |
| 1115 view_ = NULL; // The View should be deleted by RenderViewGone. | 1119 view_ = NULL; // The View should be deleted by RenderViewGone. |
| 1116 } | 1120 } |
| 1117 | 1121 |
| 1118 BackingStoreManager::RemoveBackingStore(this); | 1122 BackingStoreManager::RemoveBackingStore(this); |
| 1119 } | 1123 } |
| (...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2009 // indicate that no callback is in progress (i.e. without this line | 2013 // indicate that no callback is in progress (i.e. without this line |
| 2010 // DelayedAutoResized will not get called again). | 2014 // DelayedAutoResized will not get called again). |
| 2011 new_auto_size_.SetSize(0, 0); | 2015 new_auto_size_.SetSize(0, 0); |
| 2012 if (!should_auto_resize_) | 2016 if (!should_auto_resize_) |
| 2013 return; | 2017 return; |
| 2014 | 2018 |
| 2015 OnRenderAutoResized(new_size); | 2019 OnRenderAutoResized(new_size); |
| 2016 } | 2020 } |
| 2017 | 2021 |
| 2018 } // namespace content | 2022 } // namespace content |
| OLD | NEW |