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

Side by Side Diff: content/browser/renderer_host/render_widget_host_impl.cc

Issue 10560022: Browser Plugin: New Implementation (Browser Side) (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Added browser test + Fixed a silly initial loading bug :-) Created 8 years, 4 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 | Annotate | Revision Log
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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 return view_->GetCompositingSurface(); 236 return view_->GetCompositingSurface();
237 return gfx::GLSurfaceHandle(); 237 return gfx::GLSurfaceHandle();
238 } 238 }
239 239
240 void RenderWidgetHostImpl::CompositingSurfaceUpdated() { 240 void RenderWidgetHostImpl::CompositingSurfaceUpdated() {
241 GpuSurfaceTracker::Get()->SetSurfaceHandle( 241 GpuSurfaceTracker::Get()->SetSurfaceHandle(
242 surface_id_, GetCompositingSurface()); 242 surface_id_, GetCompositingSurface());
243 process_->SurfaceUpdated(surface_id_); 243 process_->SurfaceUpdated(surface_id_);
244 } 244 }
245 245
246 void RenderWidgetHostImpl::ResetFlags() {
247 // Must reset these to ensure that mouse move/wheel events work with a new
248 // renderer.
249 mouse_move_pending_ = false;
250 next_mouse_move_.reset();
251 mouse_wheel_pending_ = false;
252 coalesced_mouse_wheel_events_.clear();
253
254 // Must reset these to ensure that gesture events work with a new renderer.
255 coalesced_gesture_events_.clear();
256 gesture_event_pending_ = false;
257
258 // Must reset these to ensure that keyboard events work with a new renderer.
259 key_queue_.clear();
260 suppress_next_char_events_ = false;
261
262 // Reset some fields in preparation for recovering from a crash.
263 resize_ack_pending_ = false;
264 repaint_ack_pending_ = false;
265
266 in_flight_size_.SetSize(0, 0);
267 current_size_.SetSize(0, 0);
268 is_hidden_ = false;
269 is_accelerated_compositing_active_ = false;
270
271 // Reset this to ensure the hung renderer mechanism is working properly.
272 in_flight_event_count_ = 0;
273 }
274
246 void RenderWidgetHostImpl::Init() { 275 void RenderWidgetHostImpl::Init() {
247 DCHECK(process_->HasConnection()); 276 DCHECK(process_->HasConnection());
248 277
249 renderer_initialized_ = true; 278 renderer_initialized_ = true;
250 279
251 GpuSurfaceTracker::Get()->SetSurfaceHandle( 280 GpuSurfaceTracker::Get()->SetSurfaceHandle(
252 surface_id_, GetCompositingSurface()); 281 surface_id_, GetCompositingSurface());
253 282
254 // Send the ack along with the information on placement. 283 // Send the ack along with the information on placement.
255 Send(new ViewMsg_CreatingNew_ACK(routing_id_, GetNativeViewId())); 284 Send(new ViewMsg_CreatingNew_ACK(routing_id_, GetNativeViewId()));
(...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after
1106 void RenderWidgetHostImpl::SetDeviceScaleFactor(float scale) { 1135 void RenderWidgetHostImpl::SetDeviceScaleFactor(float scale) {
1107 Send(new ViewMsg_SetDeviceScaleFactor(GetRoutingID(), scale)); 1136 Send(new ViewMsg_SetDeviceScaleFactor(GetRoutingID(), scale));
1108 } 1137 }
1109 1138
1110 void RenderWidgetHostImpl::RendererExited(base::TerminationStatus status, 1139 void RenderWidgetHostImpl::RendererExited(base::TerminationStatus status,
1111 int exit_code) { 1140 int exit_code) {
1112 // Clearing this flag causes us to re-create the renderer when recovering 1141 // Clearing this flag causes us to re-create the renderer when recovering
1113 // from a crashed renderer. 1142 // from a crashed renderer.
1114 renderer_initialized_ = false; 1143 renderer_initialized_ = false;
1115 1144
1116 // Must reset these to ensure that mouse move/wheel events work with a new 1145 ResetFlags();
1117 // renderer.
1118 mouse_move_pending_ = false;
1119 next_mouse_move_.reset();
1120 mouse_wheel_pending_ = false;
1121 coalesced_mouse_wheel_events_.clear();
1122
1123 // Must reset these to ensure that gesture events work with a new renderer.
1124 coalesced_gesture_events_.clear();
1125 gesture_event_pending_ = false;
1126
1127 // Must reset these to ensure that keyboard events work with a new renderer.
1128 key_queue_.clear();
1129 suppress_next_char_events_ = false;
1130
1131 // Reset some fields in preparation for recovering from a crash.
1132 resize_ack_pending_ = false;
1133 repaint_ack_pending_ = false;
1134
1135 in_flight_size_.SetSize(0, 0);
1136 current_size_.SetSize(0, 0);
1137 is_hidden_ = false;
1138 is_accelerated_compositing_active_ = false;
1139
1140 // Reset this to ensure the hung renderer mechanism is working properly.
1141 in_flight_event_count_ = 0;
1142 1146
1143 if (view_) { 1147 if (view_) {
1144 GpuSurfaceTracker::Get()->SetSurfaceHandle(surface_id_, 1148 GpuSurfaceTracker::Get()->SetSurfaceHandle(surface_id_,
1145 gfx::GLSurfaceHandle()); 1149 gfx::GLSurfaceHandle());
1146 view_->RenderViewGone(status, exit_code); 1150 view_->RenderViewGone(status, exit_code);
1147 view_ = NULL; // The View should be deleted by RenderViewGone. 1151 view_ = NULL; // The View should be deleted by RenderViewGone.
1148 } 1152 }
1149 1153
1150 BackingStoreManager::RemoveBackingStore(this); 1154 BackingStoreManager::RemoveBackingStore(this);
1151 } 1155 }
(...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after
2051 // indicate that no callback is in progress (i.e. without this line 2055 // indicate that no callback is in progress (i.e. without this line
2052 // DelayedAutoResized will not get called again). 2056 // DelayedAutoResized will not get called again).
2053 new_auto_size_.SetSize(0, 0); 2057 new_auto_size_.SetSize(0, 0);
2054 if (!should_auto_resize_) 2058 if (!should_auto_resize_)
2055 return; 2059 return;
2056 2060
2057 OnRenderAutoResized(new_size); 2061 OnRenderAutoResized(new_size);
2058 } 2062 }
2059 2063
2060 } // namespace content 2064 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698