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

Side by Side Diff: content/renderer/render_widget.cc

Issue 134623005: Make SingleThreadProxy a SchedulerClient (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More fixes Created 6 years, 5 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/renderer/render_widget.h" 5 #include "content/renderer/render_widget.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 did_show_(false), 370 did_show_(false),
371 is_hidden_(hidden), 371 is_hidden_(hidden),
372 never_visible_(never_visible), 372 never_visible_(never_visible),
373 is_fullscreen_(false), 373 is_fullscreen_(false),
374 has_focus_(false), 374 has_focus_(false),
375 handling_input_event_(false), 375 handling_input_event_(false),
376 handling_ime_event_(false), 376 handling_ime_event_(false),
377 handling_event_type_(WebInputEvent::Undefined), 377 handling_event_type_(WebInputEvent::Undefined),
378 ignore_ack_for_mouse_move_from_debugger_(false), 378 ignore_ack_for_mouse_move_from_debugger_(false),
379 closing_(false), 379 closing_(false),
380 host_closing_(false),
380 is_swapped_out_(swapped_out), 381 is_swapped_out_(swapped_out),
381 input_method_is_active_(false), 382 input_method_is_active_(false),
382 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), 383 text_input_type_(ui::TEXT_INPUT_TYPE_NONE),
383 text_input_mode_(ui::TEXT_INPUT_MODE_DEFAULT), 384 text_input_mode_(ui::TEXT_INPUT_MODE_DEFAULT),
384 can_compose_inline_(true), 385 can_compose_inline_(true),
385 popup_type_(popup_type), 386 popup_type_(popup_type),
386 pending_window_rect_count_(0), 387 pending_window_rect_count_(0),
387 suppress_next_char_events_(false), 388 suppress_next_char_events_(false),
388 screen_info_(screen_info), 389 screen_info_(screen_info),
389 device_scale_factor_(screen_info_.deviceScaleFactor), 390 device_scale_factor_(screen_info_.deviceScaleFactor),
(...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after
1158 } 1159 }
1159 1160
1160 void RenderWidget::AutoResizeCompositor() { 1161 void RenderWidget::AutoResizeCompositor() {
1161 physical_backing_size_ = gfx::ToCeiledSize(gfx::ScaleSize(size_, 1162 physical_backing_size_ = gfx::ToCeiledSize(gfx::ScaleSize(size_,
1162 device_scale_factor_)); 1163 device_scale_factor_));
1163 if (compositor_) 1164 if (compositor_)
1164 compositor_->setViewportSize(size_, physical_backing_size_); 1165 compositor_->setViewportSize(size_, physical_backing_size_);
1165 } 1166 }
1166 1167
1167 void RenderWidget::initializeLayerTreeView() { 1168 void RenderWidget::initializeLayerTreeView() {
1169 // The host is currently shutting down and any old compositors have
1170 // been destroyed, so don't create any new ones.
1171 if (host_closing_)
danakj 2014/07/02 21:31:42 Do you think this can/should be a DCHECK one day?
enne (OOO) 2014/07/10 20:37:42 Done.
1172 return;
1173
1168 compositor_ = RenderWidgetCompositor::Create( 1174 compositor_ = RenderWidgetCompositor::Create(
1169 this, is_threaded_compositing_enabled_); 1175 this, is_threaded_compositing_enabled_);
1170 compositor_->setViewportSize(size_, physical_backing_size_); 1176 compositor_->setViewportSize(size_, physical_backing_size_);
1171 if (init_complete_) 1177 if (init_complete_)
1172 StartCompositor(); 1178 StartCompositor();
1173 } 1179 }
1174 1180
1181 void RenderWidget::DestroyLayerTreeView() {
1182 if (!compositor_)
1183 return;
1184 webwidget_->willCloseLayerTreeView();
1185 compositor_.reset();
1186 }
1187
1175 blink::WebLayerTreeView* RenderWidget::layerTreeView() { 1188 blink::WebLayerTreeView* RenderWidget::layerTreeView() {
1176 return compositor_.get(); 1189 return compositor_.get();
1177 } 1190 }
1178 1191
1179 void RenderWidget::suppressCompositorScheduling(bool enable) { 1192 void RenderWidget::suppressCompositorScheduling(bool enable) {
1180 if (compositor_) 1193 if (compositor_)
1181 compositor_->SetSuppressScheduleComposite(enable); 1194 compositor_->SetSuppressScheduleComposite(enable);
1182 } 1195 }
1183 1196
1184 void RenderWidget::willBeginCompositorFrame() { 1197 void RenderWidget::willBeginCompositorFrame() {
1185 TRACE_EVENT0("gpu", "RenderWidget::willBeginCompositorFrame"); 1198 TRACE_EVENT0("gpu", "RenderWidget::willBeginCompositorFrame");
1186 1199
1187 DCHECK(RenderThreadImpl::current()->compositor_message_loop_proxy().get());
1188
1189 // The following two can result in further layout and possibly 1200 // The following two can result in further layout and possibly
1190 // enable GPU acceleration so they need to be called before any painting 1201 // enable GPU acceleration so they need to be called before any painting
1191 // is done. 1202 // is done.
1192 UpdateTextInputState(NO_SHOW_IME, FROM_NON_IME); 1203 UpdateTextInputState(NO_SHOW_IME, FROM_NON_IME);
1193 UpdateSelectionBounds(); 1204 UpdateSelectionBounds();
1194 } 1205 }
1195 1206
1196 void RenderWidget::didBecomeReadyForAdditionalInput() { 1207 void RenderWidget::didBecomeReadyForAdditionalInput() {
1197 TRACE_EVENT0("renderer", "RenderWidget::didBecomeReadyForAdditionalInput"); 1208 TRACE_EVENT0("renderer", "RenderWidget::didBecomeReadyForAdditionalInput");
1198 FlushPendingInputEventAck(); 1209 FlushPendingInputEventAck();
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
1282 SetPendingWindowRect(initial_pos_); 1293 SetPendingWindowRect(initial_pos_);
1283 } 1294 }
1284 1295
1285 void RenderWidget::didFocus() { 1296 void RenderWidget::didFocus() {
1286 } 1297 }
1287 1298
1288 void RenderWidget::didBlur() { 1299 void RenderWidget::didBlur() {
1289 } 1300 }
1290 1301
1291 void RenderWidget::DoDeferredClose() { 1302 void RenderWidget::DoDeferredClose() {
1303 // No more compositing is possible. This prevents shutdown races between
1304 // previously posted CreateOutputSurface tasks and the host being unable to
1305 // create them because the close message was handled.
1306 DestroyLayerTreeView();
enne (OOO) 2014/07/02 21:19:43 This is the Chromium side of preventing the race t
1307 // Also prevent new compositors from being created.
1308 host_closing_ = true;
1292 Send(new ViewHostMsg_Close(routing_id_)); 1309 Send(new ViewHostMsg_Close(routing_id_));
1293 } 1310 }
1294 1311
1295 void RenderWidget::closeWidgetSoon() { 1312 void RenderWidget::closeWidgetSoon() {
1296 if (is_swapped_out_) { 1313 if (is_swapped_out_) {
1297 // This widget is currently swapped out, and the active widget is in a 1314 // This widget is currently swapped out, and the active widget is in a
1298 // different process. Have the browser route the close request to the 1315 // different process. Have the browser route the close request to the
1299 // active widget instead, so that the correct unload handlers are run. 1316 // active widget instead, so that the correct unload handlers are run.
1300 Send(new ViewHostMsg_RouteCloseEvent(routing_id_)); 1317 Send(new ViewHostMsg_RouteCloseEvent(routing_id_));
1301 return; 1318 return;
(...skipping 19 matching lines...) Expand all
1321 pending_synthetic_gesture_callbacks_.push(callback); 1338 pending_synthetic_gesture_callbacks_.push(callback);
1322 1339
1323 SyntheticGesturePacket gesture_packet; 1340 SyntheticGesturePacket gesture_packet;
1324 gesture_packet.set_gesture_params(gesture_params.Pass()); 1341 gesture_packet.set_gesture_params(gesture_params.Pass());
1325 1342
1326 Send(new InputHostMsg_QueueSyntheticGesture(routing_id_, gesture_packet)); 1343 Send(new InputHostMsg_QueueSyntheticGesture(routing_id_, gesture_packet));
1327 } 1344 }
1328 1345
1329 void RenderWidget::Close() { 1346 void RenderWidget::Close() {
1330 if (webwidget_) { 1347 if (webwidget_) {
1331 webwidget_->willCloseLayerTreeView(); 1348 DestroyLayerTreeView();
1332 compositor_.reset();
1333 webwidget_->close(); 1349 webwidget_->close();
1334 webwidget_ = NULL; 1350 webwidget_ = NULL;
1335 } 1351 }
1336 } 1352 }
1337 1353
1338 WebRect RenderWidget::windowRect() { 1354 WebRect RenderWidget::windowRect() {
1339 if (pending_window_rect_count_) 1355 if (pending_window_rect_count_)
1340 return pending_window_rect_; 1356 return pending_window_rect_;
1341 1357
1342 return view_screen_rect_; 1358 return view_screen_rect_;
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after
2065 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { 2081 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) {
2066 video_hole_frames_.AddObserver(frame); 2082 video_hole_frames_.AddObserver(frame);
2067 } 2083 }
2068 2084
2069 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { 2085 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) {
2070 video_hole_frames_.RemoveObserver(frame); 2086 video_hole_frames_.RemoveObserver(frame);
2071 } 2087 }
2072 #endif // defined(VIDEO_HOLE) 2088 #endif // defined(VIDEO_HOLE)
2073 2089
2074 } // namespace content 2090 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698