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

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

Issue 1264593003: Explicitly enable StrictMode VM policies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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/init/ChromeBrowserInitializer.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/init/ChromeBrowserInitializer.java b/chrome/android/java/src/org/chromium/chrome/browser/init/ChromeBrowserInitializer.java
index 7d50c778d39500b3a21e03c18cb9256868af6fba..871f4cbd4fcd38f2911b0c7332a2a0e0ea41c493 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/init/ChromeBrowserInitializer.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/init/ChromeBrowserInitializer.java
@@ -274,18 +274,28 @@ public class ChromeBrowserInitializer {
|| "userdebug".equals(Build.TYPE)
|| commandLine.hasSwitch(ChromeSwitches.STRICT_MODE)) {
StrictMode.enableDefaults();
- StrictMode.ThreadPolicy.Builder policy =
+ StrictMode.ThreadPolicy.Builder threadPolicy =
new StrictMode.ThreadPolicy.Builder(StrictMode.getThreadPolicy());
- policy = policy.detectAll()
+ threadPolicy = threadPolicy.detectAll()
.penaltyFlashScreen()
.penaltyDeathOnNetwork();
+ /*
+ * Explicitly enable detection of all violations except file URI leaks, as that results
+ * in false positives when file URI intents are passed between Chrome activities in
+ * separate processes. See http://crbug.com/508282#c11.
+ */
+ StrictMode.VmPolicy.Builder vmPolicy = new StrictMode.VmPolicy.Builder();
+ vmPolicy = vmPolicy.detectActivityLeaks()
+ .detectLeakedClosableObjects()
+ .detectLeakedRegistrationObjects()
+ .detectLeakedSqlLiteObjects()
+ .penaltyLog();
if ("death".equals(commandLine.getSwitchValue(ChromeSwitches.STRICT_MODE))) {
- policy = policy.penaltyDeath();
- StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder(StrictMode.getVmPolicy())
- .penaltyDeath()
- .build());
+ threadPolicy = threadPolicy.penaltyDeath();
+ vmPolicy = vmPolicy.penaltyDeath();
}
- StrictMode.setThreadPolicy(policy.build());
+ StrictMode.setThreadPolicy(threadPolicy.build());
+ StrictMode.setVmPolicy(vmPolicy.build());
}
}
« 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