Chromium Code Reviews| 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) { |