Skip to content

Commit

Permalink
v122 final patches
Browse files Browse the repository at this point in the history
  • Loading branch information
uazo committed Feb 21, 2024
1 parent 2b1f1fa commit a608bc0
Show file tree
Hide file tree
Showing 47 changed files with 1,152 additions and 389 deletions.
62 changes: 48 additions & 14 deletions build/patches/AImageReader-CFI-crash-mitigations.patch
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ See discussions at:

License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html
---
base/android/android_image_reader_compat.cc | 9 +++++++++
base/android/android_image_reader_compat.cc | 16 ++++++++++++++++
base/android/android_image_reader_compat.h | 14 ++++++++++++++
chrome/browser/flag-metadata.json | 6 +++---
.../AImageReader-CFI-crash-mitigations.inc | 4 ++++
.../AImageReader-CFI-crash-mitigations.inc | 1 +
Expand All @@ -29,38 +30,63 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html
gpu/config/gpu_finch_features.h | 1 +
gpu/config/gpu_util.cc | 8 ++++++++
gpu/config/gpu_workaround_list.txt | 1 +
gpu/ipc/service/gpu_init.cc | 7 +++++++
gpu/ipc/service/gpu_init.cc | 8 ++++++++
gpu/ipc/service/stream_texture_android.cc | 11 ++++++++++-
11 files changed, 65 insertions(+), 4 deletions(-)
12 files changed, 87 insertions(+), 4 deletions(-)
create mode 100644 cromite_flags/media/base/media_switches_cc/AImageReader-CFI-crash-mitigations.inc
create mode 100644 cromite_flags/media/base/media_switches_h/AImageReader-CFI-crash-mitigations.inc

