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

Unified Diff: components/plugins/renderer/webview_plugin.cc

Issue 1677063004: Don't allow dirtying layout during paint of a plugin placeholder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 | « components/plugins/renderer/webview_plugin.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/plugins/renderer/webview_plugin.cc
diff --git a/components/plugins/renderer/webview_plugin.cc b/components/plugins/renderer/webview_plugin.cc
index 995ff09bcff0f2cb0ae812f3dd4bd43979a69c86..a3270087e1434818ea5b902784560a7c407768c3 100644
--- a/components/plugins/renderer/webview_plugin.cc
+++ b/components/plugins/renderer/webview_plugin.cc
@@ -6,6 +6,7 @@
#include <stddef.h>
+#include "base/auto_reset.h"
#include "base/message_loop/message_loop.h"
#include "base/metrics/histogram_macros.h"
#include "base/numerics/safe_conversions.h"
@@ -55,7 +56,8 @@ WebViewPlugin::WebViewPlugin(content::RenderView* render_view,
container_(nullptr),
web_view_(WebView::create(this)),
finished_loading_(false),
- focused_(false) {
+ focused_(false),
+ is_painting_(false) {
// ApplyWebPreferences before making a WebLocalFrame so that the frame sees a
// consistent view of our preferences.
content::RenderView::ApplyWebPreferences(preferences, web_view_);
@@ -172,6 +174,9 @@ void WebViewPlugin::paint(WebCanvas* canvas, const WebRect& rect) {
if (paint_rect.IsEmpty())
return;
+ base::AutoReset<bool> is_painting(
+ &is_painting_, true);
+
paint_rect.Offset(-rect_.x(), -rect_.y());
canvas->save();
@@ -288,8 +293,14 @@ void WebViewPlugin::didChangeCursor(const WebCursorInfo& cursor) {
}
void WebViewPlugin::scheduleAnimation() {
- if (container_)
+ if (container_) {
+ DCHECK(!is_painting_);
tommycli 2016/02/08 23:09:04 Don't only CHECKs show up in crashes? Not sure, ju
chrishtr 2016/02/08 23:13:56 CHECK will crash in production, DCHECK in debug bu
+ // This should never happen, but adding this code to see if it affects
+ /// crashes observed in crbug.com/545039.
+ if (is_painting_)
+ return;
container_->setNeedsLayout();
+ }
}
void WebViewPlugin::didClearWindowObject(WebLocalFrame* frame) {
« no previous file with comments | « components/plugins/renderer/webview_plugin.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698