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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/photo_picker/DecoderServiceHost.java

Issue 2953573002: Photo Picker dialog: Fix possible crash in closeRequest when decoding fails. (Closed)
Patch Set: Fix Created 3 years, 6 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: chrome/android/java/src/org/chromium/chrome/browser/photo_picker/DecoderServiceHost.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/photo_picker/DecoderServiceHost.java b/chrome/android/java/src/org/chromium/chrome/browser/photo_picker/DecoderServiceHost.java
index e5cf11c0f56eff54e0fa97d7b8a32f18e8bf22ff..6ac41648716a763fabbdbb9cb13f4873b4d0f1b0 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/photo_picker/DecoderServiceHost.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/photo_picker/DecoderServiceHost.java
@@ -18,6 +18,7 @@ import android.os.ParcelFileDescriptor;
import android.os.RemoteException;
import android.os.StrictMode;
import android.os.SystemClock;
+import android.support.annotation.Nullable;
import org.chromium.base.Log;
import org.chromium.base.metrics.RecordHistogram;
@@ -186,10 +187,10 @@ public class DecoderServiceHost {
* decoding process back to the client, and takes care of house-keeping chores regarding
* the request queue).
* @param filePath The path to the image that was just decoded.
- * @param bitmap The resulting decoded bitmap.
+ * @param bitmap The resulting decoded bitmap, or null if decoding fails.
* @param decodeTime The length of time it took to decode the bitmap.
*/
- public void closeRequest(String filePath, Bitmap bitmap, long decodeTime) {
+ public void closeRequest(String filePath, @Nullable Bitmap bitmap, long decodeTime) {
DecoderServiceParams params = getRequests().get(filePath);
if (params != null) {
long endRpcCall = SystemClock.elapsedRealtime();
@@ -198,7 +199,7 @@ public class DecoderServiceHost {
params.mCallback.imageDecodedCallback(filePath, bitmap);
- if (decodeTime != -1) {
+ if (decodeTime != -1 && bitmap != null) {
RecordHistogram.recordTimesHistogram(
"Android.PhotoPicker.ImageDecodeTime", decodeTime, TimeUnit.MILLISECONDS);
« 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