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

Unified Diff: content/renderer/gpu/render_widget_compositor.cc

Issue 1038133003: Fix crash in taking a screenshot of a closed popup (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add brackets; improve comments Created 5 years, 9 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/gpu/render_widget_compositor.cc
diff --git a/content/renderer/gpu/render_widget_compositor.cc b/content/renderer/gpu/render_widget_compositor.cc
index 56e655c833d3b50b91df83e730f706f82d5756d5..611ed022694a8a06df51fc62b6d9de1e088097c0 100644
--- a/content/renderer/gpu/render_widget_compositor.cc
+++ b/content/renderer/gpu/render_widget_compositor.cc
@@ -705,8 +705,8 @@ void RenderWidgetCompositor::compositeAndReadbackAsync(
cc::CopyOutputRequest::CreateBitmapRequest(
base::Bind(&CompositeAndReadbackAsyncCallback, callback));
// Force a commit to happen. The temporary copy output request will
- // be installed after layout which will happen as a part of the commit, when
- // there is guaranteed to be a root layer.
+ // be installed after layout which will happen as a part of the commit, for
+ // widgets that delay the creation of their output surface.
bool threaded = !!compositor_deps_->GetCompositorImplThreadTaskRunner().get();
if (!threaded &&
!layer_tree_host_->settings().single_thread_proxy_scheduler) {
@@ -798,9 +798,14 @@ void RenderWidgetCompositor::Layout() {
widget_->webwidget()->layout();
if (temporary_copy_output_request_) {
- DCHECK(layer_tree_host_->root_layer());
- layer_tree_host_->root_layer()->RequestCopyOfOutput(
- temporary_copy_output_request_.Pass());
+ // For WebViewImpl, this will always have a root layer. For other widgets,
+ // the widget may be closed before servicing this request, so ignore it.
+ if (cc::Layer* root_layer = layer_tree_host_->root_layer()) {
+ root_layer->RequestCopyOfOutput(temporary_copy_output_request_.Pass());
+ } else {
+ temporary_copy_output_request_->SendEmptyResult();
+ temporary_copy_output_request_ = nullptr;
+ }
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698