Skip to content

Commit

Permalink
fix naive
Browse files Browse the repository at this point in the history
  • Loading branch information
klzgrad committed Oct 19, 2024
1 parent afcc2cf commit cbd3776
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/net/tools/naive/naive_proxy_bin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
#include <optional>
#include <string>

#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"
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -305,31 +308,40 @@ 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()
// If we are on a platform where the default allocator is overridden (e.g.
// 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);
Expand Down

0 comments on commit cbd3776

Please sign in to comment.