mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
patch: Remove sandbox-related //base patches (see #3824)
The //base target is only used by cef_sandbox on Windows (not macOS).
This commit is contained in:
@@ -437,7 +437,7 @@ patches = [
|
||||
'name': 'printing_context_2196',
|
||||
},
|
||||
{
|
||||
# Disable thin archives with cef_sandbox builds.
|
||||
# mac: Disable thin archives with cef_sandbox builds.
|
||||
# https://github.com/chromiumembedded/cef/issues/3674
|
||||
'name': 'build',
|
||||
},
|
||||
@@ -519,23 +519,6 @@ patches = [
|
||||
# https://github.com/chromiumembedded/cef/issues/1872
|
||||
'name': 'base_command_line_1872',
|
||||
},
|
||||
{
|
||||
# Remove cef_sandbox dependency on boringssl functions.
|
||||
# https://github.com/chromiumembedded/cef/issues/2743
|
||||
#
|
||||
# Avoid usage of std::atomic_flag::test() added in C++20.
|
||||
# https://github.com/llvm/llvm-project/issues/57364
|
||||
#
|
||||
# Avoid usage of PartitionAlloc assertions (PA_BASE_CHECK) in raw_ptr.h.
|
||||
#
|
||||
# Disable use of Rust for JSON parsing with cef_sandbox.
|
||||
# Enables the fallback to C++ that was removed in
|
||||
# https://crrev.com/9ddc1624637c8cfa8ef50a95abd779e0ba4d67f6
|
||||
#
|
||||
# Avoid inclusion of undefined PartitionAlloc dependencies in Dawn after
|
||||
# https://crrev.com/4dacf2b61c359950d2c2f1b5f9b9d079a01290a4
|
||||
'name': 'base_sandbox_2743',
|
||||
},
|
||||
{
|
||||
# Add RenderWidgetHostImpl::SetCompositorForFlingScheduler to fix fling
|
||||
# scrolling in OSR mode.
|
||||
|
@@ -1,315 +0,0 @@
|
||||
diff --git base/BUILD.gn base/BUILD.gn
|
||||
index 59721ed3c9e26..05926d66bb49b 100644
|
||||
--- base/BUILD.gn
|
||||
+++ base/BUILD.gn
|
||||
@@ -41,6 +41,7 @@ import("//build/rust/rust_static_library.gni")
|
||||
import("//build/timestamp.gni")
|
||||
import("//build/util/process_version.gni")
|
||||
import("//build_overrides/build.gni")
|
||||
+import("//cef/libcef/features/features.gni")
|
||||
import("//testing/libfuzzer/fuzzer_test.gni")
|
||||
import("//testing/test.gni")
|
||||
|
||||
@@ -1531,7 +1532,13 @@ component("base") {
|
||||
"hash/md5.h",
|
||||
"hash/sha1.h",
|
||||
]
|
||||
- if (is_nacl) {
|
||||
+
|
||||
+ deps += [ "//cef/libcef/features:buildflags" ]
|
||||
+ if (enable_cef) {
|
||||
+ configs += [ "//cef/libcef/features:config" ]
|
||||
+ }
|
||||
+
|
||||
+ if (is_nacl || is_cef_sandbox_build) {
|
||||
sources += [
|
||||
"hash/md5_nacl.cc",
|
||||
"hash/md5_nacl.h",
|
||||
diff --git base/allocator/dispatcher/dispatcher.cc base/allocator/dispatcher/dispatcher.cc
|
||||
index f680f63cffc5b..9cb615bbc8a5a 100644
|
||||
--- base/allocator/dispatcher/dispatcher.cc
|
||||
+++ base/allocator/dispatcher/dispatcher.cc
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "base/check.h"
|
||||
#include "base/dcheck_is_on.h"
|
||||
#include "base/no_destructor.h"
|
||||
+#include "cef/libcef/features/features.h"
|
||||
#include "partition_alloc/buildflags.h"
|
||||
#include "partition_alloc/shim/allocator_shim.h"
|
||||
|
||||
@@ -33,7 +34,7 @@ struct Dispatcher::Impl {
|
||||
}
|
||||
|
||||
void Reset() {
|
||||
-#if DCHECK_IS_ON()
|
||||
+#if DCHECK_IS_ON() && !BUILDFLAG(IS_CEF_SANDBOX_BUILD)
|
||||
DCHECK([&] {
|
||||
auto const was_set = is_initialized_check_flag_.test_and_set();
|
||||
is_initialized_check_flag_.clear();
|
||||
diff --git base/hash/md5.h base/hash/md5.h
|
||||
index 4d358570d81c5..09bf13a965541 100644
|
||||
--- base/hash/md5.h
|
||||
+++ base/hash/md5.h
|
||||
@@ -11,8 +11,9 @@
|
||||
#include "base/base_export.h"
|
||||
#include "base/containers/span.h"
|
||||
#include "build/build_config.h"
|
||||
+#include "cef/libcef/features/features.h"
|
||||
|
||||
-#if BUILDFLAG(IS_NACL)
|
||||
+#if BUILDFLAG(IS_NACL) || BUILDFLAG(IS_CEF_SANDBOX_BUILD)
|
||||
#include "base/hash/md5_nacl.h"
|
||||
#else
|
||||
#include "base/hash/md5_boringssl.h"
|
||||
diff --git base/hash/sha1.h base/hash/sha1.h
|
||||
index 2158b648ca58a..8a8cb13b2fd74 100644
|
||||
--- base/hash/sha1.h
|
||||
+++ base/hash/sha1.h
|
||||
@@ -15,7 +15,9 @@
|
||||
#include "base/compiler_specific.h"
|
||||
#include "base/containers/span.h"
|
||||
#include "build/build_config.h"
|
||||
-#if BUILDFLAG(IS_NACL)
|
||||
+#include "cef/libcef/features/features.h"
|
||||
+
|
||||
+#if BUILDFLAG(IS_NACL) || BUILDFLAG(IS_CEF_SANDBOX_BUILD)
|
||||
#include "base/hash/sha1_nacl.h"
|
||||
#else
|
||||
#include "base/hash/sha1_boringssl.h"
|
||||
diff --git base/json/json_reader.cc base/json/json_reader.cc
|
||||
index f32622d353f1d..def35a3ae1c5c 100644
|
||||
--- base/json/json_reader.cc
|
||||
+++ base/json/json_reader.cc
|
||||
@@ -12,8 +12,9 @@
|
||||
#include "base/logging.h"
|
||||
#include "base/metrics/histogram_macros.h"
|
||||
#include "build/build_config.h"
|
||||
+#include "cef/libcef/features/features.h"
|
||||
|
||||
-#if !BUILDFLAG(IS_NACL)
|
||||
+#if !(BUILDFLAG(IS_NACL) || BUILDFLAG(IS_CEF_SANDBOX_BUILD))
|
||||
#include "base/strings/string_view_rust.h"
|
||||
#include "third_party/rust/serde_json_lenient/v0_2/wrapper/functions.h"
|
||||
#include "third_party/rust/serde_json_lenient/v0_2/wrapper/lib.rs.h"
|
||||
@@ -21,7 +22,7 @@
|
||||
|
||||
// TODO(crbug.com/40811643): Move the C++ parser into components/nacl to just
|
||||
// run in-process there. Don't compile base::JSONReader on NaCL at all.
|
||||
-#if !BUILDFLAG(IS_NACL)
|
||||
+#if !(BUILDFLAG(IS_NACL) || BUILDFLAG(IS_CEF_SANDBOX_BUILD))
|
||||
|
||||
namespace {
|
||||
const char kSecurityJsonParsingTime[] = "Security.JSONParser.ParsingTime";
|
||||
@@ -137,7 +138,7 @@ namespace base {
|
||||
std::optional<Value> JSONReader::Read(std::string_view json,
|
||||
int options,
|
||||
size_t max_depth) {
|
||||
-#if BUILDFLAG(IS_NACL)
|
||||
+#if (BUILDFLAG(IS_NACL) || BUILDFLAG(IS_CEF_SANDBOX_BUILD))
|
||||
internal::JSONParser parser(options, max_depth);
|
||||
return parser.Parse(json);
|
||||
#else // BUILDFLAG(IS_NACL)
|
||||
@@ -182,7 +183,7 @@ std::optional<Value::List> JSONReader::ReadList(std::string_view json,
|
||||
JSONReader::Result JSONReader::ReadAndReturnValueWithError(
|
||||
std::string_view json,
|
||||
int options) {
|
||||
-#if BUILDFLAG(IS_NACL)
|
||||
+#if (BUILDFLAG(IS_NACL) || BUILDFLAG(IS_CEF_SANDBOX_BUILD))
|
||||
internal::JSONParser parser(options);
|
||||
auto value = parser.Parse(json);
|
||||
if (!value) {
|
||||
@@ -223,7 +224,7 @@ bool JSONReader::UsingRust() {
|
||||
if (!base::FeatureList::GetInstance()) {
|
||||
return false;
|
||||
}
|
||||
-#if BUILDFLAG(IS_NACL)
|
||||
+#if (BUILDFLAG(IS_NACL) || BUILDFLAG(IS_CEF_SANDBOX_BUILD))
|
||||
return false;
|
||||
#else
|
||||
return base::FeatureList::IsEnabled(base::features::kUseRustJsonParser);
|
||||
diff --git base/logging.cc base/logging.cc
|
||||
index 26ba1a286e451..99b2ce6feb274 100644
|
||||
--- base/logging.cc
|
||||
+++ base/logging.cc
|
||||
@@ -51,6 +51,7 @@
|
||||
#include "base/trace_event/base_tracing.h"
|
||||
#include "base/vlog.h"
|
||||
#include "build/build_config.h"
|
||||
+#include "cef/libcef/features/features.h"
|
||||
#include "third_party/abseil-cpp/absl/base/internal/raw_logging.h"
|
||||
#include "third_party/abseil-cpp/absl/cleanup/cleanup.h"
|
||||
|
||||
@@ -530,7 +531,7 @@ bool BaseInitLoggingImpl(const LoggingSettings& settings) {
|
||||
}
|
||||
#endif
|
||||
|
||||
-#if !BUILDFLAG(IS_NACL)
|
||||
+#if !BUILDFLAG(IS_NACL) && !BUILDFLAG(IS_CEF_SANDBOX_BUILD)
|
||||
// Connects Rust logging with the //base logging functionality.
|
||||
internal::init_rust_log_crate();
|
||||
#endif
|
||||
diff --git base/metrics/crc32.cc base/metrics/crc32.cc
|
||||
index 83e3cee2579ab..8238767ab9126 100644
|
||||
--- base/metrics/crc32.cc
|
||||
+++ base/metrics/crc32.cc
|
||||
@@ -3,14 +3,15 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "base/metrics/crc32.h"
|
||||
+#include "cef/libcef/features/features.h"
|
||||
|
||||
-#if !BUILDFLAG(IS_NACL)
|
||||
+#if !BUILDFLAG(IS_NACL) && !BUILDFLAG(IS_CEF_SANDBOX_BUILD)
|
||||
#include "third_party/zlib/zlib.h"
|
||||
#endif // !BUILDFLAG(IS_NACL)
|
||||
|
||||
namespace base {
|
||||
|
||||
-#if !BUILDFLAG(IS_NACL)
|
||||
+#if !BUILDFLAG(IS_NACL) && !BUILDFLAG(IS_CEF_SANDBOX_BUILD)
|
||||
uint32_t Crc32(uint32_t sum, span<const uint8_t> data) {
|
||||
if (data.empty()) {
|
||||
return sum;
|
||||
diff --git base/process/memory.h base/process/memory.h
|
||||
index 5d11d4a1560b1..242a93bcca8ed 100644
|
||||
--- base/process/memory.h
|
||||
+++ base/process/memory.h
|
||||
@@ -29,7 +29,7 @@ BASE_EXPORT void EnableTerminationOnOutOfMemory();
|
||||
#if PA_BUILDFLAG(USE_PARTITION_ALLOC)
|
||||
using partition_alloc::TerminateBecauseOutOfMemory;
|
||||
#else
|
||||
-inline void TerminateBecauseOutOfMemory(size_t) {
|
||||
+[[noreturn]] inline void TerminateBecauseOutOfMemory(size_t) {
|
||||
logging::RawCheckFailure("Out of memory");
|
||||
}
|
||||
#endif
|
||||
@@ -58,7 +58,11 @@ bool ReleaseAddressSpaceReservation();
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
namespace win {
|
||||
|
||||
+#if PA_BUILDFLAG(USE_PARTITION_ALLOC)
|
||||
using partition_alloc::win::kOomExceptionCode;
|
||||
+#else
|
||||
+const DWORD kOomExceptionCode = 0xe0000008;
|
||||
+#endif
|
||||
|
||||
} // namespace win
|
||||
#endif
|
||||
diff --git base/rand_util.h base/rand_util.h
|
||||
index d650943a7b75a..abd5217f8ceed 100644
|
||||
--- base/rand_util.h
|
||||
+++ base/rand_util.h
|
||||
@@ -23,8 +23,9 @@
|
||||
#include "base/numerics/safe_conversions.h"
|
||||
#include "base/time/time.h"
|
||||
#include "build/build_config.h"
|
||||
+#include "cef/libcef/features/features.h"
|
||||
|
||||
-#if !BUILDFLAG(IS_NACL)
|
||||
+#if !BUILDFLAG(IS_NACL) && !BUILDFLAG(IS_CEF_SANDBOX_BUILD)
|
||||
#include "third_party/boringssl/src/include/openssl/rand.h"
|
||||
#endif
|
||||
|
||||
@@ -189,7 +190,7 @@ class RandomBitGenerator {
|
||||
~RandomBitGenerator() = default;
|
||||
};
|
||||
|
||||
-#if !BUILDFLAG(IS_NACL)
|
||||
+#if !BUILDFLAG(IS_NACL) && !BUILDFLAG(IS_CEF_SANDBOX_BUILD)
|
||||
class NonAllocatingRandomBitGenerator {
|
||||
public:
|
||||
using result_type = uint64_t;
|
||||
diff --git base/rand_util_win.cc base/rand_util_win.cc
|
||||
index 0b772cbae8916..b19183b34d176 100644
|
||||
--- base/rand_util_win.cc
|
||||
+++ base/rand_util_win.cc
|
||||
@@ -15,7 +15,11 @@
|
||||
|
||||
#include "base/check.h"
|
||||
#include "base/feature_list.h"
|
||||
+#include "cef/libcef/features/features.h"
|
||||
+
|
||||
+#if !BUILDFLAG(IS_CEF_SANDBOX_BUILD)
|
||||
#include "third_party/boringssl/src/include/openssl/rand.h"
|
||||
+#endif
|
||||
|
||||
// Prototype for ProcessPrng.
|
||||
// See: https://learn.microsoft.com/en-us/windows/win32/seccng/processprng
|
||||
@@ -27,6 +31,7 @@ namespace base {
|
||||
|
||||
namespace internal {
|
||||
|
||||
+#if !BUILDFLAG(IS_CEF_SANDBOX_BUILD)
|
||||
namespace {
|
||||
|
||||
// The BoringSSl helpers are duplicated in rand_util_fuchsia.cc and
|
||||
@@ -48,6 +53,10 @@ bool UseBoringSSLForRandBytes() {
|
||||
return g_use_boringssl.load(std::memory_order_relaxed);
|
||||
}
|
||||
|
||||
+#else // !BUILDFLAG(IS_CEF_SANDBOX_BUILD)
|
||||
+void ConfigureBoringSSLBackedRandBytesFieldTrial() {}
|
||||
+#endif
|
||||
+
|
||||
} // namespace internal
|
||||
|
||||
namespace {
|
||||
@@ -65,11 +74,13 @@ decltype(&ProcessPrng) GetProcessPrng() {
|
||||
}
|
||||
|
||||
void RandBytesInternal(span<uint8_t> output, bool avoid_allocation) {
|
||||
+#if !BUILDFLAG(IS_CEF_SANDBOX_BUILD)
|
||||
if (!avoid_allocation && internal::UseBoringSSLForRandBytes()) {
|
||||
// BoringSSL's RAND_bytes always returns 1. Any error aborts the program.
|
||||
(void)RAND_bytes(output.data(), output.size());
|
||||
return;
|
||||
}
|
||||
+#endif // !BUILDFLAG(IS_CEF_SANDBOX_BUILD)
|
||||
|
||||
static decltype(&ProcessPrng) process_prng_fn = GetProcessPrng();
|
||||
BOOL success =
|
||||
diff --git base/unguessable_token.cc base/unguessable_token.cc
|
||||
index ea33ca66f384c..33f4cc76f76bd 100644
|
||||
--- base/unguessable_token.cc
|
||||
+++ base/unguessable_token.cc
|
||||
@@ -11,8 +11,9 @@
|
||||
#include "base/format_macros.h"
|
||||
#include "base/rand_util.h"
|
||||
#include "build/build_config.h"
|
||||
+#include "cef/libcef/features/features.h"
|
||||
|
||||
-#if !BUILDFLAG(IS_NACL)
|
||||
+#if !BUILDFLAG(IS_NACL) && !BUILDFLAG(IS_CEF_SANDBOX_BUILD)
|
||||
#include "third_party/boringssl/src/include/openssl/mem.h"
|
||||
#endif
|
||||
|
||||
@@ -58,7 +59,7 @@ std::optional<UnguessableToken> UnguessableToken::DeserializeFromString(
|
||||
}
|
||||
|
||||
bool operator==(const UnguessableToken& lhs, const UnguessableToken& rhs) {
|
||||
-#if BUILDFLAG(IS_NACL)
|
||||
+#if BUILDFLAG(IS_NACL) || BUILDFLAG(IS_CEF_SANDBOX_BUILD)
|
||||
// BoringSSL is unavailable for NaCl builds so it remains timing dependent.
|
||||
return lhs.token_ == rhs.token_;
|
||||
#else
|
||||
diff --git build_overrides/dawn.gni build_overrides/dawn.gni
|
||||
index cec3df3e50b6e..309b4e6a4fe0d 100644
|
||||
--- build_overrides/dawn.gni
|
||||
+++ build_overrides/dawn.gni
|
||||
@@ -2,11 +2,15 @@
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
+import("//base/allocator/partition_allocator/partition_alloc.gni")
|
||||
+
|
||||
# The paths to Dawn's dependencies
|
||||
dawn_angle_dir = "//third_party/angle"
|
||||
dawn_glfw_dir = "//third_party/dawn/third_party/glfw"
|
||||
dawn_googletest_dir = "//third_party/googletest/src"
|
||||
-dawn_partition_alloc_dir = "//base/allocator/partition_allocator"
|
||||
+if (use_partition_alloc) {
|
||||
+ dawn_partition_alloc_dir = "//base/allocator/partition_allocator"
|
||||
+}
|
||||
dawn_jinja2_dir = "//third_party/jinja2"
|
||||
dawn_jsoncpp_dir = "//third_party/jsoncpp"
|
||||
dawn_spirv_tools_dir = "//third_party/spirv-tools/src"
|
Reference in New Issue
Block a user