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

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: 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..d6a96786894923e103677380ae3b0c5668dd3196 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,22 @@ 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(SkColorSetARGBInline(255, 0, 0, 0));
dcheng 2016/03/09 21:06:24 Consider just using SK_ColorBLACK if that works.
lfg 2016/03/09 21:19:15 Done.
+
+ scoped_refptr<cc::PictureImageLayer> sad_layer =
+ cc::PictureImageLayer::Create(cc::LayerSettings());
+ SkBitmap* sad_bitmap = GetContentClient()->renderer()->GetSadWebViewBitmap();
+ 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((buffer_size_.width() - sad_bitmap->width()) / 2,
+ (buffer_size_.height() - sad_bitmap->height()) / 2));
kenrb 2016/03/09 17:58:37 I think this is right but I'm not 100% sure... bot
lfg 2016/03/09 20:17:45 Good catch. buffer_size_ is in DIPs, I switched to
+ sad_layer->SetIsDrawable(true);
+
+ crashed_layer->AddChild(sad_layer);
kenrb 2016/03/09 17:58:37 As discussed, we might want to not set this layer
Łukasz Anforowicz 2016/03/09 18:12:18 Can the iframe rect change its dimensions during t
lfg 2016/03/09 20:17:45 Done.
+
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