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

Unified Diff: content/renderer/child_frame_compositing_helper.cc

Issue 1775303003: Display appropriate graphic for crashed out-of-process iframe. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sad_bitmap is not available in content_shell, only paint a black frame in that case Created 4 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/child_frame_compositing_helper.cc
diff --git a/content/renderer/child_frame_compositing_helper.cc b/content/renderer/child_frame_compositing_helper.cc
index 2392e7b9aa7612ff922856138b4a102a1748252d..e5ee906baaacd0fa22804614131f05c118942d67 100644
--- a/content/renderer/child_frame_compositing_helper.cc
+++ b/content/renderer/child_frame_compositing_helper.cc
@@ -8,6 +8,7 @@
#include "cc/blink/web_layer_impl.h"
#include "cc/layers/layer_settings.h"
+#include "cc/layers/picture_image_layer.h"
#include "cc/layers/solid_color_layer.h"
#include "cc/layers/surface_layer.h"
#include "cc/output/context_provider.h"
@@ -19,6 +20,8 @@
#include "content/common/content_switches_internal.h"
#include "content/common/frame_messages.h"
#include "content/common/gpu/client/context_provider_command_buffer.h"
+#include "content/public/common/content_client.h"
+#include "content/public/renderer/content_renderer_client.h"
#include "content/renderer/browser_plugin/browser_plugin.h"
#include "content/renderer/browser_plugin/browser_plugin_manager.h"
#include "content/renderer/render_frame_impl.h"
@@ -28,6 +31,9 @@
#include "third_party/WebKit/public/web/WebFrame.h"
#include "third_party/WebKit/public/web/WebPluginContainer.h"
#include "third_party/khronos/GLES2/gl2.h"
+#include "third_party/skia/include/core/SkBitmap.h"
+#include "third_party/skia/include/core/SkImage.h"
+#include "ui/gfx/geometry/point_f.h"
#include "ui/gfx/geometry/size_conversions.h"
#include "ui/gfx/skia_util.h"
@@ -115,7 +121,29 @@ void ChildFrameCompositingHelper::ChildFrameGone() {
scoped_refptr<cc::SolidColorLayer> crashed_layer =
cc::SolidColorLayer::Create(cc::LayerSettings());
crashed_layer->SetMasksToBounds(true);
- crashed_layer->SetBackgroundColor(SkColorSetARGBInline(255, 0, 128, 0));
+ crashed_layer->SetBackgroundColor(SK_ColorBLACK);
+
+ if (web_layer_) {
+ SkBitmap* sad_bitmap =
+ GetContentClient()->renderer()->GetSadWebViewBitmap();
+ if (sad_bitmap && web_layer_->bounds().width > sad_bitmap->width() &&
+ web_layer_->bounds().height > sad_bitmap->height()) {
+ scoped_refptr<cc::PictureImageLayer> sad_layer =
+ cc::PictureImageLayer::Create(cc::LayerSettings());
+ skia::RefPtr<SkImage> image =
+ skia::AdoptRef(SkImage::NewFromBitmap(*sad_bitmap));
+ sad_layer->SetImage(image);
+ sad_layer->SetBounds(
+ gfx::Size(sad_bitmap->width(), sad_bitmap->height()));
+ sad_layer->SetPosition(gfx::PointF(
+ (web_layer_->bounds().width - sad_bitmap->width()) / 2,
+ (web_layer_->bounds().height - sad_bitmap->height()) / 2));
+ sad_layer->SetIsDrawable(true);
+
+ crashed_layer->AddChild(sad_layer);
+ }
+ }
+
blink::WebLayer* layer = new cc_blink::WebLayerImpl(crashed_layer);
UpdateWebLayer(layer);
}
« 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