Bug 1401002 - [3.1] Add GeckoView setting for application data directories. r=jchen

This commit is contained in:
Eugen Sawin 2017-09-26 00:27:09 +02:00
parent 3b7b1e8565
commit 8d6bc8fb3e
2 changed files with 25 additions and 0 deletions

View File

@ -496,6 +496,9 @@ public class GeckoView extends LayerView {
} else {
mSettings = settings;
}
mSettings.setString(GeckoViewSettings.DEBUGGER_SOCKET_DIR,
context.getApplicationInfo().dataDir);
}
@Override

View File

@ -68,6 +68,9 @@ public final class GeckoViewSettings {
public static final Key<Boolean> USE_REMOTE_DEBUGGER =
new Key<Boolean>("useRemoteDebugger");
public static final Key<String> DEBUGGER_SOCKET_DIR =
new Key<String>("debuggerSocketDir");
private final EventDispatcher mEventDispatcher;
private final GeckoBundle mBundle;
@ -84,6 +87,8 @@ public final class GeckoViewSettings {
setBoolean(USE_MULTIPROCESS, true);
setInt(DISPLAY_MODE, DisplayMode.BROWSER.value());
setBoolean(USE_REMOTE_DEBUGGER, false);
// Set in GeckoView.init().
setString(DEBUGGER_SOCKET_DIR, "");
}
/* package */ GeckoViewSettings(GeckoViewSettings settings, EventDispatcher eventDispatcher) {
@ -125,6 +130,23 @@ public final class GeckoViewSettings {
}
}
public void setString(final Key<String> key, final String value) {
synchronized (mBundle) {
final Object old = mBundle.get(key.text);
if (old != null && old.equals(value)) {
return;
}
mBundle.putString(key.text, value);
}
dispatchUpdate();
}
public String getString(final Key<String> key) {
synchronized (mBundle) {
return mBundle.getString(key.text);
}
}
/* package */ GeckoBundle asBundle() {
return mBundle;
}