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

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

Issue 441343002: Revert 287747 "Make SingleThreadProxy a SchedulerClient" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: 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
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),
397 is_swapped_out_(swapped_out), 396 is_swapped_out_(swapped_out),
398 input_method_is_active_(false), 397 input_method_is_active_(false),
399 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), 398 text_input_type_(ui::TEXT_INPUT_TYPE_NONE),
400 text_input_mode_(ui::TEXT_INPUT_MODE_DEFAULT), 399 text_input_mode_(ui::TEXT_INPUT_MODE_DEFAULT),
401 can_compose_inline_(true), 400 can_compose_inline_(true),
402 popup_type_(popup_type), 401 popup_type_(popup_type),
403 pending_window_rect_count_(0), 402 pending_window_rect_count_(0),
404 suppress_next_char_events_(false), 403 suppress_next_char_events_(false),
405 screen_info_(screen_info), 404 screen_info_(screen_info),
406 device_scale_factor_(screen_info_.deviceScaleFactor), 405 device_scale_factor_(screen_info_.deviceScaleFactor),
(...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after
1190 } 1189 }
1191 1190
1192 void RenderWidget::AutoResizeCompositor() { 1191 void RenderWidget::AutoResizeCompositor() {
1193 physical_backing_size_ = gfx::ToCeiledSize(gfx::ScaleSize(size_, 1192 physical_backing_size_ = gfx::ToCeiledSize(gfx::ScaleSize(size_,
1194 device_scale_factor_)); 1193 device_scale_factor_));
1195 if (compositor_) 1194 if (compositor_)
1196 compositor_->setViewportSize(size_, physical_backing_size_); 1195 compositor_->setViewportSize(size_, physical_backing_size_);
1197 } 1196 }
1198 1197
1199 void RenderWidget::initializeLayerTreeView() { 1198 void RenderWidget::initializeLayerTreeView() {
1200 DCHECK(!host_closing_);
1201
1202 compositor_ = 1199 compositor_ =
1203 RenderWidgetCompositor::Create(this, IsThreadedCompositingEnabled()); 1200 RenderWidgetCompositor::Create(this, IsThreadedCompositingEnabled());
1204 compositor_->setViewportSize(size_, physical_backing_size_); 1201 compositor_->setViewportSize(size_, physical_backing_size_);
1205 if (init_complete_) 1202 if (init_complete_)
1206 StartCompositor(); 1203 StartCompositor();
1207 } 1204 }
1208 1205
1209 void RenderWidget::DestroyLayerTreeView() {
1210 // Always send this notification to prevent new layer tree views from
1211 // being created, even if one hasn't been created yet.
1212 webwidget_->willCloseLayerTreeView();
1213 compositor_.reset();
1214 }
1215
1216 blink::WebLayerTreeView* RenderWidget::layerTreeView() { 1206 blink::WebLayerTreeView* RenderWidget::layerTreeView() {
1217 return compositor_.get(); 1207 return compositor_.get();
1218 } 1208 }
1219 1209
1210 void RenderWidget::suppressCompositorScheduling(bool enable) {
1211 if (compositor_)
1212 compositor_->SetSuppressScheduleComposite(enable);
1213 }
1214
1220 void RenderWidget::willBeginCompositorFrame() { 1215 void RenderWidget::willBeginCompositorFrame() {
1221 TRACE_EVENT0("gpu", "RenderWidget::willBeginCompositorFrame"); 1216 TRACE_EVENT0("gpu", "RenderWidget::willBeginCompositorFrame");
1222 1217
1218 DCHECK(RenderThreadImpl::current()->compositor_message_loop_proxy().get());
1219
1223 // The following two can result in further layout and possibly 1220 // The following two can result in further layout and possibly
1224 // enable GPU acceleration so they need to be called before any painting 1221 // enable GPU acceleration so they need to be called before any painting
1225 // is done. 1222 // is done.
1226 UpdateTextInputState(NO_SHOW_IME, FROM_NON_IME); 1223 UpdateTextInputState(NO_SHOW_IME, FROM_NON_IME);
1227 UpdateSelectionBounds(); 1224 UpdateSelectionBounds();
1228 } 1225 }
1229 1226
1230 void RenderWidget::didBecomeReadyForAdditionalInput() { 1227 void RenderWidget::didBecomeReadyForAdditionalInput() {
1231 TRACE_EVENT0("renderer", "RenderWidget::didBecomeReadyForAdditionalInput"); 1228 TRACE_EVENT0("renderer", "RenderWidget::didBecomeReadyForAdditionalInput");
1232 FlushPendingInputEventAck(); 1229 FlushPendingInputEventAck();
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1369 SetPendingWindowRect(initial_pos_); 1366 SetPendingWindowRect(initial_pos_);
1370 } 1367 }
1371 1368
1372 void RenderWidget::didFocus() { 1369 void RenderWidget::didFocus() {
1373 } 1370 }
1374 1371
1375 void RenderWidget::didBlur() { 1372 void RenderWidget::didBlur() {
1376 } 1373 }
1377 1374
1378 void RenderWidget::DoDeferredClose() { 1375 void RenderWidget::DoDeferredClose() {
1379 // No more compositing is possible. This prevents shutdown races between
1380 // previously posted CreateOutputSurface tasks and the host being unable to
1381 // create them because the close message was handled.
1382 DestroyLayerTreeView();
1383 // Also prevent new compositors from being created.
1384 host_closing_ = true;
1385 Send(new ViewHostMsg_Close(routing_id_)); 1376 Send(new ViewHostMsg_Close(routing_id_));
1386 } 1377 }
1387 1378
1388 void RenderWidget::closeWidgetSoon() { 1379 void RenderWidget::closeWidgetSoon() {
1389 if (is_swapped_out_) { 1380 if (is_swapped_out_) {
1390 // This widget is currently swapped out, and the active widget is in a 1381 // This widget is currently swapped out, and the active widget is in a
1391 // different process. Have the browser route the close request to the 1382 // different process. Have the browser route the close request to the
1392 // active widget instead, so that the correct unload handlers are run. 1383 // active widget instead, so that the correct unload handlers are run.
1393 Send(new ViewHostMsg_RouteCloseEvent(routing_id_)); 1384 Send(new ViewHostMsg_RouteCloseEvent(routing_id_));
1394 return; 1385 return;
(...skipping 20 matching lines...) Expand all
1415 1406
1416 SyntheticGesturePacket gesture_packet; 1407 SyntheticGesturePacket gesture_packet;
1417 gesture_packet.set_gesture_params(gesture_params.Pass()); 1408 gesture_packet.set_gesture_params(gesture_params.Pass());
1418 1409
1419 Send(new InputHostMsg_QueueSyntheticGesture(routing_id_, gesture_packet)); 1410 Send(new InputHostMsg_QueueSyntheticGesture(routing_id_, gesture_packet));
1420 } 1411 }
1421 1412
1422 void RenderWidget::Close() { 1413 void RenderWidget::Close() {
1423 screen_metrics_emulator_.reset(); 1414 screen_metrics_emulator_.reset();
1424 if (webwidget_) { 1415 if (webwidget_) {
1425 DestroyLayerTreeView(); 1416 webwidget_->willCloseLayerTreeView();
1417 compositor_.reset();
1426 webwidget_->close(); 1418 webwidget_->close();
1427 webwidget_ = NULL; 1419 webwidget_ = NULL;
1428 } 1420 }
1429 } 1421 }
1430 1422
1431 WebRect RenderWidget::windowRect() { 1423 WebRect RenderWidget::windowRect() {
1432 if (pending_window_rect_count_) 1424 if (pending_window_rect_count_)
1433 return pending_window_rect_; 1425 return pending_window_rect_;
1434 1426
1435 return view_screen_rect_; 1427 return view_screen_rect_;
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after
2158 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { 2150 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) {
2159 video_hole_frames_.AddObserver(frame); 2151 video_hole_frames_.AddObserver(frame);
2160 } 2152 }
2161 2153
2162 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { 2154 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) {
2163 video_hole_frames_.RemoveObserver(frame); 2155 video_hole_frames_.RemoveObserver(frame);
2164 } 2156 }
2165 #endif // defined(VIDEO_HOLE) 2157 #endif // defined(VIDEO_HOLE)
2166 2158
2167 } // namespace content 2159 } // namespace content
OLDNEW
« no previous file with comments | « trunk/src/content/renderer/render_widget.h ('k') | trunk/src/content/shell/renderer/test_runner/web_test_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698