From cbd37760e8673c7c5abf7c789f253d52a8635a5b Mon Sep 17 00:00:00 2001 From: klzgrad Date: Sat, 19 Oct 2024 09:53:56 +0800 Subject: [PATCH] fix naive --- src/net/tools/naive/naive_proxy_bin.cc | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/net/tools/naive/naive_proxy_bin.cc b/src/net/tools/naive/naive_proxy_bin.cc index 080be85215..7724d8a92c 100644 --- a/src/net/tools/naive/naive_proxy_bin.cc +++ b/src/net/tools/naive/naive_proxy_bin.cc @@ -10,9 +10,6 @@ #include #include -#include "base/allocator/allocator_check.h" -#include "base/allocator/partition_alloc_support.h" -#include "base/allocator/partition_allocator/src/partition_alloc/shim/allocator_shim.h" #include "base/at_exit.h" #include "base/check.h" #include "base/command_line.h" @@ -82,6 +79,12 @@ #include "base/apple/scoped_nsautorelease_pool.h" #endif +#if PA_BUILDFLAG(USE_PARTITION_ALLOC) +#include "base/allocator/allocator_check.h" +#include "base/allocator/partition_alloc_support.h" +#include "base/allocator/partition_allocator/src/partition_alloc/shim/allocator_shim.h" +#endif + namespace { constexpr int kListenBackLog = 512; @@ -305,9 +308,12 @@ int main(int argc, char* argv[]) { // content/app/content_main.cc: RunContentProcess() // content/app/content_main_runner_impl.cc: Initialize() base::AtExitManager exit_manager; + +#if PA_BUILDFLAG(USE_PARTITION_ALLOC) std::string process_type = ""; base::allocator::PartitionAllocSupport::Get()->ReconfigureEarlyish( process_type); +#endif // content/app/content_main.cc: RunContentProcess() // content/app/content_main_runner_impl.cc: Initialize() @@ -315,21 +321,27 @@ int main(int argc, char* argv[]) { // with PartitionAlloc on most platforms) smoke-tests that the overriding // logic is working correctly. If not causes a hard crash, as its unexpected // absence has security implications. +#if PA_BUILDFLAG(USE_PARTITION_ALLOC) CHECK(base::allocator::IsAllocatorInitialized()); +#endif // content/app/content_main.cc: RunContentProcess() // content/app/content_main_runner_impl.cc: Run() base::FeatureList::InitInstance("PartitionConnectionsByNetworkIsolationKey", std::string()); +#if PA_BUILDFLAG(USE_PARTITION_ALLOC) base::allocator::PartitionAllocSupport::Get() ->ReconfigureAfterFeatureListInit(/*process_type=*/""); +#endif base::SingleThreadTaskExecutor io_task_executor(base::MessagePumpType::IO); base::ThreadPoolInstance::CreateAndStartWithDefaultParams("naive"); +#if PA_BUILDFLAG(USE_PARTITION_ALLOC) base::allocator::PartitionAllocSupport::Get()->ReconfigureAfterTaskRunnerInit( process_type); +#endif url::AddStandardScheme("quic", url::SCHEME_WITH_HOST_PORT_AND_USER_INFORMATION);