Browse Source

Pull request #100: AP9-14224 As a user, I would like the chromium browser to utilize sandbox process strategy to optimize the Chromium memory.

Merge in AP/chromiumpatches from AP9-14224 to master

* commit '7704272ce64a136936b9500c7f380f1c060f1ecb':
  AP9-14224 As a user, I would like the chromium browser to utilize sandbox process strategy to optimize the Chromium memory.
wuyifeng 1 year ago
parent
commit
72a322b1a5
2 changed files with 55 additions and 1 deletions
  1. 2 1
      build/bromite_patches_list.txt
  2. 53 0
      build/patches/Max-sandboxed-process-count.patch

+ 2 - 1
build/bromite_patches_list.txt

@@ -238,4 +238,5 @@ Modify-ph-strings-id-in-chromium.patch
 Telemetry-event-tabs-opened.patch
 Disable-transferring-link-and-image-of-Drag-Drop-function.patch
 Revert-Enable-SPPI-for-devices-with-enough-memory.patch
-Revert-Enable-StrictOriginIsolation-and-SitePerProcess.patch
+Revert-Enable-StrictOriginIsolation-and-SitePerProcess.patch
+Max-sandboxed-process-count.patch

+ 53 - 0
build/patches/Max-sandboxed-process-count.patch

@@ -0,0 +1,53 @@
+From: wuyifeng <wuyifeng@nd.com.cn>
+Date: Wed, 26 Jul 2023 13:47:27 +0800
+Subject: AP9-14224 As a user, I would like the chromium browser to utilize sandbox process strategy to optimize the Chromium memory.
+
+Fix version: 2.0.0
+Set the max sandboxed process count to 5.
+
+---
+ .../src/org/chromium/base/process_launcher/BindService.java    | 3 +--
+ .../chromium/base/process_launcher/ChildProcessConnection.java | 3 +--
+ chrome/android/java/AndroidManifest.xml                        | 2 +-
+ 3 files changed, 3 insertions(+), 5 deletions(-)
+
+diff --git a/base/android/java/src/org/chromium/base/process_launcher/BindService.java b/base/android/java/src/org/chromium/base/process_launcher/BindService.java
+--- a/base/android/java/src/org/chromium/base/process_launcher/BindService.java
++++ b/base/android/java/src/org/chromium/base/process_launcher/BindService.java
+@@ -29,8 +29,7 @@ final class BindService {
+     private static Method sBindServiceAsUserMethod;
+
+     static boolean supportVariableConnections() {
+-        return Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q
+-                && !BuildConfig.IS_INCREMENTAL_INSTALL;
++        return false;
+     }
+
+     // Note that handler is not guaranteed to be used, and client still need to correctly handle
+diff --git a/base/android/java/src/org/chromium/base/process_launcher/ChildProcessConnection.java b/base/android/java/src/org/chromium/base/process_launcher/ChildProcessConnection.java
+--- a/base/android/java/src/org/chromium/base/process_launcher/ChildProcessConnection.java
++++ b/base/android/java/src/org/chromium/base/process_launcher/ChildProcessConnection.java
+@@ -50,8 +50,7 @@ import javax.annotation.concurrent.GuardedBy;
+ public class ChildProcessConnection {
+     private static final String TAG = "ChildProcessConn";
+     private static final int FALLBACK_TIMEOUT_IN_SECONDS = 10;
+-    private static final boolean SUPPORT_NOT_PERCEPTIBLE_BINDING =
+-            Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
++    private static final boolean SUPPORT_NOT_PERCEPTIBLE_BINDING = false;
+
+     /**
+      * Used to notify the consumer about the process start. These callbacks will be invoked before
+diff --git a/chrome/android/java/AndroidManifest.xml b/chrome/android/java/AndroidManifest.xml
+--- a/chrome/android/java/AndroidManifest.xml
++++ b/chrome/android/java/AndroidManifest.xml
+@@ -1154,7 +1154,7 @@ by a child template that "extends" this file.
+
+       <!-- NOTE: If you change the value of "android:process" for the below services,
+            you also need to update kHelperProcessExecutableName in chrome_constants.cc. -->
+-      {% set num_sandboxed_services = 40 %}
++      {% set num_sandboxed_services = 5 %}
+       <meta-data android:name="org.chromium.content.browser.NUM_SANDBOXED_SERVICES"
+           android:value="{{ num_sandboxed_services }}"/>
+
+--
+