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

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

Issue 2355263002: android: Allow disk reads for layout inflation. (Closed)
Patch Set: . Created 4 years, 3 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/WarmupManager.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/WarmupManager.java b/chrome/android/java/src/org/chromium/chrome/browser/WarmupManager.java
index 3f4d6994c884318d725fc9a15a3758741a7bb5fb..8fb303b93b95437a8797b1521155de31123429dd 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/WarmupManager.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/WarmupManager.java
@@ -6,6 +6,7 @@ package org.chromium.chrome.browser;
import android.content.Context;
import android.os.AsyncTask;
+import android.os.StrictMode;
import android.view.ContextThemeWrapper;
import android.view.InflateException;
import android.view.LayoutInflater;
@@ -71,6 +72,10 @@ public final class WarmupManager {
*/
public void initializeViewHierarchy(Context baseContext, int toolbarContainerId) {
TraceEvent.begin("WarmupManager.initializeViewHierarchy");
+ // Inflating the view hierarchy causes StrictMode violations on some
+ // devices. Since layout inflation should happen on the UI thread, allow
+ // the disk reads. crbug.com/644243.
+ StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads();
try {
ThreadUtils.assertOnUiThread();
if (mMainView != null && mToolbarContainerId == toolbarContainerId) return;
@@ -90,6 +95,7 @@ public final class WarmupManager {
Log.e(TAG, "Inflation exception.", e);
mMainView = null;
} finally {
+ StrictMode.setThreadPolicy(oldPolicy);
TraceEvent.end("WarmupManager.initializeViewHierarchy");
}
}
« 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