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

Unified Diff: Source/platform/graphics/Canvas2DLayerBridge.cpp

Issue 186023003: Speculative fix for crash in Canvas2DLayerBridge::freeReleasedMailbox (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/graphics/Canvas2DLayerBridge.cpp
diff --git a/Source/platform/graphics/Canvas2DLayerBridge.cpp b/Source/platform/graphics/Canvas2DLayerBridge.cpp
index e54518de3c4a8183ec47ce3359cb36f703f083da..9cfc29863e97b225f39f2aa020f555d16b96546d 100644
--- a/Source/platform/graphics/Canvas2DLayerBridge.cpp
+++ b/Source/platform/graphics/Canvas2DLayerBridge.cpp
@@ -37,6 +37,7 @@
#include "public/platform/WebCompositorSupport.h"
#include "public/platform/WebGraphicsContext3D.h"
#include "public/platform/WebGraphicsContext3DProvider.h"
+#include "wtf/MainThread.h"
#include "wtf/RefCountedLeakCounter.h"
using blink::WebExternalTextureLayer;
@@ -287,6 +288,8 @@ bool Canvas2DLayerBridge::hasReleasedMailbox() const
void Canvas2DLayerBridge::freeReleasedMailbox()
{
+ if (!isValid())
+ return;
MailboxInfo* mailboxInfo = releasedMailboxInfo();
if (!mailboxInfo)
return;
@@ -321,8 +324,12 @@ blink::WebGraphicsContext3D* Canvas2DLayerBridge::context()
bool Canvas2DLayerBridge::isValid()
{
ASSERT(m_layer);
- if (m_destructionInProgress)
+ ASSERT(isMainThread());
+ // guard against reentry
+ static bool inIsValid = false;
+ if (inIsValid || m_destructionInProgress)
return false;
+ inIsValid = true;
if (m_contextProvider->context3d()->isContextLost() || !m_surfaceIsValid) {
// Attempt to recover.
Stephen White 2014/03/03 21:43:11 Maybe we should just not be doing context recovery
blink::WebGraphicsContext3D* sharedContext = 0;
@@ -351,6 +358,7 @@ bool Canvas2DLayerBridge::isValid()
}
if (!m_surfaceIsValid)
setRateLimitingEnabled(false);
+ inIsValid = false;
return m_surfaceIsValid;
}
« 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