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

Unified Diff: content/renderer/browser_plugin/browser_plugin.cc

Issue 1784873003: Refactor BrowserPlugin to reuse sad bitmap from ChildFrameCompositingHelper. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: enable compositing 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 | « content/renderer/browser_plugin/browser_plugin.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/browser_plugin/browser_plugin.cc
diff --git a/content/renderer/browser_plugin/browser_plugin.cc b/content/renderer/browser_plugin/browser_plugin.cc
index 9a74b59ba05d2fd6e9c6ad7af88ee0704c8c5928..09f54d63d913f5472af7efdd3e54b9a5ec4af5f5 100644
--- a/content/renderer/browser_plugin/browser_plugin.cc
+++ b/content/renderer/browser_plugin/browser_plugin.cc
@@ -34,10 +34,8 @@
#include "third_party/WebKit/public/web/WebLocalFrame.h"
#include "third_party/WebKit/public/web/WebPluginContainer.h"
#include "third_party/WebKit/public/web/WebView.h"
-#include "third_party/skia/include/core/SkCanvas.h"
#include "ui/events/keycodes/keyboard_codes.h"
-using blink::WebCanvas;
using blink::WebPluginContainer;
using blink::WebPoint;
using blink::WebRect;
@@ -176,10 +174,6 @@ void BrowserPlugin::Detach() {
attached_ = false;
guest_crashed_ = false;
EnableCompositing(false);
- if (compositing_helper_.get()) {
- compositing_helper_->OnContainerDestroy();
- compositing_helper_ = nullptr;
- }
BrowserPluginManager::Get()->Send(
new BrowserPluginHostMsg_Detach(browser_plugin_instance_id_));
@@ -200,17 +194,8 @@ void BrowserPlugin::OnAdvanceFocus(int browser_plugin_instance_id,
void BrowserPlugin::OnGuestGone(int browser_plugin_instance_id) {
guest_crashed_ = true;
- // Turn off compositing so we can display the sad graphic. Changes to
- // compositing state will show up at a later time after a layout and commit.
- EnableCompositing(false);
-
- // Queue up showing the sad graphic to give content embedders an opportunity
- // to fire their listeners and potentially overlay the webview with custom
- // behavior. If the BrowserPlugin is destroyed in the meantime, then the
- // task will not be executed.
- base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::Bind(&BrowserPlugin::ShowSadGraphic,
- weak_ptr_factory_.GetWeakPtr()));
+ EnableCompositing(true);
+ compositing_helper_->ChildFrameGone();
}
void BrowserPlugin::OnSetCursor(int browser_plugin_instance_id,
@@ -253,13 +238,6 @@ void BrowserPlugin::OnShouldAcceptTouchEvents(int browser_plugin_instance_id,
}
}
-void BrowserPlugin::ShowSadGraphic() {
- // If the BrowserPlugin is scheduled to be deleted, then container_ will be
- // nullptr so we shouldn't attempt to access it.
- if (container_)
- container_->invalidate();
-}
-
void BrowserPlugin::UpdateInternalInstanceId() {
// This is a way to notify observers of our attributes that this plugin is
// available in render tree.
@@ -374,33 +352,6 @@ bool BrowserPlugin::canProcessDrag() const {
return true;
}
-void BrowserPlugin::paint(WebCanvas* canvas, const WebRect& rect) {
- if (guest_crashed_) {
- if (!sad_guest_) // Lazily initialize bitmap.
- sad_guest_ = GetContentClient()->renderer()->GetSadWebViewBitmap();
- // content_shell does not have the sad plugin bitmap, so we'll paint black
- // instead to make it clear that something went wrong.
- if (sad_guest_) {
- PaintSadPlugin(canvas, view_rect_, *sad_guest_);
- return;
- }
- }
- SkAutoCanvasRestore auto_restore(canvas, true);
- canvas->translate(view_rect_.x(), view_rect_.y());
- SkRect image_data_rect = SkRect::MakeXYWH(
- SkIntToScalar(0),
- SkIntToScalar(0),
- SkIntToScalar(view_rect_.width()),
- SkIntToScalar(view_rect_.height()));
- canvas->clipRect(image_data_rect);
- // Paint black or white in case we have nothing in our backing store or we
- // need to show a gutter.
- SkPaint paint;
- paint.setStyle(SkPaint::kFill_Style);
- paint.setColor(guest_crashed_ ? SK_ColorBLACK : SK_ColorWHITE);
- canvas->drawRect(image_data_rect, paint);
-}
-
// static
bool BrowserPlugin::ShouldForwardToBrowserPlugin(
const IPC::Message& message) {
« no previous file with comments | « content/renderer/browser_plugin/browser_plugin.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698