[epiphany/gnome-3-32] Revert "Remove unsafe process model and process count settings"



commit 9f4458ffdba15c4fce7d9b5aab7fa5502a809160
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Tue Feb 26 14:52:07 2019 -0600

    Revert "Remove unsafe process model and process count settings"
    
    This reverts commit 06c0b084fb44cbd2aaed61f4658a15e76546eab3.
    
    We'll keep these settings for gnome-3-32, but they are gone on master.

 data/org.gnome.epiphany.gschema.xml | 11 +++++++++++
 embed/ephy-embed-shell.c            | 30 ++++++++++++++++++++++++++++--
 lib/ephy-prefs.h                    |  8 ++++++++
 3 files changed, 47 insertions(+), 2 deletions(-)
---
diff --git a/data/org.gnome.epiphany.gschema.xml b/data/org.gnome.epiphany.gschema.xml
index cc4a2f381..f3bf53b6b 100644
--- a/data/org.gnome.epiphany.gschema.xml
+++ b/data/org.gnome.epiphany.gschema.xml
@@ -55,6 +55,17 @@
                         <summary>Whether to delay loading of tabs that are not immediately visible on 
session restore</summary>
                         <description>When this option is set to true, tabs will not start loading until the 
user switches to them, upon session restore.</description>
                 </key>
+                <key name="process-model" enum="org.gnome.Epiphany.EphyPrefsProcessModel">
+                        <default>'one-secondary-process-per-web-view'</default>
+                        <summary>Process model</summary>
+                        <description>This option allows to set the process model used. Use 
“shared-secondary-process” to use a single web process shared by all the tabs and 
“one-secondary-process-per-web-view” to use a different web process for each tab.</description>
+                </key>
+                <key type="u" name="max-processes">
+                        <default>0</default>
+                        <summary>Maximum number of web processes created at the same time when using 
“one-secondary-process-per-web-view” model</summary>
+                        <description>This option sets a limit to the number of web processes that will be 
used at the same time for the “one-secondary-process-per-web-view” model. The default value is “0” and means 
no limit.</description>
+
+                </key>
                 <key type="as" name="adblock-filters">
                         <default>['https://easylist.to/easylist/easylist.txt', 
'https://easylist.to/easylist/easyprivacy.txt']</default>
                         <summary>List of adblock filters</summary>
diff --git a/embed/ephy-embed-shell.c b/embed/ephy-embed-shell.c
index 37b79339b..31a4abf09 100644
--- a/embed/ephy-embed-shell.c
+++ b/embed/ephy-embed-shell.c
@@ -1067,6 +1067,33 @@ ephy_embed_shell_setup_web_extensions_server (EphyEmbedShell *shell)
   g_object_unref (observer);
 }
 
+static void
+ephy_embed_shell_setup_process_model (EphyEmbedShell *shell)
+{
+  EphyEmbedShellPrivate *priv = ephy_embed_shell_get_instance_private (shell);
+  EphyPrefsProcessModel process_model;
+  guint max_processes;
+
+  if (ephy_embed_shell_get_mode (shell) == EPHY_EMBED_SHELL_MODE_APPLICATION)
+    process_model = EPHY_PREFS_PROCESS_MODEL_SHARED_SECONDARY_PROCESS;
+  else
+    process_model = g_settings_get_enum (EPHY_SETTINGS_MAIN, EPHY_PREFS_PROCESS_MODEL);
+
+  switch (process_model) {
+    case EPHY_PREFS_PROCESS_MODEL_SHARED_SECONDARY_PROCESS:
+      max_processes = 1;
+      break;
+    case EPHY_PREFS_PROCESS_MODEL_ONE_SECONDARY_PROCESS_PER_WEB_VIEW:
+      max_processes = g_settings_get_uint (EPHY_SETTINGS_MAIN, EPHY_PREFS_MAX_PROCESSES);
+      break;
+    default:
+      g_assert_not_reached ();
+  }
+
+  webkit_web_context_set_process_model (priv->web_context, 
WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES);
+  webkit_web_context_set_web_process_count_limit (priv->web_context, max_processes);
+}
+
 static void
 ephy_embed_shell_create_web_context (EphyEmbedShell *shell)
 {
@@ -1209,8 +1236,7 @@ ephy_embed_shell_startup (GApplication *application)
                     G_CALLBACK (web_extension_password_manager_request_save_received_cb),
                     shell);
 
-  webkit_web_context_set_process_model (priv->web_context, 
WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES);
-
+  ephy_embed_shell_setup_process_model (shell);
   g_signal_connect_object (priv->web_context, "initialize-web-extensions",
                            G_CALLBACK (initialize_web_extensions),
                            shell, 0);
diff --git a/lib/ephy-prefs.h b/lib/ephy-prefs.h
index 430cc99ff..b92e3d0b1 100644
--- a/lib/ephy-prefs.h
+++ b/lib/ephy-prefs.h
@@ -71,6 +71,12 @@ typedef enum
   EPHY_PREFS_WEB_HARDWARE_ACCELERATION_POLICY_NEVER
 } EphyPrefsWebHardwareAccelerationPolicy;
 
+typedef enum
+{
+  EPHY_PREFS_PROCESS_MODEL_SHARED_SECONDARY_PROCESS,
+  EPHY_PREFS_PROCESS_MODEL_ONE_SECONDARY_PROCESS_PER_WEB_VIEW
+} EphyPrefsProcessModel;
+
 #define EPHY_PREFS_UI_SCHEMA                     "org.gnome.Epiphany.ui"
 #define EPHY_PREFS_UI_EXPAND_TABS_BAR            "expand-tabs-bar"
 #define EPHY_PREFS_UI_TABS_BAR_POSITION          "tabs-bar-position"
@@ -165,6 +171,8 @@ static const char * const ephy_prefs_web_schema[] = {
 #define EPHY_PREFS_INTERNAL_VIEW_SOURCE               "internal-view-source"
 #define EPHY_PREFS_RESTORE_SESSION_POLICY             "restore-session-policy"
 #define EPHY_PREFS_RESTORE_SESSION_DELAYING_LOADS     "restore-session-delaying-loads"
+#define EPHY_PREFS_PROCESS_MODEL                      "process-model"
+#define EPHY_PREFS_MAX_PROCESSES                      "max-processes"
 #define EPHY_PREFS_ADBLOCK_FILTERS                    "adblock-filters"
 #define EPHY_PREFS_SEARCH_ENGINES                     "search-engines"
 #define EPHY_PREFS_DEFAULT_SEARCH_ENGINE              "default-search-engine"


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]