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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/util/IntentUtils.java

Issue 2405983002: Catch TransactionTooLargeException in another case. (Closed)
Patch Set: Moved to ExternalNavigationHandler Created 4 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.chrome.browser.util; 5 package org.chromium.chrome.browser.util;
6 6
7 import android.content.ActivityNotFoundException; 7 import android.content.ActivityNotFoundException;
8 import android.content.Context; 8 import android.content.Context;
9 import android.content.Intent; 9 import android.content.Intent;
10 import android.os.Binder; 10 import android.os.Binder;
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 /** 342 /**
343 * Determines if an Intent's size is bigger than a reasonable threshold. Ha ving too many large 343 * Determines if an Intent's size is bigger than a reasonable threshold. Ha ving too many large
344 * transactions in flight simultaneously (including Intents) causes Android to throw a 344 * transactions in flight simultaneously (including Intents) causes Android to throw a
345 * {@link TransactionTooLargeException}. According to that class, the limit across all 345 * {@link TransactionTooLargeException}. According to that class, the limit across all
346 * transactions combined is one megabyte. Best practice is to keep each ind ividual Intent well 346 * transactions combined is one megabyte. Best practice is to keep each ind ividual Intent well
347 * under the limit to avoid this situation. 347 * under the limit to avoid this situation.
348 */ 348 */
349 public static boolean isIntentTooLarge(Intent intent) { 349 public static boolean isIntentTooLarge(Intent intent) {
350 return getParceledIntentSize(intent) > MAX_INTENT_SIZE_THRESHOLD; 350 return getParceledIntentSize(intent) > MAX_INTENT_SIZE_THRESHOLD;
351 } 351 }
352
353 /**
354 * Given an exception, check whether it wrapped a {@link TransactionTooLarge Exception}. If it
355 * does, then log the underlying error. If not, throw the original exceptio n again.
356 *
357 * @param e The caught RuntimeException.
358 * @param intent The intent that triggered the RuntimeException to be thrown .
359 */
360 public static void logTransactionTooLargeOrRethrow(RuntimeException e, Inten t intent) {
361 // See http://crbug.com/369574.
362 if (e.getCause() instanceof TransactionTooLargeException) {
363 Log.e(TAG, "Could not resolve Activity for intent " + intent.toStrin g(), e);
364 } else {
365 throw e;
366 }
367 }
352 } 368 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698