Bug 1419351 - Handle OOM failure when locking AndroidNativeWindowTextureData. r?snorp draft
authorJamie Nicol <jnicol@mozilla.com>
Tue, 21 Nov 2017 10:50:16 +0000
changeset 701268 9993829e85e601a920bfa2f5d093d42ea8755c84
parent 701250 72ee4800d4156931c89b58bd807af4a3083702bb
child 741129 fdc76ac1b119927b271907598800a9f4443ca59f
push id90118
push userbmo:jnicol@mozilla.com
push dateTue, 21 Nov 2017 12:45:48 +0000
reviewerssnorp
bugs1419351
milestone59.0a1
Bug 1419351 - Handle OOM failure when locking AndroidNativeWindowTextureData. r?snorp MozReview-Commit-ID: KMCCukiGWID
gfx/layers/opengl/TextureClientOGL.cpp
--- 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()