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

Unified 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_widget.cc
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index ef30ede736cadf20c4d54550b351d73f85c0aa7d..b11b11c135b22b15292396edcfe72bc767ee33f3 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -393,6 +393,7 @@ RenderWidget::RenderWidget(blink::WebPopupType popup_type,
handling_event_type_(WebInputEvent::Undefined),
ignore_ack_for_mouse_move_from_debugger_(false),
closing_(false),
+ host_closing_(false),
is_swapped_out_(swapped_out),
input_method_is_active_(false),
text_input_type_(ui::TEXT_INPUT_TYPE_NONE),
@@ -1199,6 +1200,8 @@ void RenderWidget::AutoResizeCompositor() {
}
void RenderWidget::initializeLayerTreeView() {
+ DCHECK(!host_closing_);
+
compositor_ =
RenderWidgetCompositor::Create(this, IsThreadedCompositingEnabled());
compositor_->setViewportSize(size_, physical_backing_size_);
@@ -1206,20 +1209,21 @@ void RenderWidget::initializeLayerTreeView() {
StartCompositor();
}
-blink::WebLayerTreeView* RenderWidget::layerTreeView() {
- return compositor_.get();
+void RenderWidget::DestroyLayerTreeView() {
+ // Always send this notification to prevent new layer tree views from
+ // being created, even if one hasn't been created yet.
+ if (webwidget_)
+ webwidget_->willCloseLayerTreeView();
+ compositor_.reset();
}
-void RenderWidget::suppressCompositorScheduling(bool enable) {
- if (compositor_)
- compositor_->SetSuppressScheduleComposite(enable);
+blink::WebLayerTreeView* RenderWidget::layerTreeView() {
+ return compositor_.get();
}
void RenderWidget::willBeginCompositorFrame() {
TRACE_EVENT0("gpu", "RenderWidget::willBeginCompositorFrame");
- DCHECK(RenderThreadImpl::current()->compositor_message_loop_proxy().get());
-
// The following two can result in further layout and possibly
// enable GPU acceleration so they need to be called before any painting
// is done.
@@ -1376,6 +1380,12 @@ void RenderWidget::didBlur() {
}
void RenderWidget::DoDeferredClose() {
+ // No more compositing is possible. This prevents shutdown races between
+ // previously posted CreateOutputSurface tasks and the host being unable to
+ // create them because the close message was handled.
+ DestroyLayerTreeView();
+ // Also prevent new compositors from being created.
+ host_closing_ = true;
Send(new ViewHostMsg_Close(routing_id_));
}
@@ -1415,9 +1425,8 @@ void RenderWidget::QueueSyntheticGesture(
void RenderWidget::Close() {
screen_metrics_emulator_.reset();
+ DestroyLayerTreeView();
if (webwidget_) {
- webwidget_->willCloseLayerTreeView();
- compositor_.reset();
webwidget_->close();
webwidget_ = NULL;
}
« 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