Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Enable e10s by default. Fixes #451 (#2197)
Browse files Browse the repository at this point in the history
  • Loading branch information
bluemarvin authored and MortimerGoro committed Nov 14, 2019
1 parent 5910341 commit 3b25125
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ void loadFromIntent(final Intent intent) {
boolean enabled = extras.getBoolean("e10s", wasEnabled);
if (wasEnabled != enabled) {
SettingsStore.getInstance(this).setMultiprocessEnabled(enabled);
SessionStore.get().setMultiprocess(enabled);
SessionStore.get().resetMultiprocess();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ SettingsStore getInstance(final @NonNull Context aContext) {
public final static boolean REMOTE_DEBUGGING_DEFAULT = false;
public final static boolean CONSOLE_LOGS_DEFAULT = false;
public final static boolean ENV_OVERRIDE_DEFAULT = false;
public final static boolean MULTIPROCESS_DEFAULT = false;
public final static boolean MULTIPROCESS_DEFAULT = true;
public final static boolean PERFORMANCE_MONITOR_DEFAULT = true;
public final static boolean DRM_PLAYBACK_DEFAULT = false;
public final static boolean TRACKING_DEFAULT = true;
Expand Down Expand Up @@ -225,12 +225,12 @@ public void setEnvironmentOverrideEnabled(boolean isEnabled) {

public boolean isMultiprocessEnabled() {
return mPrefs.getBoolean(
mContext.getString(R.string.settings_key_multiprocess), MULTIPROCESS_DEFAULT);
mContext.getString(R.string.settings_key_multiprocess_e10s), MULTIPROCESS_DEFAULT);
}

public void setMultiprocessEnabled(boolean isEnabled) {
SharedPreferences.Editor editor = mPrefs.edit();
editor.putBoolean(mContext.getString(R.string.settings_key_multiprocess), isEnabled);
editor.putBoolean(mContext.getString(R.string.settings_key_multiprocess_e10s), isEnabled);
editor.commit();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ private SessionState createSession(@NonNull SessionSettings aSettings, @SessionO

private GeckoSession createGeckoSession(@NonNull SessionSettings aSettings) {
GeckoSessionSettings geckoSettings = new GeckoSessionSettings.Builder()
.useMultiprocess(aSettings.isMultiprocessEnabled())
.useMultiprocess(SettingsStore.getInstance(mContext).isMultiprocessEnabled())
.usePrivateMode(mUsePrivateMode)
.useTrackingProtection(aSettings.isTrackingProtectionEnabled())
.userAgentMode(aSettings.getUserAgentMode())
Expand Down Expand Up @@ -743,11 +743,8 @@ public void setUaMode(int mode) {
mState.mSession.loadUri(overrideUri != null ? overrideUri : mState.mUri, GeckoSession.LOAD_FLAGS_BYPASS_CACHE | GeckoSession.LOAD_FLAGS_REPLACE_HISTORY);
}

protected void setMultiprocess(final boolean aEnabled) {
if (mState.mSettings.isMultiprocessEnabled() != aEnabled) {
mState.mSettings.setMultiprocessEnabled(aEnabled);
recreateSession();
}
protected void resetMultiprocess() {
recreateSession();
}

protected void setTrackingProtection(final boolean aEnabled) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

class SessionSettings {

private boolean isMultiprocessEnabled;
private boolean isTrackingProtectionEnabled;
private boolean isSuspendMediaWhenInactiveEnabled;
private int userAgentMode;
Expand All @@ -17,7 +16,6 @@ class SessionSettings {
private String userAgentOverride;

private SessionSettings(@NotNull Builder builder) {
this.isMultiprocessEnabled = builder.isMultiprocessEnabled;
this.isTrackingProtectionEnabled = builder.isTrackingProtectionEnabled;
this.isSuspendMediaWhenInactiveEnabled = builder.isSuspendMediaWhenInactiveEnabled;
this.userAgentMode = builder.userAgentMode;
Expand All @@ -26,14 +24,6 @@ private SessionSettings(@NotNull Builder builder) {
this.userAgentOverride = builder.userAgentOverride;
}

public boolean isMultiprocessEnabled() {
return isMultiprocessEnabled;
}

public void setMultiprocessEnabled(boolean enabled) {
isMultiprocessEnabled = enabled;
}

public boolean isTrackingProtectionEnabled() {
return isTrackingProtectionEnabled;
}
Expand Down Expand Up @@ -76,7 +66,6 @@ public void setServoEnabled(boolean enabled) {

public static class Builder {

private boolean isMultiprocessEnabled;
private boolean isTrackingProtectionEnabled;
private boolean isSuspendMediaWhenInactiveEnabled;
private int userAgentMode;
Expand All @@ -87,10 +76,6 @@ public static class Builder {
public Builder() {
}

public Builder withMultiprocess(boolean isMultiprocessEnabled){
this.isMultiprocessEnabled = isMultiprocessEnabled;
return this;
}

public Builder withTrackingProteccion(boolean isTrackingProtectionEnabled){
this.isTrackingProtectionEnabled = isTrackingProtectionEnabled;
Expand Down Expand Up @@ -128,7 +113,6 @@ public Builder withDefaultSettings(Context context) {
GeckoSessionSettings.VIEWPORT_MODE_DESKTOP : GeckoSessionSettings.VIEWPORT_MODE_MOBILE;

return new SessionSettings.Builder()
.withMultiprocess(SettingsStore.getInstance(context).isMultiprocessEnabled())
.withTrackingProteccion(SettingsStore.getInstance(context).isTrackingProtectionEnabled())
.withSuspendMediaWhenInactive(true)
.withUserAgent(ua)
Expand All @@ -137,10 +121,7 @@ public Builder withDefaultSettings(Context context) {
}

public SessionSettings build(){
SessionSettings settings = new SessionSettings(this);

return settings;

return new SessionSettings(this);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,9 @@ public void setUaMode(final int mode) {
}
}

public void setMultiprocess(final boolean aEnabled) {
public void resetMultiprocess() {
for (Session session: mSessions) {
session.setMultiprocess(aEnabled);
session.resetMultiprocess();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ private void setMultiprocess(boolean value, boolean doApply) {
SettingsStore.getInstance(getContext()).setMultiprocessEnabled(value);

if (doApply) {
SessionStore.get().setMultiprocess(value);
SessionStore.get().resetMultiprocess();
}
}

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/non_L10n.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<string name="settings_key_remote_debugging" translatable="false">settings_remote_debugging</string>
<string name="settings_key_console_logs" translatable="false">settings_console_logs</string>
<string name="settings_key_environment_override" translatable="false">settings_environment_override</string>
<string name="settings_key_multiprocess" translatable="false">settings_environment_multiprocess</string>
<string name="settings_key_multiprocess_e10s" translatable="false">settings_environment_multiprocess_e10s</string>
<string name="settings_key_performance_monitor" translatable="false">settings_performance_monitor</string>
<string name="settings_key_servo" translatable="false">settings_environment_servo</string>
<string name="settings_key_drm_playback" translatable="false">settings_key_drm_playback</string>
Expand Down

0 comments on commit 3b25125

Please sign in to comment.