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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java

Issue 2435403002: customtabs: Access the throttling shared preferences from warmup(). (Closed)
Patch Set: 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 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/customtabs/CustomTabsConnection.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java
index 99fb999e82a531c22642077622bc607d40ad8bb4..f2694e7627cb265a30ad6f42815e97692579968c 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java
@@ -233,6 +233,7 @@ public class CustomTabsConnection {
if (!isCallerForegroundOrSelf()) return false;
mClientManager.recordUidHasCalledWarmup(Binder.getCallingUid());
final boolean initialized = !mWarmupHasBeenCalled.compareAndSet(false, true);
+ final int uid = Binder.getCallingUid();
// The call is non-blocking and this must execute on the UI thread, post a task.
ThreadUtils.postOnUiThread(new Runnable() {
@Override
@@ -241,6 +242,10 @@ public class CustomTabsConnection {
if (mayCreateSpareWebContents && mSpeculation == null
&& !SysUtils.isLowEndDevice()) {
WarmupManager.getInstance().createSpareWebContents();
+ // The throttling database uses shared preferences, that can cause a StrictMode
+ // violation on the first access. Make sure that this access is not in
+ // mayLauchUrl.
+ RequestThrottler.getForUid(mApplication, uid);
}
mWarmupHasBeenFinished.set(true);
}
« 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