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

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: Add scoped_abort_remaining_swap_promises.h Created 6 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
« no previous file with comments | « content/renderer/render_widget.h ('k') | content/shell/renderer/test_runner/web_test_proxy.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 did_show_(false), 386 did_show_(false),
387 is_hidden_(hidden), 387 is_hidden_(hidden),
388 never_visible_(never_visible), 388 never_visible_(never_visible),
389 is_fullscreen_(false), 389 is_fullscreen_(false),
390 has_focus_(false), 390 has_focus_(false),
391 handling_input_event_(false), 391 handling_input_event_(false),
392 handling_ime_event_(false), 392 handling_ime_event_(false),
393 handling_event_type_(WebInputEvent::Undefined), 393 handling_event_type_(WebInputEvent::Undefined),
394 ignore_ack_for_mouse_move_from_debugger_(false), 394 ignore_ack_for_mouse_move_from_debugger_(false),
395 closing_(false), 395 closing_(false),
396 host_closing_(false),
396 is_swapped_out_(swapped_out), 397 is_swapped_out_(swapped_out),
397 input_method_is_active_(false), 398 input_method_is_active_(false),
398 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), 399 text_input_type_(ui::TEXT_INPUT_TYPE_NONE),
399 text_input_mode_(ui::TEXT_INPUT_MODE_DEFAULT), 400 text_input_mode_(ui::TEXT_INPUT_MODE_DEFAULT),
400 can_compose_inline_(true), 401 can_compose_inline_(true),
401 popup_type_(popup_type), 402 popup_type_(popup_type),
402 pending_window_rect_count_(0), 403 pending_window_rect_count_(0),
403 suppress_next_char_events_(false), 404 suppress_next_char_events_(false),
404 screen_info_(screen_info), 405 screen_info_(screen_info),
405 device_scale_factor_(screen_info_.deviceScaleFactor), 406 device_scale_factor_(screen_info_.deviceScaleFactor),
(...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after
1192 } 1193 }
1193 1194
1194 void RenderWidget::AutoResizeCompositor() { 1195 void RenderWidget::AutoResizeCompositor() {
1195 physical_backing_size_ = gfx::ToCeiledSize(gfx::ScaleSize(size_, 1196 physical_backing_size_ = gfx::ToCeiledSize(gfx::ScaleSize(size_,
1196 device_scale_factor_)); 1197 device_scale_factor_));
1197 if (compositor_) 1198 if (compositor_)
1198 compositor_->setViewportSize(size_, physical_backing_size_); 1199 compositor_->setViewportSize(size_, physical_backing_size_);
1199 } 1200 }
1200 1201
1201 void RenderWidget::initializeLayerTreeView() { 1202 void RenderWidget::initializeLayerTreeView() {
1203 DCHECK(!host_closing_);
1204
1202 compositor_ = 1205 compositor_ =
1203 RenderWidgetCompositor::Create(this, IsThreadedCompositingEnabled()); 1206 RenderWidgetCompositor::Create(this, IsThreadedCompositingEnabled());
1204 compositor_->setViewportSize(size_, physical_backing_size_); 1207 compositor_->setViewportSize(size_, physical_backing_size_);
1205 if (init_complete_) 1208 if (init_complete_)
1206 StartCompositor(); 1209 StartCompositor();
1207 } 1210 }
1208 1211
1212 void RenderWidget::DestroyLayerTreeView() {
1213 // Always send this notification to prevent new layer tree views from
1214 // being created, even if one hasn't been created yet.
1215 if (webwidget_)
1216 webwidget_->willCloseLayerTreeView();
1217 compositor_.reset();
1218 }
1219
1209 blink::WebLayerTreeView* RenderWidget::layerTreeView() { 1220 blink::WebLayerTreeView* RenderWidget::layerTreeView() {
1210 return compositor_.get(); 1221 return compositor_.get();
1211 } 1222 }
1212 1223
1213 void RenderWidget::suppressCompositorScheduling(bool enable) {
1214 if (compositor_)
1215 compositor_->SetSuppressScheduleComposite(enable);
1216 }
1217
1218 void RenderWidget::willBeginCompositorFrame() { 1224 void RenderWidget::willBeginCompositorFrame() {
1219 TRACE_EVENT0("gpu", "RenderWidget::willBeginCompositorFrame"); 1225 TRACE_EVENT0("gpu", "RenderWidget::willBeginCompositorFrame");
1220 1226
1221 DCHECK(RenderThreadImpl::current()->compositor_message_loop_proxy().get());
1222
1223 // The following two can result in further layout and possibly 1227 // The following two can result in further layout and possibly
1224 // enable GPU acceleration so they need to be called before any painting 1228 // enable GPU acceleration so they need to be called before any painting
1225 // is done. 1229 // is done.
1226 UpdateTextInputState(NO_SHOW_IME, FROM_NON_IME); 1230 UpdateTextInputState(NO_SHOW_IME, FROM_NON_IME);
1227 UpdateSelectionBounds(); 1231 UpdateSelectionBounds();
1228 } 1232 }
1229 1233
1230 void RenderWidget::didBecomeReadyForAdditionalInput() { 1234 void RenderWidget::didBecomeReadyForAdditionalInput() {
1231 TRACE_EVENT0("renderer", "RenderWidget::didBecomeReadyForAdditionalInput"); 1235 TRACE_EVENT0("renderer", "RenderWidget::didBecomeReadyForAdditionalInput");
1232 FlushPendingInputEventAck(); 1236 FlushPendingInputEventAck();
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1369 SetPendingWindowRect(initial_pos_); 1373 SetPendingWindowRect(initial_pos_);
1370 } 1374 }
1371 1375
1372 void RenderWidget::didFocus() { 1376 void RenderWidget::didFocus() {
1373 } 1377 }
1374 1378
1375 void RenderWidget::didBlur() { 1379 void RenderWidget::didBlur() {
1376 } 1380 }
1377 1381
1378 void RenderWidget::DoDeferredClose() { 1382 void RenderWidget::DoDeferredClose() {
1383 // No more compositing is possible. This prevents shutdown races between
1384 // previously posted CreateOutputSurface tasks and the host being unable to
1385 // create them because the close message was handled.
1386 DestroyLayerTreeView();
1387 // Also prevent new compositors from being created.
1388 host_closing_ = true;
1379 Send(new ViewHostMsg_Close(routing_id_)); 1389 Send(new ViewHostMsg_Close(routing_id_));
1380 } 1390 }
1381 1391
1382 void RenderWidget::closeWidgetSoon() { 1392 void RenderWidget::closeWidgetSoon() {
1383 if (is_swapped_out_) { 1393 if (is_swapped_out_) {
1384 // This widget is currently swapped out, and the active widget is in a 1394 // This widget is currently swapped out, and the active widget is in a
1385 // different process. Have the browser route the close request to the 1395 // different process. Have the browser route the close request to the
1386 // active widget instead, so that the correct unload handlers are run. 1396 // active widget instead, so that the correct unload handlers are run.
1387 Send(new ViewHostMsg_RouteCloseEvent(routing_id_)); 1397 Send(new ViewHostMsg_RouteCloseEvent(routing_id_));
1388 return; 1398 return;
(...skipping 19 matching lines...) Expand all
1408 pending_synthetic_gesture_callbacks_.push(callback); 1418 pending_synthetic_gesture_callbacks_.push(callback);
1409 1419
1410 SyntheticGesturePacket gesture_packet; 1420 SyntheticGesturePacket gesture_packet;
1411 gesture_packet.set_gesture_params(gesture_params.Pass()); 1421 gesture_packet.set_gesture_params(gesture_params.Pass());
1412 1422
1413 Send(new InputHostMsg_QueueSyntheticGesture(routing_id_, gesture_packet)); 1423 Send(new InputHostMsg_QueueSyntheticGesture(routing_id_, gesture_packet));
1414 } 1424 }
1415 1425
1416 void RenderWidget::Close() { 1426 void RenderWidget::Close() {
1417 screen_metrics_emulator_.reset(); 1427 screen_metrics_emulator_.reset();
1428 DestroyLayerTreeView();
1418 if (webwidget_) { 1429 if (webwidget_) {
1419 webwidget_->willCloseLayerTreeView();
1420 compositor_.reset();
1421 webwidget_->close(); 1430 webwidget_->close();
1422 webwidget_ = NULL; 1431 webwidget_ = NULL;
1423 } 1432 }
1424 } 1433 }
1425 1434
1426 WebRect RenderWidget::windowRect() { 1435 WebRect RenderWidget::windowRect() {
1427 if (pending_window_rect_count_) 1436 if (pending_window_rect_count_)
1428 return pending_window_rect_; 1437 return pending_window_rect_;
1429 1438
1430 return view_screen_rect_; 1439 return view_screen_rect_;
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after
2159 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { 2168 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) {
2160 video_hole_frames_.AddObserver(frame); 2169 video_hole_frames_.AddObserver(frame);
2161 } 2170 }
2162 2171
2163 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { 2172 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) {
2164 video_hole_frames_.RemoveObserver(frame); 2173 video_hole_frames_.RemoveObserver(frame);
2165 } 2174 }
2166 #endif // defined(VIDEO_HOLE) 2175 #endif // defined(VIDEO_HOLE)
2167 2176
2168 } // namespace content 2177 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_widget.h ('k') | content/shell/renderer/test_runner/web_test_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698