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

Unified Diff: android_webview/java/src/org/chromium/android_webview/crash/SynchronizedWebViewCommandLine.java

Issue 2628863004: [Android WebView] Ensure we have user consent before uploading minidumps (Closed)
Patch Set: Check user consent before copying minidumps, delete minidumps in app dir if no consent, add unit te… Created 3 years, 11 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
Index: android_webview/java/src/org/chromium/android_webview/crash/SynchronizedWebViewCommandLine.java
diff --git a/android_webview/java/src/org/chromium/android_webview/crash/SynchronizedWebViewCommandLine.java b/android_webview/java/src/org/chromium/android_webview/crash/SynchronizedWebViewCommandLine.java
index 27331a89ab9eb92b3ea300b7a7a6f0d829377db8..0d8c86747cc0d8f1bf3e06951d91b7e169dc91f7 100644
--- a/android_webview/java/src/org/chromium/android_webview/crash/SynchronizedWebViewCommandLine.java
+++ b/android_webview/java/src/org/chromium/android_webview/crash/SynchronizedWebViewCommandLine.java
@@ -4,6 +4,7 @@
package org.chromium.android_webview.crash;
+import org.chromium.android_webview.command_line.CommandLineUtil;
import org.chromium.base.CommandLine;
import org.chromium.base.annotations.SuppressFBWarnings;
@@ -13,17 +14,20 @@ import org.chromium.base.annotations.SuppressFBWarnings;
class SynchronizedWebViewCommandLine {
private static final Object sLock = new Object();
private static InitState sInitialized = InitState.NOT_STARTED;
- // TODO(gsennton): this value is used in WebViewChromiumFactoryProvider as well - set it
- // somewhere where it can be read from both classes.
- private static final String WEBVIEW_COMMAND_LINE_FILE = "/data/local/tmp/webview-command-line";
private enum InitState { NOT_STARTED, STARTED, DONE }
+ private SynchronizedWebViewCommandLine() {}
+
+ public static SynchronizedWebViewCommandLine getInstance() {
+ return new SynchronizedWebViewCommandLine();
sgurun-gerrit only 2017/01/24 08:58:49 why is it necessary to be able to create different
gsennton 2017/01/24 10:41:48 To be able to mock the behaviour of SynchronizedWe
+ }
+
/**
* Initialize the global CommandLine using the WebView command line file.
* This method includes IO operations - it shouldn't be performed on the main thread.
*/
- public static void initOnSeparateThread() {
+ public void initOnSeparateThread() {
synchronized (sLock) {
if (sInitialized != InitState.NOT_STARTED) return;
sInitialized = InitState.STARTED;
@@ -32,7 +36,12 @@ class SynchronizedWebViewCommandLine {
@SuppressFBWarnings("DMI_HARDCODED_ABSOLUTE_FILENAME")
@Override
public void run() {
- CommandLine.initFromFile(WEBVIEW_COMMAND_LINE_FILE);
+ // Only read command line flags if the device is debuggable.
+ if (CommandLineUtil.isBuildDebuggable()) {
+ CommandLine.initFromFile(CommandLineUtil.WEBVIEW_COMMAND_LINE_FILE);
+ } else {
+ CommandLine.init(null);
+ }
synchronized (sLock) {
sInitialized = InitState.DONE;
sLock.notifyAll();
@@ -44,7 +53,7 @@ class SynchronizedWebViewCommandLine {
/**
* Returns true if this command line contains the given switch.
*/
- public static boolean hasSwitch(String switchString) {
+ public boolean hasSwitch(String switchString) {
synchronized (sLock) {
while (sInitialized != InitState.DONE) {
try {

Powered by Google App Engine
This is Rietveld 408576698