diff --git a/base/android/android_image_reader_compat.cc b/base/android/android_image_reader_compat.cc
--- a/base/android/android_image_reader_compat.cc
+++ b/base/android/android_image_reader_compat.cc
@@ -7,7 +7,14 @@
@@ -7,7 +7,23 @@
namespace base {
namespace android {

+bool AndroidImageReader::disable_support_ = false;
+AndroidImageReader& AndroidImageReader::GetInstance() {
+ // C++11 static local variable initialization is
+ // thread-safe.
+ static AndroidImageReader instance;
+ return instance;
+}
+
+void AndroidImageReader::DisableSupport() {
+ disable_support_ = true;
+}
+
+bool AndroidImageReader::IsSupported() {
+ return !disable_support_;
+}
+
bool EnableAndroidImageReader() {
+ if (disable_support_) return false;
+ if (!AndroidImageReader::GetInstance().IsSupported()) return false;
// Currently we want to enable AImageReader only for android P+ devices.
if (__builtin_available(android 28, *)) {
return true;
@@ -15,5 +22,7 @@ bool EnableAndroidImageReader() {
return false;
}
diff --git a/base/android/android_image_reader_compat.h b/base/android/android_image_reader_compat.h
--- a/base/android/android_image_reader_compat.h
+++ b/base/android/android_image_reader_compat.h
@@ -10,6 +10,20 @@
namespace base {
namespace android {

+FIX ME!
+class BASE_EXPORT AndroidImageReader {
+ public:
+ // Thread safe GetInstance.
+ static AndroidImageReader& GetInstance();
+
+ bool IsSupported();
+
} // namespace android
} // namespace base
+ // Disable image reader support.
+ void DisableSupport();
+
+ private:
+ bool disable_support_ = false;
+};
+
// Check if the image reader usage is supported.
BASE_EXPORT bool EnableAndroidImageReader();

diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json
--- a/chrome/browser/flag-metadata.json
+++ b/chrome/browser/flag-metadata.json
Expand Down Expand Up @@ -183,14 +209,22 @@ diff --git a/gpu/config/gpu_workaround_list.txt b/gpu/config/gpu_workaround_list
diff --git a/gpu/ipc/service/gpu_init.cc b/gpu/ipc/service/gpu_init.cc
--- a/gpu/ipc/service/gpu_init.cc
+++ b/gpu/ipc/service/gpu_init.cc
@@ -672,6 +672,13 @@ bool GpuInit::InitializeAndStartSandbox(base::CommandLine* command_line,
@@ -65,6 +65,7 @@

#if BUILDFLAG(IS_ANDROID)
#include "ui/gfx/android/android_surface_control_compat.h"
+#include "base/android/android_image_reader_compat.h"
#endif

#if BUILDFLAG(ENABLE_VULKAN)
@@ -672,6 +673,13 @@ bool GpuInit::InitializeAndStartSandbox(base::CommandLine* command_line,
}
#endif // BUILDFLAG(IS_WIN)

+#if BUILDFLAG(IS_ANDROID)
+ // Disable AImageReader if the workaround is enabled.
+ if (gpu_feature_info_.IsWorkaroundEnabled(DISABLE_AIMAGEREADER)) {
+ base::android::AndroidImageReader::DisableSupport();
+ base::android::AndroidImageReader::GetInstance().DisableSupport();
+ }
+#endif
+
Expand Down
18 changes: 8 additions & 10 deletions build/patches/AdblockPlus-add-blocking-in-service-workers.patch
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ diff --git a/chrome/browser/chrome_content_browser_client.h b/chrome/browser/chr
diff --git a/components/adblock/content/browser/adblock_url_loader_factory.cc b/components/adblock/content/browser/adblock_url_loader_factory.cc
--- a/components/adblock/content/browser/adblock_url_loader_factory.cc
+++ b/components/adblock/content/browser/adblock_url_loader_factory.cc
@@ -343,12 +343,6 @@ void AdblockURLLoaderFactory::InProgressRequest::OnRequestError(
@@ -344,12 +344,6 @@ void AdblockURLLoaderFactory::InProgressRequest::OnRequestError(

void AdblockURLLoaderFactory::InProgressRequest::CheckFilterMatch(
CheckFilterMatchCallback callback) {
Expand All @@ -460,7 +460,7 @@ diff --git a/components/adblock/content/browser/adblock_url_loader_factory.cc b/
auto subscription_service = factory_->config_.subscription_service;
if (is_document_request_) {
auto* host = content::RenderFrameHost::FromID(factory_->host_id_);
@@ -387,7 +381,7 @@ void AdblockURLLoaderFactory::InProgressRequest::CheckFilterMatch(
@@ -388,7 +382,7 @@ void AdblockURLLoaderFactory::InProgressRequest::CheckFilterMatch(
} else {
factory_->config_.resource_classifier->CheckRequestFilterMatch(
subscription_service->GetCurrentSnapshot(), request_url_,
Expand All @@ -469,7 +469,7 @@ diff --git a/components/adblock/content/browser/adblock_url_loader_factory.cc b/
base::BindOnce(
&AdblockURLLoaderFactory::InProgressRequest::OnRequestUrlClassified,
weak_factory_.GetWeakPtr(),
@@ -676,12 +670,14 @@ void AdblockURLLoaderFactory::InProgressRequest::OnRequestFilterMatchResult(
@@ -677,12 +671,14 @@ void AdblockURLLoaderFactory::InProgressRequest::OnRequestFilterMatchResult(

AdblockURLLoaderFactory::AdblockURLLoaderFactory(
AdblockURLLoaderFactoryConfig config,
Expand Down Expand Up @@ -528,7 +528,7 @@ diff --git a/components/adblock/content/browser/frame_hierarchy_builder.cc b/com
diff --git a/components/adblock/content/browser/resource_classification_runner.h b/components/adblock/content/browser/resource_classification_runner.h
--- a/components/adblock/content/browser/resource_classification_runner.h
+++ b/components/adblock/content/browser/resource_classification_runner.h
@@ -81,14 +81,22 @@ class ResourceClassificationRunner : public KeyedService {
@@ -81,12 +81,20 @@ class ResourceClassificationRunner : public KeyedService {
virtual void CheckRequestFilterMatch(
SubscriptionService::Snapshot subscription_collections,
const GURL& request_url,
Expand All @@ -540,17 +540,15 @@ diff --git a/components/adblock/content/browser/resource_classification_runner.h
SubscriptionService::Snapshot subscription_collections,
const GURL& request_url,
+ const GURL& request_initiator,
content::GlobalRenderFrameHostId render_frame_host_id,
CheckFilterMatchCallback callback) = 0;
+ content::GlobalRenderFrameHostId render_frame_host_id,
+ CheckFilterMatchCallback callback) = 0;
+ virtual void CheckRequestFilterMatchForWebTransport(
+ SubscriptionService::Snapshot subscription_collections,
+ const GURL& request_url,
+ const GURL& request_initiator,
+ content::GlobalRenderFrameHostId render_frame_host_id,
+ CheckFilterMatchCallback callback);
content::GlobalRenderFrameHostId render_frame_host_id,
CheckFilterMatchCallback callback) = 0;
// No callback, just notify observers
virtual void CheckDocumentAllowlisted(
SubscriptionService::Snapshot subscription_collection,
diff --git a/components/adblock/content/browser/resource_classification_runner_impl.cc b/components/adblock/content/browser/resource_classification_runner_impl.cc
--- a/components/adblock/content/browser/resource_classification_runner_impl.cc
+++ b/components/adblock/content/browser/resource_classification_runner_impl.cc
Expand Down
20 changes: 10 additions & 10 deletions build/patches/Add-a-proxy-configuration-page.patch
Original file line number Diff line number Diff line change
Expand Up @@ -1354,8 +1354,8 @@ diff --git a/net/proxy_resolution/proxy_config.cc b/net/proxy_resolution/proxy_c
+ // special case: a single proxy servers list specified
+ if (type == Type::PROXY_LIST) {
+ std::string proxy_list;
+ for (const ProxyServer& proxy_server :
+ single_proxies.GetAll()) {
+ for (const auto& proxy_chain : single_proxies.AllChains()) {
+ net::ProxyServer proxy_server = proxy_chain.GetProxyServer(/*chain_index=*/0);
+ proxy_list += ProxyServerToProxyUri(proxy_server) + ";";
+ }
+ // remove last semicolon
Expand All @@ -1373,20 +1373,20 @@ diff --git a/net/proxy_resolution/proxy_config.cc b/net/proxy_resolution/proxy_c
+
+ // start to build a per-scheme list
+ std::string list;
+ for (const ProxyServer& proxy_server :
+ proxies_for_http.GetAll()) {
+ for (const auto& proxy_chain : proxies_for_http.AllChains()) {
+ net::ProxyServer proxy_server = proxy_chain.GetProxyServer(/*chain_index=*/0);
+ list += "http=" + ProxyServerToProxyUri(proxy_server) + ";";
+ }
+ for (const ProxyServer& proxy_server :
+ proxies_for_https.GetAll()) {
+ for (const auto& proxy_chain : proxies_for_https.AllChains()) {
+ net::ProxyServer proxy_server = proxy_chain.GetProxyServer(/*chain_index=*/0);
+ list += "https=" + ProxyServerToProxyUri(proxy_server) + ";";
+ }
+ for (const ProxyServer& proxy_server :
+ proxies_for_ftp.GetAll()) {
+ for (const auto& proxy_chain : proxies_for_ftp.AllChains()) {
+ net::ProxyServer proxy_server = proxy_chain.GetProxyServer(/*chain_index=*/0);
+ list += "ftp=" + ProxyServerToProxyUri(proxy_server) + ";";
+ }
+ for (const ProxyServer& proxy_server :
+ fallback_proxies.GetAll()) {
+ for (const auto& proxy_chain : fallback_proxies.AllChains()) {
+ net::ProxyServer proxy_server = proxy_chain.GetProxyServer(/*chain_index=*/0);
+ list += "socks=" + ProxyServerToProxyUri(proxy_server) + ";";
+ }
+ if (list.length() != 0 ) {
Expand Down
22 changes: 13 additions & 9 deletions build/patches/Add-bookmark-import-export-actions.patch
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html
.../bookmarks/BookmarkToolbarViewBinder.java | 6 +
.../native_page/NativePageFactory.java | 11 +-
chrome/browser/BUILD.gn | 11 +-
.../bookmarks/android/bookmark_bridge.cc | 283 ++++++++++++++++++
.../bookmarks/android/bookmark_bridge.cc | 287 ++++++++++++++++++
.../bookmarks/android/bookmark_bridge.h | 30 +-
.../browser/bookmarks/bookmark_html_writer.cc | 11 +
.../dialogs/DownloadLocationCustomView.java | 8 +-
Expand All @@ -53,7 +53,7 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html
ui/shell_dialogs/select_file_dialog_linux.cc | 4 +
ui/shell_dialogs/select_file_dialog_linux.h | 2 +
ui/shell_dialogs/select_file_dialog_win.cc | 5 +
43 files changed, 918 insertions(+), 29 deletions(-)
43 files changed, 922 insertions(+), 29 deletions(-)
create mode 100644 cromite_flags/chrome/browser/about_flags_cc/add-bookmark-import-export-actions.inc
create mode 100644 cromite_flags/chrome/browser/flags/android/chrome_feature_list_cc/add-bookmark-import-export-actions.inc
create mode 100644 cromite_flags/chrome/browser/flags/android/chrome_feature_list_h/add-bookmark-import-export-actions.inc
Expand Down Expand Up @@ -863,7 +863,7 @@ diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
diff --git a/chrome/browser/bookmarks/android/bookmark_bridge.cc b/chrome/browser/bookmarks/android/bookmark_bridge.cc
--- a/chrome/browser/bookmarks/android/bookmark_bridge.cc
+++ b/chrome/browser/bookmarks/android/bookmark_bridge.cc
@@ -58,6 +58,25 @@
@@ -58,6 +58,28 @@
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/web_contents.h"

Expand All @@ -885,11 +885,14 @@ diff --git a/chrome/browser/bookmarks/android/bookmark_bridge.cc b/chrome/browse
+#include "base/task/task_traits.h"
+#include "base/task/thread_pool.h"
+#include "content/public/browser/browser_task_traits.h"
+#include "base/files/file_path.h"
+#include "ui/shell_dialogs/selected_file_info.h"
+#include "ui/shell_dialogs/select_file_dialog.h"
+
using base::android::AttachCurrentThread;
using base::android::ConvertUTF16ToJavaString;
using base::android::ConvertUTF8ToJavaString;
@@ -75,12 +94,96 @@ using bookmarks::android::JavaBookmarkIdGetType;
@@ -75,12 +97,96 @@ using bookmarks::android::JavaBookmarkIdGetType;
using content::BrowserThread;
using power_bookmarks::PowerBookmarkMeta;

Expand Down Expand Up @@ -986,7 +989,7 @@ diff --git a/chrome/browser/bookmarks/android/bookmark_bridge.cc b/chrome/browse
class BookmarkTitleComparer {
public:
explicit BookmarkTitleComparer(BookmarkBridge* bookmark_bridge,
@@ -221,6 +324,10 @@ BookmarkBridge::~BookmarkBridge() {
@@ -221,6 +327,10 @@ BookmarkBridge::~BookmarkBridge() {
partner_bookmarks_shim_observation_.Reset();
bookmark_model_observation_.Reset();
profile_observation_.Reset();
Expand All @@ -997,7 +1000,7 @@ diff --git a/chrome/browser/bookmarks/android/bookmark_bridge.cc b/chrome/browse
}

void BookmarkBridge::Destroy(JNIEnv*) {
@@ -638,6 +745,182 @@ jint BookmarkBridge::GetTotalBookmarkCount(
@@ -638,6 +748,183 @@ jint BookmarkBridge::GetTotalBookmarkCount(
return count;
}

Expand Down Expand Up @@ -1079,8 +1082,9 @@ diff --git a/chrome/browser/bookmarks/android/bookmark_bridge.cc b/chrome/browse
+ return std::make_unique<TemplateURL>(data);
+}
+
+void BookmarkBridge::FileSelected(const base::FilePath& path, int index,
+void BookmarkBridge::FileSelected(const ui::SelectedFileInfo& file, int index,
+ void* params) {
+ base::FilePath path = file.path();
+ base::ThreadPool::PostTaskAndReplyWithResult(
+ FROM_HERE, {base::TaskPriority::BEST_EFFORT, base::MayBlock()},
+ base::BindOnce(&BookmarkBridge::FileSelectedImpl,
Expand Down Expand Up @@ -1216,7 +1220,7 @@ diff --git a/chrome/browser/bookmarks/android/bookmark_bridge.h b/chrome/browser
bool IsDoingExtensiveChanges(JNIEnv* env);

+ // SelectFileDialog::Listener implementation.
+ void FileSelected(const base::FilePath& path,
+ void FileSelected(const ui::SelectedFileInfo& file,
+ int index,
+ void* params) override;
+ void FileSelectionCanceled(void* params) override;
Expand Down Expand Up @@ -1371,7 +1375,7 @@ diff --git a/chrome/browser/flags/android/chrome_feature_list.cc b/chrome/browse
&kCacheActivityTaskID,
&kCastDeviceFilter,
&kClearOmniboxFocusAfterNavigation,
+ &kBookmarksExportUseSaf
+ &kBookmarksExportUseSaf,
&kCreateNewTabInitializeRenderer,
&kCCTBrandTransparencyMemoryImprovement,
&kCCTClientDataHeader,
Expand Down
Loading

0 comments on commit a608bc0

Please sign in to comment.