Bug 1419351 - Handle OOM failure when locking AndroidNativeWindowTextureData. r?snorp
MozReview-Commit-ID: KMCCukiGWID
--- a/gfx/layers/opengl/TextureClientOGL.cpp
+++ b/gfx/layers/opengl/TextureClientOGL.cpp
@@ -181,19 +181,20 @@ AndroidNativeWindowTextureData::Serializ
bool
AndroidNativeWindowTextureData::Lock(OpenMode)
{
// ANativeWindows can only be locked and unlocked a single time, after which
// we must wait until they receive ownership back from the host.
// Therefore we must only actually call ANativeWindow_lock() once per cycle.
if (!mIsLocked) {
int32_t r = ANativeWindow_lock(mNativeWindow, &mBuffer, nullptr);
- if (r < 0) {
- MOZ_CRASH("ANativeWindow_lock failed\n.");
+ if (r == -ENOMEM) {
return false;
+ } else if (r < 0) {
+ MOZ_CRASH("ANativeWindow_lock failed.");
}
mIsLocked = true;
}
return true;
}
void
AndroidNativeWindowTextureData::Unlock()