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

Unified Diff: services/shape_detection/android/java/src/org/chromium/shape_detection/SharedBufferUtils.java

Issue 2873093003: Shape Detection Android: unmap() and close() SharedBufferHandles explicitly (Closed)
Patch Set: Created 3 years, 7 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: services/shape_detection/android/java/src/org/chromium/shape_detection/SharedBufferUtils.java
diff --git a/services/shape_detection/android/java/src/org/chromium/shape_detection/SharedBufferUtils.java b/services/shape_detection/android/java/src/org/chromium/shape_detection/SharedBufferUtils.java
index 807b18d646376bab51b5cac4819a98c74ffd8126..9112e265a6b93175b4038a6efa9a69a569561f92 100644
--- a/services/shape_detection/android/java/src/org/chromium/shape_detection/SharedBufferUtils.java
+++ b/services/shape_detection/android/java/src/org/chromium/shape_detection/SharedBufferUtils.java
@@ -8,6 +8,7 @@ import android.graphics.Bitmap;
import com.google.android.gms.vision.Frame;
+import org.chromium.mojo.system.MojoException;
import org.chromium.mojo.system.SharedBufferHandle;
import org.chromium.mojo.system.SharedBufferHandle.MapFlags;
@@ -35,6 +36,11 @@ public class SharedBufferUtils {
Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
bitmap.copyPixelsFromBuffer(imageBuffer);
+ try {
Ken Rockot(use gerrit already) 2017/05/11 15:42:07 My Mojo-Java-fu is weak. Why is this wrapped in a
mcasas 2017/05/11 16:02:48 In Java-land, if it can throw, we have to catch it
+ frameData.unmap(imageBuffer);
+ frameData.close();
+ } catch (MojoException e) {
+ }
try {
// This constructor implies a pixel format conversion to YUV.
« 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