0

Remove is_multi_dll_chrome.

No behavior change.

Bug: 1056290
Change-Id: Ic7c1de0e00f86d3941f65f8856eb1baf66667dfb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2154725
Commit-Queue: Nico Weber <thakis@chromium.org>
Reviewed-by: Andrey Kosyakov <caseq@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#760296}
This commit is contained in:
Nico Weber
2020-04-18 03:12:46 +00:00
committed by Commit Bot
parent 6960f3200d
commit c36b015eb4
31 changed files with 60 additions and 623 deletions

@ -572,8 +572,7 @@ group("gn_all") {
if (is_android || (is_linux && !is_chromeos)) {
deps += [
"//components/network_hints/browser",
"//content/public/app:browser",
"//content/public/app:child",
"//content/public/app:both",
"//mojo:mojo_perftests",
"//services/service_manager/public/cpp",
"//testing/gmock:gmock_main",

@ -9,7 +9,7 @@ assert(is_win, "This only runs on Windows.")
message_compiler("chrome_events_win") {
visibility = [
"//base/*",
"//chrome:main_dll",
"//chrome:chrome_dll",
]
sources = [ "chrome_events_win.man" ]

@ -8,11 +8,6 @@ declare_args() {
# resources).
is_chrome_branded = false
# Break chrome.dll into multple pieces based on process type. Only available
# on Windows.
# TODO: Remove this flag once m79 has shipped with this disabled.
is_multi_dll_chrome = false
# Turn this on to generate order files. See
# https://chromium.googlesource.com/chromium/src/+/master/docs/win_order_files.md
generate_order_files = false

@ -78,25 +78,6 @@ if (is_win) {
]
deps = [ ":chrome_initial" ]
}
if (!is_multi_dll_chrome) {
# Remove the chrome_child.dll build artifacts from the build directory if
# they're not needed to avoid packaging them in the installer.
# TODO(sebmarchand): Remove this once the multi DLL build isn't supported.
action("remove_chrome_child_artifacts") {
script = "//build/rm.py"
stamp = "$target_gen_dir/chrome_child_clean_up_stamp"
outputs = [ stamp ]
args = [
"--stamp",
rebase_path(stamp, root_build_dir),
"-f",
"chrome_child.dll",
"chrome_child.dll.lib",
"chrome_child.dll.pdb",
]
}
}
}
# This target exists above chrome and it's main components in the dependency
@ -113,10 +94,7 @@ group("assert_no_deps") {
}
if (is_win) {
deps += [
":chrome_dll",
":main_dll",
]
deps += [ ":chrome_dll" ]
}
# This should not pull in installer strings. This is will bloat the binary
@ -124,7 +102,6 @@ group("assert_no_deps") {
# //chrome/installer/util/BUILD.gn.
assert_no_deps = [ "//chrome/installer/util:strings" ]
}
if (!is_android && !is_mac) {
group("chrome") {
public_deps = [ ":chrome_initial" ]
@ -324,27 +301,11 @@ if (!is_android && !is_mac) {
"//chrome/browser/resources/media/mei_preload:component",
"//third_party/widevine/cdm",
]
if (is_multi_dll_chrome) {
defines += [ "CHROME_MULTIPLE_DLL" ]
data_deps += [ ":chrome_child" ]
}
}
} # !is_android && !is_mac
if (is_win) {
# This target is a forwarding target to compile the necessary DLLs used
# by Chrome.
group("chrome_dll") {
data_deps = [ ":main_dll" ]
if (is_multi_dll_chrome) {
data_deps += [ ":chrome_child" ]
} else {
deps = [ ":remove_chrome_child_artifacts" ]
}
}
shared_library("main_dll") {
shared_library("chrome_dll") {
configs += [ "//build/config/compiler:wexit_time_destructors" ]
defines = []
@ -386,82 +347,20 @@ if (is_win) {
]
configs += [ "//build/config/win:delayloads" ]
if (is_multi_dll_chrome) {
configs += [ "//build/config/win:delayloads_not_for_child_dll" ]
}
if (use_aura) {
deps += [ "//ui/compositor" ]
}
if (is_multi_dll_chrome) {
defines += [ "CHROME_MULTIPLE_DLL_BROWSER" ]
deps += [ "//content/public/app:browser" ]
assert_no_deps = [
# The browser DLL may not depend on blink or v8.
"//gin",
"//third_party/blink/public:blink",
"//v8",
# Ditto for PDFium.
"//third_party/pdfium",
]
} else {
deps += [
":child_dependencies",
"//content/public/app:both",
"//headless:headless_renderer",
]
}
deps += [
":child_dependencies",
"//content/public/app:both",
"//headless:headless_renderer",
]
configs += [ "//build/config/compiler:chrome_orderfile_config" ]
}
if (is_multi_dll_chrome) {
# This manifest matches what GYP produced. It may not even be necessary.
windows_manifest("chrome_child_manifest") {
sources = [ as_invoker_manifest ]
}
shared_library("chrome_child") {
sources = [
"app/chrome_main.cc",
"app/chrome_main_delegate.cc",
"app/chrome_main_delegate.h",
]
configs += [ "//build/config/compiler:wexit_time_destructors" ]
defines = [ "CHROME_MULTIPLE_DLL_CHILD" ]
deps = [
":child_dependencies",
":chrome_child_manifest",
":chrome_dll_version",
"//chrome/browser/policy:path_parser",
"//chrome/chrome_elf",
"//chrome/common:buildflags",
"//chrome/common/profiler",
"//chrome/install_static:install_static_util",
"//chrome/install_static:secondary_module",
"//components/browser_watcher:browser_watcher_client",
"//components/crash/core/app",
"//content/public/app:child",
"//content/public/common:service_names",
"//headless:headless_shell_child_lib",
"//services/service_manager/embedder",
]
configs += [ "//build/config/win:delayloads" ]
if (symbol_level == 2) {
# Incremental linking doesn't work on this target in debug mode with
# full symbols, but does work in other cases, including minimal
# symbols.
configs -= [ "//build/config/win:default_incremental_linking" ]
configs += [ "//build/config/win:no_incremental_linking" ]
}
}
}
copy("copy_first_run") {
sources = [ "app/FirstRun" ]
outputs = [ "$root_out_dir/First Run" ]
@ -1621,12 +1520,8 @@ if (enable_resource_whitelist_generation) {
deps = [ "//chrome/android:libchrome" ]
inputs = [ "$root_out_dir/lib.unstripped/libchrome$shlib_extension" ]
} else if (is_win) {
deps = [ ":main_dll" ]
deps = [ ":chrome_dll" ]
inputs = [ "$root_out_dir/chrome.dll.pdb" ]
if (is_multi_dll_chrome) {
deps += [ ":chrome_child" ]
inputs += [ "$root_out_dir/chrome_child.dll.pdb" ]
}
} else {
assert(false, "unsupported platform for whitelist generation")
}

@ -27,6 +27,8 @@
#include "chrome/browser/chrome_content_browser_client.h"
#include "chrome/browser/chrome_resource_bundle_helper.h"
#include "chrome/browser/defaults.h"
#include "chrome/browser/metrics/chrome_feature_list_creator.h"
#include "chrome/browser/startup_data.h"
#include "chrome/common/buildflags.h"
#include "chrome/common/channel_info.h"
#include "chrome/common/chrome_content_client.h"
@ -50,6 +52,7 @@
#include "components/gwp_asan/buildflags/buildflags.h"
#include "components/nacl/common/buildflags.h"
#include "components/services/heap_profiling/public/cpp/profiling_client.h"
#include "components/startup_metric_utils/browser/startup_metric_utils.h"
#include "components/version_info/version_info.h"
#include "content/public/common/content_client.h"
#include "content/public/common/content_constants.h"
@ -160,18 +163,11 @@
#include "components/nacl/renderer/plugin/ppapi_entrypoints.h"
#endif
#if BUILDFLAG(ENABLE_PLUGINS) && (defined(CHROME_MULTIPLE_DLL_CHILD) || \
!defined(CHROME_MULTIPLE_DLL_BROWSER))
#if BUILDFLAG(ENABLE_PLUGINS)
#include "pdf/pdf_ppapi.h"
#endif
#if !defined(CHROME_MULTIPLE_DLL_CHILD)
#include "chrome/browser/metrics/chrome_feature_list_creator.h"
#include "chrome/browser/startup_data.h"
#include "components/startup_metric_utils/browser/startup_metric_utils.h"
#endif
#if !defined(CHROME_MULTIPLE_DLL_BROWSER) && BUILDFLAG(ENABLE_PDF)
#if BUILDFLAG(ENABLE_PDF)
#include "chrome/child/pdf_child_init.h"
#endif
@ -179,14 +175,12 @@
#include "components/gwp_asan/client/gwp_asan.h" // nogncheck
#endif
#if !defined(CHROME_MULTIPLE_DLL_BROWSER)
base::LazyInstance<ChromeContentGpuClient>::DestructorAtExit
g_chrome_content_gpu_client = LAZY_INSTANCE_INITIALIZER;
base::LazyInstance<ChromeContentRendererClient>::DestructorAtExit
g_chrome_content_renderer_client = LAZY_INSTANCE_INITIALIZER;
base::LazyInstance<ChromeContentUtilityClient>::DestructorAtExit
g_chrome_content_utility_client = LAZY_INSTANCE_INITIALIZER;
#endif
extern int NaClMain(const content::MainFunctionParams&);
@ -490,7 +484,6 @@ void InitLogging(const std::string& process_type) {
}
#endif
#if !defined(CHROME_MULTIPLE_DLL_CHILD)
void RecordMainStartupMetrics(base::TimeTicks application_start_time) {
const base::TimeTicks now = base::TimeTicks::Now();
@ -517,7 +510,6 @@ void RecordMainStartupMetrics(base::TimeTicks application_start_time) {
startup_metric_utils::RecordChromeMainEntryTime(now);
}
#endif // !defined(CHROME_MULTIPLE_DLL_CHILD)
} // namespace
@ -525,19 +517,16 @@ ChromeMainDelegate::ChromeMainDelegate()
: ChromeMainDelegate(base::TimeTicks()) {}
ChromeMainDelegate::ChromeMainDelegate(base::TimeTicks exe_entry_point_ticks) {
#if !defined(CHROME_MULTIPLE_DLL_CHILD)
// Record startup metrics in the browser process. For component builds, there
// is no way to know the type of process (process command line is not yet
// initialized), so the function below will also be called in renderers.
// This doesn't matter as it simply sets global variables.
RecordMainStartupMetrics(exe_entry_point_ticks);
#endif // !defined(CHROME_MULTIPLE_DLL_CHILD)
}
ChromeMainDelegate::~ChromeMainDelegate() {
}
#if !defined(CHROME_MULTIPLE_DLL_CHILD)
void ChromeMainDelegate::PostEarlyInitialization(bool is_running_tests) {
// Chrome disallows cookies by default. All code paths that want to use
// cookies need to go through one of Chrome's URLRequestContexts which have
@ -595,8 +584,6 @@ bool ChromeMainDelegate::ShouldCreateFeatureList() {
return false;
}
#endif
void ChromeMainDelegate::PostFieldTrialInitialization() {
std::string process_type =
base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
@ -697,7 +684,7 @@ bool ChromeMainDelegate::BasicStartupComplete(int* exit_code) {
tracing_sampler_profiler_ =
tracing::TracingSamplerProfiler::CreateOnMainThread();
#if defined(OS_WIN) && !defined(CHROME_MULTIPLE_DLL_BROWSER)
#if defined(OS_WIN)
v8_crashpad_support::SetUp();
#endif
@ -748,7 +735,7 @@ bool ChromeMainDelegate::BasicStartupComplete(int* exit_code) {
// references anymore. Not sure if that means this can be enabled on Android or
// not though. As there is no easily accessible command line on Android, I'm
// not sure this is a big deal.
#if !defined(OS_ANDROID) && !defined(CHROME_MULTIPLE_DLL_CHILD)
#if !defined(OS_ANDROID)
// If we are in diagnostics mode this is the end of the line: after the
// diagnostics are run the process will invariably exit.
if (command_line.HasSwitch(switches::kDiagnostics)) {
@ -1074,7 +1061,7 @@ void ChromeMainDelegate::PreSandboxStartup() {
// line for crash reporting.
crash_keys::SetCrashKeysFromCommandLine(command_line);
#if !defined(CHROME_MULTIPLE_DLL_BROWSER) && BUILDFLAG(ENABLE_PDF)
#if BUILDFLAG(ENABLE_PDF)
MaybeInitializeGDI();
#endif
}
@ -1090,7 +1077,6 @@ void ChromeMainDelegate::SandboxInitialized(const std::string& process_type) {
SuppressWindowsErrorDialogs();
#endif
#if defined(CHROME_MULTIPLE_DLL_CHILD) || !defined(CHROME_MULTIPLE_DLL_BROWSER)
#if BUILDFLAG(ENABLE_NACL)
ChromeContentClient::SetNaClEntryFunctions(
nacl_plugin::PPP_GetInterface,
@ -1103,7 +1089,6 @@ void ChromeMainDelegate::SandboxInitialized(const std::string& process_type) {
chrome_pdf::PPP_InitializeModule,
chrome_pdf::PPP_ShutdownModule);
#endif
#endif
}
int ChromeMainDelegate::RunProcess(
@ -1116,8 +1101,7 @@ int ChromeMainDelegate::RunProcess(
NOTREACHED(); // Android provides a subclass and shares no code here.
#else
static const MainFunction kMainFunctions[] = {
#if BUILDFLAG(ENABLE_PRINT_PREVIEW) && !defined(CHROME_MULTIPLE_DLL_CHILD) && \
!defined(OS_CHROMEOS)
#if BUILDFLAG(ENABLE_PRINT_PREVIEW) && !defined(OS_CHROMEOS)
{switches::kCloudPrintServiceProcess, CloudPrintServiceProcessMain},
#endif
@ -1127,12 +1111,11 @@ int ChromeMainDelegate::RunProcess(
// This entry is not needed on Linux, where the NaCl loader
// process is launched via nacl_helper instead.
#if BUILDFLAG(ENABLE_NACL) && !defined(CHROME_MULTIPLE_DLL_BROWSER) && \
!defined(OS_LINUX)
#if BUILDFLAG(ENABLE_NACL) && !defined(OS_LINUX)
{switches::kNaClLoaderProcess, NaClMain},
#else
{"<invalid>", NULL}, // To avoid constant array of size 0
// when NaCl disabled and CHROME_MULTIPLE_DLL_CHILD
{"<invalid>", nullptr}, // To avoid constant array of size 0
// when NaCl disabled
#endif
};
@ -1202,9 +1185,6 @@ content::ContentClient* ChromeMainDelegate::CreateContentClient() {
content::ContentBrowserClient*
ChromeMainDelegate::CreateContentBrowserClient() {
#if defined(CHROME_MULTIPLE_DLL_CHILD)
return NULL;
#else
if (chrome_content_browser_client_ == nullptr) {
DCHECK(!startup_data_);
startup_data_ = std::make_unique<StartupData>();
@ -1213,33 +1193,20 @@ ChromeMainDelegate::CreateContentBrowserClient() {
std::make_unique<ChromeContentBrowserClient>(startup_data_.get());
}
return chrome_content_browser_client_.get();
#endif
}
content::ContentGpuClient* ChromeMainDelegate::CreateContentGpuClient() {
#if defined(CHROME_MULTIPLE_DLL_BROWSER)
return nullptr;
#else
return g_chrome_content_gpu_client.Pointer();
#endif
}
content::ContentRendererClient*
ChromeMainDelegate::CreateContentRendererClient() {
#if defined(CHROME_MULTIPLE_DLL_BROWSER)
return NULL;
#else
return g_chrome_content_renderer_client.Pointer();
#endif
}
content::ContentUtilityClient*
ChromeMainDelegate::CreateContentUtilityClient() {
#if defined(CHROME_MULTIPLE_DLL_BROWSER)
return NULL;
#else
return g_chrome_content_utility_client.Pointer();
#endif
}
service_manager::ProcessType ChromeMainDelegate::OverrideProcessType() {

@ -11,13 +11,10 @@
#include "base/macros.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "chrome/browser/startup_data.h"
#include "chrome/common/chrome_content_client.h"
#include "content/public/app/content_main_delegate.h"
#if !defined(CHROME_MULTIPLE_DLL_CHILD)
#include "chrome/browser/startup_data.h"
#endif
namespace base {
class CommandLine;
}
@ -59,10 +56,8 @@ class ChromeMainDelegate : public content::ContentMainDelegate {
#endif
service_manager::ProcessType OverrideProcessType() override;
void PreCreateMainMessageLoop() override;
#if !defined(CHROME_MULTIPLE_DLL_CHILD)
void PostEarlyInitialization(bool is_running_tests) override;
bool ShouldCreateFeatureList() override;
#endif // !defined(CHROME_MULTIPLE_DLL_CHILD)
void PostFieldTrialInitialization() override;
content::ContentClient* CreateContentClient() override;
@ -81,9 +76,7 @@ class ChromeMainDelegate : public content::ContentMainDelegate {
std::unique_ptr<ChromeContentBrowserClient> chrome_content_browser_client_;
#if !defined(CHROME_MULTIPLE_DLL_CHILD)
std::unique_ptr<StartupData> startup_data_;
#endif
std::unique_ptr<tracing::TracingSamplerProfiler> tracing_sampler_profiler_;

@ -113,11 +113,7 @@ HMODULE MainDllLoader::Load(base::FilePath* module) {
if (ProcessTypeUsesMainDll(process_type_)) {
dll_name = installer::kChromeDll;
} else {
#if defined(CHROME_MULTIPLE_DLL)
dll_name = installer::kChromeChildDll;
#else
dll_name = installer::kChromeDll;
#endif
}
*module = GetModulePath(dll_name);

@ -4063,10 +4063,6 @@ jumbo_static_library("browser") {
]
}
if (is_multi_dll_chrome) {
defines += [ "CHROME_MULTIPLE_DLL_BROWSER" ]
}
if (is_chrome_branded) {
deps += [
"//chrome/browser/win/conflicts:module_list_proto",

@ -3642,16 +3642,8 @@ bool ChromeContentBrowserClient::PreSpawnRenderer(sandbox::TargetPolicy* policy,
if (result != sandbox::SBOX_ALL_OK)
return false;
// Allow loading Chrome's DLLs. The name of this depends on whether
// is_multi_dll_chrome is defined or not. For multi-DLL Chrome,
// chrome_child.dll is loaded, but for single-DLL Chrome, it would be the
// same DLL as the browser process.
#if defined(CHROME_MULTIPLE_DLL_BROWSER)
constexpr auto* child_dll_path = chrome::kChildDll;
#else
constexpr auto* child_dll_path = chrome::kBrowserResourcesDll;
#endif
for (const auto* dll : {child_dll_path, chrome::kElfDll}) {
// Allow loading Chrome's DLLs.
for (const auto* dll : {chrome::kBrowserResourcesDll, chrome::kElfDll}) {
result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_SIGNED_BINARY,
sandbox::TargetPolicy::SIGNED_ALLOW_LOAD,
GetModulePath(dll).value().c_str());

@ -500,9 +500,6 @@ static_library("common") {
}
if (enable_cdm_host_verification) {
if (is_win && is_multi_dll_chrome) {
defines += [ "CHROME_MULTIPLE_DLL" ]
}
sources += [
"media/cdm_host_file_path.cc",
"media/cdm_host_file_path.h",

@ -123,8 +123,6 @@ const base::FilePath::CharType kFrameworkExecutableName[] =
#if defined(OS_WIN)
const base::FilePath::CharType kBrowserResourcesDll[] = FPL("chrome.dll");
// Only relevant if building with is_multi_dll_chrome=true.
const base::FilePath::CharType kChildDll[] = FPL("chrome_child.dll");
const base::FilePath::CharType kElfDll[] = FPL("chrome_elf.dll");
const base::FilePath::CharType kStatusTrayWindowClass[] =
FPL("Chrome_StatusTrayWindow");

@ -33,7 +33,6 @@ extern const base::FilePath::CharType kFrameworkExecutableName[];
#endif // OS_MACOSX
#if defined(OS_WIN)
extern const base::FilePath::CharType kBrowserResourcesDll[];
extern const base::FilePath::CharType kChildDll[];
extern const base::FilePath::CharType kElfDll[];
extern const base::FilePath::CharType kStatusTrayWindowClass[];
#endif // defined(OS_WIN)

@ -47,12 +47,7 @@ void AddCdmHostFilePaths(
chrome::kBrowserProcessExecutableName};
static const base::FilePath::CharType* const kVersionedFiles[] = {
#if defined(CHROME_MULTIPLE_DLL)
chrome::kBrowserResourcesDll,
chrome::kChildDll
#else
chrome::kBrowserResourcesDll
#endif // defined(CHROME_MULTIPLE_DLL)
};
// Find where chrome.exe is installed.

@ -294,7 +294,7 @@ template("generate_mini_installer") {
generate_mini_installer("mini_installer") {
out_dir = root_out_dir
chrome_dll_file = "$root_out_dir/chrome.dll"
chrome_dll_target = "//chrome:main_dll"
chrome_dll_target = "//chrome:chrome_dll"
}
# previous_version_mini_installer.exe can't be generated in an x86 Debug

@ -6809,11 +6809,6 @@ if (is_win) {
output_name = "delayloads_unittests"
sources = [ "delayload/delayloads_unittest.cc" ]
defines = []
if (is_multi_dll_chrome) {
defines = [ "CHROME_MULTIPLE_DLL_BROWSER" ]
}
include_dirs = [ "$target_gen_dir" ]
deps = [
"//base",

@ -93,7 +93,6 @@ TEST_F(DelayloadsTest, ChromeDllDelayloadsCheck) {
static const char* const kValidFilePatterns[] = {
"KERNEL32.dll",
"chrome_elf.dll",
#if !defined(CHROME_MULTIPLE_DLL_BROWSER)
"DWrite.dll",
"ADVAPI32.dll",
"CRYPT32.dll",
@ -110,7 +109,6 @@ TEST_F(DelayloadsTest, ChromeDllDelayloadsCheck) {
"WINSPOOL.DRV",
"WINTRUST.dll",
"WS2_32.dll",
#endif // CHROME_MULTIPLE_DLL_BROWSER
// On 64 bit the Version API's like VerQueryValue come from VERSION.dll.
// It depends on kernel32, advapi32 and api-ms-win-crt*.dll. This should
// be ok.
@ -177,10 +175,6 @@ TEST_F(DelayloadsTest, DISABLED_ChromeDllLoadSanityTestImpl) {
HMODULE chrome_module_handle = ::LoadLibrary(dll.value().c_str());
ASSERT_TRUE(chrome_module_handle != nullptr);
#if defined(CHROME_MULTIPLE_DLL_BROWSER)
// Loading chrome.dll should not load user32.dll.
EXPECT_EQ(nullptr, ::GetModuleHandle(L"user32.dll"));
#else
// Loading chrome.dll should not load user32.dll on Win10.
// On Win7, chains of system dlls and lack of apisets result in it loading.
if (base::win::GetVersion() >= base::win::Version::WIN10) {
@ -188,112 +182,8 @@ TEST_F(DelayloadsTest, DISABLED_ChromeDllLoadSanityTestImpl) {
} else {
EXPECT_NE(nullptr, ::GetModuleHandle(L"user32.dll"));
}
#endif // CHROME_MULTIPLE_DLL_BROWSER
}
#if defined(CHROME_MULTIPLE_DLL_BROWSER)
TEST_F(DelayloadsTest, ChromeChildDllDelayloadsCheck) {
base::FilePath dll;
ASSERT_TRUE(base::PathService::Get(base::DIR_EXE, &dll));
dll = dll.Append(L"chrome_child.dll");
std::vector<std::string> dll_imports;
GetImports(dll, &dll_imports);
// Check that the dll has imports.
ASSERT_LT(0u, dll_imports.size())
<< "Ensure the delayloads_unittests "
"target was built, instead of delayloads_unittests.exe";
static const char* const kValidFilePatterns[] = {
"KERNEL32.dll",
"chrome_elf.dll",
"DWrite.dll",
"ADVAPI32.dll",
"CRYPT32.dll",
"dbghelp.dll",
"dhcpcsvc.DLL",
"IPHLPAPI.DLL",
"ntdll.dll",
"OLEAUT32.dll",
"Secur32.dll",
"UIAutomationCore.DLL",
"USERENV.dll",
"WINHTTP.dll",
"WINMM.dll",
"WINSPOOL.DRV",
"WINTRUST.dll",
"WS2_32.dll",
// On 64 bit the Version API's like VerQueryValue come from VERSION.dll.
// It depends on kernel32, advapi32 and api-ms-win-crt*.dll. This should
// be ok.
"VERSION.dll",
};
// Make sure all of chrome_child.dll's imports are in the valid imports list.
for (const std::string& dll_import : dll_imports) {
bool match = false;
for (const char* kValidFilePattern : kValidFilePatterns) {
if (base::MatchPattern(dll_import, kValidFilePattern)) {
match = true;
break;
}
}
EXPECT_TRUE(match) << "Illegal import in chrome_child.dll: " << dll_import;
}
}
TEST_F(DelayloadsTest, ChromeChildDllLoadSanityTest) {
// On Win7 we expect this test to result in user32.dll getting loaded. As a
// result, we need to ensure it is executed in its own test process. This
// "test" will re-launch with custom parameters to accomplish that.
base::CommandLine new_test =
base::CommandLine(base::CommandLine::ForCurrentProcess()->GetProgram());
new_test.AppendSwitchASCII(
base::kGTestFilterFlag,
"DelayloadsTest.DISABLED_ChromeChildDllLoadSanityTestImpl");
new_test.AppendSwitch("gtest_also_run_disabled_tests");
new_test.AppendSwitch("single-process-tests");
std::string output;
ASSERT_TRUE(base::GetAppOutput(new_test, &output));
std::string crash_string =
"OK ] DelayloadsTest.DISABLED_ChromeChildDllLoadSanityTestImpl";
if (output.find(crash_string) == std::string::npos) {
GTEST_FAIL() << "Couldn't find\n"
<< crash_string << "\n in output\n " << output;
}
}
// Note: This test is not actually disabled, it's just tagged disabled so that
// the real run (above, in ChromeChildDllLoadSanityTest) can run it with an
// argument added to the command line.
TEST_F(DelayloadsTest, DISABLED_ChromeChildDllLoadSanityTestImpl) {
base::FilePath dll;
ASSERT_TRUE(base::PathService::Get(base::DIR_EXE, &dll));
dll = dll.Append(L"chrome_child.dll");
// We don't expect user32 to be loaded in delayloads_unittests. If this
// test case fails, then it means that a dependency on user32 has crept into
// the delayloads_unittests executable, which needs to be removed.
// NOTE: it may be a secondary dependency of another system DLL. If so,
// try adding a "/DELAYLOAD:<blah>.dll" to the build.gn file.
ASSERT_EQ(nullptr, ::GetModuleHandle(L"user32.dll"));
HMODULE chrome_child_module_handle = ::LoadLibrary(dll.value().c_str());
ASSERT_TRUE(chrome_child_module_handle != nullptr);
// Loading chrome_child.dll should not load user32.dll on Win10.
// On Win7, chains of system dlls and lack of apisets result in it loading.
if (base::win::GetVersion() >= base::win::Version::WIN10) {
EXPECT_EQ(nullptr, ::GetModuleHandle(L"user32.dll"));
} else {
EXPECT_NE(nullptr, ::GetModuleHandle(L"user32.dll"));
}
}
#endif // CHROME_MULTIPLE_DLL_BROWSER
TEST_F(DelayloadsTest, ChromeElfDllDelayloadsCheck) {
base::FilePath dll;
ASSERT_TRUE(base::PathService::Get(base::DIR_EXE, &dll));

@ -9,6 +9,8 @@ import("//ppapi/buildflags/buildflags.gni")
# Implements "content_main" given the defines and visibility. On Windows this
# is compiled with a different define for browser and child, but all code needs
# to be shared.
# TODO(https://crbug.com/1056290): Inline the template now that it only has
# a single use.
template("implement_content_app") {
runner_target_name = "content_main_runner_" + target_name
main_target_name = target_name
@ -64,7 +66,7 @@ template("implement_content_app") {
]
}
if (!is_multi_dll_chrome && enable_plugins) {
if (enable_plugins) {
content_app_deps += [ "//content/ppapi_plugin:ppapi_plugin_sources" ]
}
@ -182,21 +184,3 @@ group("both_for_content_tests") {
public_deps = [ ":both" ]
}
}
if (is_multi_dll_chrome) {
# It doesn't make sense to do the browser/child dll split in component mode.
assert(!is_component_build)
implement_content_app("browser") {
visibility = [ "//content/public/app:browser" ]
defines = [ "CHROME_MULTIPLE_DLL_BROWSER" ]
deps = [ ":content_app_browser_deps" ]
include_browser_sources = true
}
implement_content_app("child") {
visibility = [ "//content/public/app:child" ]
defines = [ "CHROME_MULTIPLE_DLL_CHILD" ]
deps = [ ":content_app_child_deps" ]
}
}

@ -49,15 +49,22 @@
#include "components/download/public/common/download_task_runner.h"
#include "content/app/mojo/mojo_init.h"
#include "content/app/service_manager_environment.h"
#include "content/browser/browser_main.h"
#include "content/browser/browser_process_sub_thread.h"
#include "content/browser/browser_thread_impl.h"
#include "content/browser/gpu/gpu_main_thread_factory.h"
#include "content/browser/renderer_host/render_process_host_impl.h"
#include "content/browser/scheduler/browser_task_executor.h"
#include "content/browser/startup_data_impl.h"
#include "content/browser/startup_helper.h"
#include "content/browser/tracing/memory_instrumentation_util.h"
#include "content/browser/utility_process_host.h"
#include "content/child/field_trial.h"
#include "content/common/content_constants_internal.h"
#include "content/common/url_schemes.h"
#include "content/gpu/in_process_gpu_thread.h"
#include "content/public/app/content_main_delegate.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/system_connector.h"
#include "content/public/common/content_constants.h"
#include "content/public/common/content_descriptor_keys.h"
@ -67,6 +74,11 @@
#include "content/public/common/main_function_params.h"
#include "content/public/common/network_service_util.h"
#include "content/public/common/sandbox_init.h"
#include "content/public/gpu/content_gpu_client.h"
#include "content/public/renderer/content_renderer_client.h"
#include "content/public/utility/content_utility_client.h"
#include "content/renderer/in_process_renderer_thread.h"
#include "content/utility/in_process_utility_thread.h"
#include "gin/v8_initializer.h"
#include "media/base/media.h"
#include "media/media_buildflags.h"
@ -135,27 +147,6 @@
#endif // OS_LINUX
#if !defined(CHROME_MULTIPLE_DLL_BROWSER)
#include "content/child/field_trial.h"
#include "content/public/gpu/content_gpu_client.h"
#include "content/public/renderer/content_renderer_client.h"
#include "content/public/utility/content_utility_client.h"
#endif
#if !defined(CHROME_MULTIPLE_DLL_CHILD)
#include "content/browser/browser_main.h"
#include "content/public/browser/content_browser_client.h"
#endif
#if !defined(CHROME_MULTIPLE_DLL_BROWSER) && !defined(CHROME_MULTIPLE_DLL_CHILD)
#include "content/browser/gpu/gpu_main_thread_factory.h"
#include "content/browser/renderer_host/render_process_host_impl.h"
#include "content/browser/utility_process_host.h"
#include "content/gpu/in_process_gpu_thread.h"
#include "content/renderer/in_process_renderer_thread.h"
#include "content/utility/in_process_utility_thread.h"
#endif
#if BUILDFLAG(USE_ZYGOTE_HANDLE)
#include "content/browser/sandbox_host_linux.h"
#include "media/base/media_switches.h"
@ -220,9 +211,7 @@ void LoadV8SnapshotFile() {
}
#endif // OS_POSIX && !OS_MACOSX
#if !defined(CHROME_MULTIPLE_DLL_BROWSER)
gin::V8Initializer::LoadV8Snapshot(kSnapshotType);
#endif // !CHROME_MULTIPLE_DLL_BROWSER
}
#endif // V8_USE_EXTERNAL_STARTUP_DATA
@ -415,12 +404,9 @@ class ContentClientInitializer {
static void Set(const std::string& process_type,
ContentMainDelegate* delegate) {
ContentClient* content_client = GetContentClient();
#if !defined(CHROME_MULTIPLE_DLL_CHILD)
if (process_type.empty())
content_client->browser_ = delegate->CreateContentBrowserClient();
#endif // !CHROME_MULTIPLE_DLL_CHILD
#if !defined(CHROME_MULTIPLE_DLL_BROWSER)
base::CommandLine* cmd = base::CommandLine::ForCurrentProcess();
if (process_type == switches::kGpuProcess ||
cmd->HasSwitch(switches::kSingleProcess) ||
@ -434,7 +420,6 @@ class ContentClientInitializer {
if (process_type == switches::kUtilityProcess ||
cmd->HasSwitch(switches::kSingleProcess))
content_client->utility_ = delegate->CreateContentUtilityClient();
#endif // !CHROME_MULTIPLE_DLL_BROWSER
}
};
@ -500,26 +485,13 @@ int RunZygote(ContentMainDelegate* delegate) {
#endif // BUILDFLAG(USE_ZYGOTE_HANDLE)
static void RegisterMainThreadFactories() {
#if !defined(CHROME_MULTIPLE_DLL_BROWSER) && !defined(CHROME_MULTIPLE_DLL_CHILD)
UtilityProcessHost::RegisterUtilityMainThreadFactory(
CreateInProcessUtilityThread);
RenderProcessHostImpl::RegisterRendererMainThreadFactory(
CreateInProcessRendererThread);
content::RegisterGpuMainThreadFactory(CreateInProcessGpuThread);
#else
base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess();
if (command_line.HasSwitch(switches::kSingleProcess)) {
LOG(FATAL)
<< "--single-process is not supported in chrome multiple dll browser.";
}
if (command_line.HasSwitch(switches::kInProcessGPU)) {
LOG(FATAL)
<< "--in-process-gpu is not supported in chrome multiple dll browser.";
}
#endif // !CHROME_MULTIPLE_DLL_BROWSER && !CHROME_MULTIPLE_DLL_CHILD
}
#if !defined(CHROME_MULTIPLE_DLL_CHILD)
// Run the main function for browser process.
// Returns the exit code for this process.
int RunBrowserProcessMain(const MainFunctionParams& main_function_params,
@ -529,14 +501,12 @@ int RunBrowserProcessMain(const MainFunctionParams& main_function_params,
return exit_code;
return BrowserMain(main_function_params);
}
#endif // !defined(CHROME_MULTIPLE_DLL_CHILD)
// Run the FooMain() for a given process type.
// Returns the exit code for this process.
int RunOtherNamedProcessTypeMain(const std::string& process_type,
const MainFunctionParams& main_function_params,
ContentMainDelegate* delegate) {
#if !defined(CHROME_MULTIPLE_DLL_BROWSER)
static const MainFunction kMainFunctions[] = {
#if BUILDFLAG(ENABLE_PLUGINS)
{switches::kPpapiPluginProcess, PpapiPluginMain},
@ -555,7 +525,6 @@ int RunOtherNamedProcessTypeMain(const std::string& process_type,
return kMainFunctions[i].function(main_function_params);
}
}
#endif // !CHROME_MULTIPLE_DLL_BROWSER
#if BUILDFLAG(USE_ZYGOTE_HANDLE)
// Zygote startup is special -- see RunZygote comments above
@ -853,7 +822,6 @@ int ContentMainRunnerImpl::Run(bool start_service_manager_only) {
std::string process_type =
command_line.GetSwitchValueASCII(switches::kProcessType);
#if !defined(CHROME_MULTIPLE_DLL_BROWSER)
// Run this logic on all child processes. Zygotes will run this at a later
// point in time when the command line has been updated.
if (!process_type.empty() &&
@ -861,7 +829,6 @@ int ContentMainRunnerImpl::Run(bool start_service_manager_only) {
InitializeFieldTrialAndFeatureList();
delegate_->PostFieldTrialInitialization();
}
#endif
MainFunctionParams main_params(command_line);
main_params.ui_task = ui_task_;
@ -874,15 +841,12 @@ int ContentMainRunnerImpl::Run(bool start_service_manager_only) {
RegisterMainThreadFactories();
#if !defined(CHROME_MULTIPLE_DLL_CHILD)
if (process_type.empty())
return RunServiceManager(main_params, start_service_manager_only);
#endif // !defined(CHROME_MULTIPLE_DLL_CHILD)
return RunOtherNamedProcessTypeMain(process_type, main_params, delegate_);
}
#if !defined(CHROME_MULTIPLE_DLL_CHILD)
int ContentMainRunnerImpl::RunServiceManager(MainFunctionParams& main_params,
bool start_service_manager_only) {
TRACE_EVENT0("startup", "ContentMainRunnerImpl::RunServiceManager");
@ -979,15 +943,12 @@ int ContentMainRunnerImpl::RunServiceManager(MainFunctionParams& main_params,
main_params.startup_data = startup_data_.get();
return RunBrowserProcessMain(main_params, delegate_);
}
#endif // !defined(CHROME_MULTIPLE_DLL_CHILD)
void ContentMainRunnerImpl::Shutdown() {
DCHECK(is_initialized_);
DCHECK(!is_shutdown_);
#if !defined(CHROME_MULTIPLE_DLL_CHILD)
service_manager_environment_.reset();
#endif
if (completed_basic_startup_) {
const base::CommandLine& command_line =
@ -998,11 +959,9 @@ void ContentMainRunnerImpl::Shutdown() {
delegate_->ProcessExiting(process_type);
}
#if !defined(CHROME_MULTIPLE_DLL_CHILD)
service_manager_environment_.reset();
// The BrowserTaskExecutor needs to be destroyed before |exit_manager_|.
BrowserTaskExecutor::Shutdown();
#endif // !defined(CHROME_MULTIPLE_DLL_CHILD)
#if defined(OS_WIN)
#ifdef _CRTDBG_MAP_ALLOC

@ -52,7 +52,6 @@ class ContentMainRunnerImpl : public ContentMainRunner {
void Shutdown() override;
private:
#if !defined(CHROME_MULTIPLE_DLL_CHILD)
int RunServiceManager(MainFunctionParams& main_function_params,
bool start_service_manager_only);
@ -65,7 +64,6 @@ class ContentMainRunnerImpl : public ContentMainRunner {
discardable_shared_memory_manager_;
std::unique_ptr<StartupDataImpl> startup_data_;
std::unique_ptr<ServiceManagerEnvironment> service_manager_environment_;
#endif // !defined(CHROME_MULTIPLE_DLL_CHILD)
// True if the runner has been initialized.
bool is_initialized_ = false;

@ -112,57 +112,9 @@ if (is_component_build) {
]
}
if (is_multi_dll_chrome) {
source_set("browser") {
check_includes = false # See comment above.
sources = public_app_shared_sources
defines = [ "CHROME_MULTIPLE_DLL_BROWSER" ]
configs += [ "//content:content_implementation" ]
deps = public_app_shared_deps + [
"//content/app:browser",
"//content/public/browser",
"//content/public/common",
]
allow_circular_includes_from = [
# This target is a pair with the non-public version. They always go
# together and include headers from each other.
"//content/app:browser",
]
}
source_set("child") {
check_includes = false # See comment above.
sources = public_app_shared_sources
defines = [ "CHROME_MULTIPLE_DLL_CHILD" ]
configs += [ "//content:content_implementation" ]
deps = public_app_shared_deps + [
"//content/app:child",
"//content/public/common",
]
allow_circular_includes_from = [
# This target is a pair with the non-public version. They always go
# together and include headers from each other.
"//content/app:child",
]
}
} else {
# When the multi-DLL build is disabled, there is only one type of the
# "app" target, and "browser" and "child" are the same as "both".
group("browser") {
deps = [ ":both" ]
}
group("child") {
deps = [ ":both" ]
}
}
# When the multi-DLL build is disabled, there is only one type of the
# "app" target, and "browser" and "child" are the same as "both".
# TODO(https://crbug.com/1056290): Remove these now that they are pointless.
}
source_set("content_browser_manifest") {

@ -6,15 +6,12 @@
#include "base/logging.h"
#include "build/build_config.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/common/content_client.h"
#include "content/public/gpu/content_gpu_client.h"
#include "content/public/renderer/content_renderer_client.h"
#include "content/public/utility/content_utility_client.h"
#if !defined(CHROME_MULTIPLE_DLL_CHILD)
#include "content/public/browser/content_browser_client.h"
#endif
namespace content {
bool ContentMainDelegate::BasicStartupComplete(int* exit_code) {
@ -61,35 +58,19 @@ ContentClient* ContentMainDelegate::CreateContentClient() {
}
ContentBrowserClient* ContentMainDelegate::CreateContentBrowserClient() {
#if defined(CHROME_MULTIPLE_DLL_CHILD)
return NULL;
#else
return new ContentBrowserClient();
#endif
}
ContentGpuClient* ContentMainDelegate::CreateContentGpuClient() {
#if defined(CHROME_MULTIPLE_DLL_BROWSER)
return NULL;
#else
return new ContentGpuClient();
#endif
}
ContentRendererClient* ContentMainDelegate::CreateContentRendererClient() {
#if defined(CHROME_MULTIPLE_DLL_BROWSER)
return NULL;
#else
return new ContentRendererClient();
#endif
}
ContentUtilityClient* ContentMainDelegate::CreateContentUtilityClient() {
#if defined(CHROME_MULTIPLE_DLL_BROWSER)
return NULL;
#else
return new ContentUtilityClient();
#endif
}
} // namespace content

@ -3,20 +3,20 @@
A build mode where chrome.dll is split into two separate DLLs. This was
undertaken as one possible workaround for toolchain limitations on Windows.
We removed support for this again after the toolchain limitations were fixed,
see https://crbug.com/726150.
## How
Split DLL is now default on Windows and controlled by the
`is_multi_dll_chrome` gn variable.
`is_multi_dll_chrome` applies only to chrome.dll (and not test binaries).
Split DLL used to be controlled by the `is_multi_dll_chrome` gn variable.
## Details
This forcible split is implemented by putting .lib files in either one DLL or
This forcible split was implemented by putting .lib files in either one DLL or
the other, and causing unresolved externals that result during linking to be
forcibly exported from the other DLL. This works relatively cleanly for function
import/export, however it cannot work for data export.
Some more details can be found on the initial commit of the split_link script
Some more details can be found on the initial commit of the `split_link` script
https://src.chromium.org/viewvc/chrome?revision=200049&view=revision and the
associated bugs: https://crbug.com/237249 https://crbug.com/237267.

@ -696,7 +696,6 @@ if (is_win) {
sources = [
"app/headless_shell.cc",
"app/headless_shell.h",
"app/headless_shell_win.cc",
"lib/browser/headless_content_browser_client.cc",
"lib/browser/headless_content_browser_client.h",
"public/headless_shell.h",
@ -711,56 +710,6 @@ if (is_win) {
"//net",
"//sandbox",
]
if (is_multi_dll_chrome) {
defines = [ "CHROME_MULTIPLE_DLL_BROWSER" ]
sources += [
"lib/browser/headless_web_contents_impl.cc",
"lib/browser/headless_web_contents_impl.h",
"lib/headless_content_main_delegate.cc",
"lib/headless_content_main_delegate.h",
"lib/headless_content_main_delegate_win.cc",
]
deps += [
"//components/crash/core/common:crash_key",
"//third_party/blink/public:blink_headers",
]
}
}
if (is_multi_dll_chrome) {
# Headless library with child specific dependencies (e.g., renderer). This
# is used when no browser depencendies are needed (e.g. chrome:child_dll).
static_library("headless_shell_child_lib") {
sources = [
"app/headless_shell.cc",
"app/headless_shell.h",
"app/headless_shell_win.cc",
"public/headless_shell.h",
]
deps = [
":headless_renderer",
"//build:branding_buildflags",
"//content/public/child:child",
"//net",
"//ui/base",
]
defines = [ "CHROME_MULTIPLE_DLL_CHILD" ]
sources += [
"lib/browser/headless_web_contents_impl.cc",
"lib/browser/headless_web_contents_impl.h",
"lib/headless_content_main_delegate.cc",
"lib/headless_content_main_delegate.h",
"lib/headless_content_main_delegate_win.cc",
"lib/utility/headless_content_utility_client.cc",
"lib/utility/headless_content_utility_client.h",
]
deps += [
"//components/crash/core/common:crash_key",
"//third_party/blink/public:blink_headers",
]
}
}
}

@ -35,6 +35,8 @@
#include "content/public/common/content_switches.h"
#include "headless/app/headless_shell.h"
#include "headless/app/headless_shell_switches.h"
#include "headless/lib/browser/headless_browser_impl.h"
#include "headless/lib/browser/headless_devtools.h"
#include "headless/lib/headless_content_main_delegate.h"
#include "headless/public/headless_devtools_target.h"
#include "net/base/filename_util.h"
@ -54,11 +56,6 @@
#include "sandbox/win/src/sandbox_types.h"
#endif
#if !defined(CHROME_MULTIPLE_DLL_CHILD)
#include "headless/lib/browser/headless_browser_impl.h"
#include "headless/lib/browser/headless_devtools.h"
#endif
namespace headless {
namespace {
@ -102,7 +99,6 @@ bool ParseFontRenderHinting(
return true;
}
#if !defined(CHROME_MULTIPLE_DLL_CHILD)
GURL ConvertArgumentToURL(const base::CommandLine::StringType& arg) {
GURL url(arg);
if (url.is_valid() && url.has_scheme())
@ -143,8 +139,6 @@ base::FilePath GetSSLKeyLogFile(const base::CommandLine* command_line) {
#endif
}
#endif // !defined(CHROME_MULTIPLE_DLL_CHILD)
int RunContentMain(
HeadlessBrowser::Options options,
base::OnceCallback<void(HeadlessBrowser*)> on_browser_start_callback) {
@ -162,13 +156,9 @@ int RunContentMain(
// TODO(skyostil): Implement custom message pumps.
DCHECK(!options.message_pump);
#if defined(CHROME_MULTIPLE_DLL_CHILD)
HeadlessContentMainDelegate delegate(std::move(options));
#else
auto browser = std::make_unique<HeadlessBrowserImpl>(
std::move(on_browser_start_callback), std::move(options));
HeadlessContentMainDelegate delegate(std::move(browser));
#endif
params.delegate = &delegate;
return content::ContentMain(params);
}
@ -225,7 +215,6 @@ HeadlessShell::HeadlessShell() = default;
HeadlessShell::~HeadlessShell() = default;
#if !defined(CHROME_MULTIPLE_DLL_CHILD)
void HeadlessShell::OnStart(HeadlessBrowser* browser) {
browser_ = browser;
devtools_client_ = HeadlessDevToolsClient::Create();
@ -386,7 +375,6 @@ void HeadlessShell::HeadlessWebContentsDestroyed() {
FROM_HERE,
base::BindOnce(&HeadlessShell::Shutdown, weak_factory_.GetWeakPtr()));
}
#endif // !defined(CHROME_MULTIPLE_DLL_CHILD)
void HeadlessShell::FetchTimeout() {
LOG(INFO) << "Timeout.";

@ -99,10 +99,8 @@ class HeadlessShell : public HeadlessWebContents::Observer,
GURL url_;
HeadlessBrowser* browser_ = nullptr; // Not owned.
std::unique_ptr<HeadlessDevToolsClient> devtools_client_;
#if !defined(CHROME_MULTIPLE_DLL_CHILD)
HeadlessWebContents* web_contents_ = nullptr;
HeadlessBrowserContext* browser_context_ = nullptr;
#endif
bool processed_page_ready_ = false;
scoped_refptr<base::SequencedTaskRunner> file_task_runner_;
std::unique_ptr<base::FileProxy> file_proxy_;

@ -1,21 +0,0 @@
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "headless/app/headless_shell.h"
#include "headless/app/headless_shell_switches.h"
#include "headless/public/headless_browser.h"
namespace headless {
#if defined(CHROME_MULTIPLE_DLL_CHILD)
void HeadlessShell::OnStart(HeadlessBrowser* browser) {}
void HeadlessShell::Shutdown() {}
void HeadlessShell::DevToolsTargetReady() {}
void HeadlessShell::HeadlessWebContentsDestroyed() {}
#endif // defined(CHROME_MULTIPLE_DLL_CHILD)
} // namespace headless

@ -73,7 +73,6 @@ class HeadlessWebContentsImpl::Delegate : public content::WebContentsDelegate {
explicit Delegate(HeadlessWebContentsImpl* headless_web_contents)
: headless_web_contents_(headless_web_contents) {}
#if !defined(CHROME_MULTIPLE_DLL_CHILD)
// Return the security style of the given |web_contents|, populating
// |security_style_explanations| to explain why the SecurityStyle was chosen.
blink::SecurityStyle GetSecurityStyle(
@ -89,7 +88,6 @@ class HeadlessWebContentsImpl::Delegate : public content::WebContentsDelegate {
false /* used_policy_installed_certificate */),
*visible_security_state.get(), security_style_explanations);
}
#endif // !defined(CHROME_MULTIPLE_DLL_CHILD)
void ActivateContents(content::WebContents* contents) override {
contents->GetRenderViewHost()->GetWidget()->Focus();
@ -286,7 +284,7 @@ HeadlessWebContentsImpl::HeadlessWebContentsImpl(
content::DevToolsAgentHost::GetOrCreateFor(web_contents_.get())),
browser_context_(browser_context),
render_process_host_(web_contents_->GetMainFrame()->GetProcess()) {
#if BUILDFLAG(ENABLE_PRINTING) && !defined(CHROME_MULTIPLE_DLL_CHILD)
#if BUILDFLAG(ENABLE_PRINTING)
HeadlessPrintManager::CreateForWebContents(web_contents_.get());
// TODO(weili): Add support for printing OOPIFs.
#endif

@ -32,6 +32,7 @@
#include "headless/lib/browser/headless_content_browser_client.h"
#include "headless/lib/headless_crash_reporter_client.h"
#include "headless/lib/headless_macros.h"
#include "headless/lib/renderer/headless_content_renderer_client.h"
#include "headless/lib/utility/headless_content_utility_client.h"
#include "services/service_manager/embedder/switches.h"
#include "services/service_manager/sandbox/switches.h"
@ -54,10 +55,6 @@
#include "components/crash/core/app/breakpad_linux.h"
#endif
#if !defined(CHROME_MULTIPLE_DLL_BROWSER)
#include "headless/lib/renderer/headless_content_renderer_client.h"
#endif
#if defined(OS_POSIX)
#include <signal.h>
#endif
@ -75,10 +72,8 @@ const base::FilePath::CharType kDefaultProfileName[] =
namespace {
// Keep in sync with content/common/content_constants_internal.h.
#if !defined(CHROME_MULTIPLE_DLL_CHILD)
// TODO(skyostil): Add a tracing test for this.
const int kTraceEventBrowserProcessSortIndex = -6;
#endif
HeadlessContentMainDelegate* g_current_headless_content_main_delegate = nullptr;
@ -347,7 +342,7 @@ void HeadlessContentMainDelegate::InitCrashReporter(
// Avoid adding this dependency in Windows Chrome non component builds, since
// crashpad is already enabled.
// TODO(dvallet): Ideally we would also want to avoid this for component builds.
#elif defined(OS_WIN) && !defined(CHROME_MULTIPLE_DLL)
#elif defined(OS_WIN)
crash_reporter::InitializeCrashpadWithEmbeddedHandler(
process_type.empty(), process_type, "", base::FilePath());
#endif // defined(HEADLESS_USE_BREAKPAD)
@ -376,7 +371,6 @@ void HeadlessContentMainDelegate::PreSandboxStartup() {
InitApplicationLocale(command_line);
}
#if !defined(CHROME_MULTIPLE_DLL_CHILD)
int HeadlessContentMainDelegate::RunProcess(
const std::string& process_type,
const content::MainFunctionParams& main_function_params) {
@ -403,7 +397,6 @@ int HeadlessContentMainDelegate::RunProcess(
// Return value >=0 here to disable calling content::BrowserMain.
return 0;
}
#endif // !defined(CHROME_MULTIPLE_DLL_CHILD)
#if defined(OS_LINUX)
void SIGTERMProfilingShutdown(int signal) {
@ -457,16 +450,13 @@ content::ContentClient* HeadlessContentMainDelegate::CreateContentClient() {
return &content_client_;
}
#if !defined(CHROME_MULTIPLE_DLL_CHILD)
content::ContentBrowserClient*
HeadlessContentMainDelegate::CreateContentBrowserClient() {
browser_client_ =
std::make_unique<HeadlessContentBrowserClient>(browser_.get());
return browser_client_.get();
}
#endif // !defined(CHROME_MULTIPLE_DLL_CHILD)
#if !defined(CHROME_MULTIPLE_DLL_BROWSER)
content::ContentRendererClient*
HeadlessContentMainDelegate::CreateContentRendererClient() {
renderer_client_ = std::make_unique<HeadlessContentRendererClient>();
@ -479,7 +469,6 @@ HeadlessContentMainDelegate::CreateContentUtilityClient() {
std::make_unique<HeadlessContentUtilityClient>(options()->user_agent);
return utility_client_.get();
}
#endif // !defined(CHROME_MULTIPLE_DLL_BROWSER)
void HeadlessContentMainDelegate::PostEarlyInitialization(
bool is_running_tests) {

@ -14,14 +14,11 @@
#include "content/public/app/content_main_delegate.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/renderer/content_renderer_client.h"
#include "headless/lib/browser/headless_platform_event_source.h"
#include "headless/lib/headless_content_client.h"
#include "headless/public/headless_browser.h"
#include "headless/public/headless_export.h"
#if !defined(CHROME_MULTIPLE_DLL_CHILD)
#include "headless/lib/browser/headless_platform_event_source.h"
#endif
namespace base {
namespace debug {
struct CrashKeyString;
@ -80,9 +77,7 @@ class HEADLESS_EXPORT HeadlessContentMainDelegate
std::unique_ptr<content::ContentBrowserClient> browser_client_;
std::unique_ptr<content::ContentUtilityClient> utility_client_;
HeadlessContentClient content_client_;
#if !defined(CHROME_MULTIPLE_DLL_CHILD)
HeadlessPlatformEventSource platform_event_source_;
#endif
std::unique_ptr<HeadlessBrowserImpl> browser_;
std::unique_ptr<HeadlessBrowser::Options> options_;

@ -1,40 +0,0 @@
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "headless/lib/browser/headless_browser_impl.h"
#include "headless/lib/browser/headless_content_browser_client.h"
#include "headless/lib/headless_content_main_delegate.h"
#if defined(CHROME_MULTIPLE_DLL_BROWSER)
#include "headless/lib/renderer/headless_content_renderer_client.h"
#endif
namespace headless {
#if defined(CHROME_MULTIPLE_DLL_CHILD)
int HeadlessContentMainDelegate::RunProcess(
const std::string& process_type,
const content::MainFunctionParams& main_function_params) {
return -1;
}
content::ContentBrowserClient*
HeadlessContentMainDelegate::CreateContentBrowserClient() {
return nullptr;
}
#endif // defined(CHROME_MULTIPLE_DLL_CHILD)
#if defined(CHROME_MULTIPLE_DLL_BROWSER)
content::ContentRendererClient*
HeadlessContentMainDelegate::CreateContentRendererClient() {
return nullptr;
}
content::ContentUtilityClient*
HeadlessContentMainDelegate::CreateContentUtilityClient() {
return nullptr;
}
#endif // defined(CHROME_MULTIPLE_DLL_BROWSER)
} // namespace headless

@ -12,7 +12,7 @@
#include "mojo/public/cpp/bindings/service_factory.h"
#include "printing/buildflags/buildflags.h"
#if BUILDFLAG(ENABLE_PRINTING) && !defined(CHROME_MULTIPLE_DLL_BROWSER)
#if BUILDFLAG(ENABLE_PRINTING)
#include "components/services/print_compositor/print_compositor_impl.h"
#include "components/services/print_compositor/public/mojom/print_compositor.mojom.h"
#endif
@ -25,7 +25,7 @@ base::LazyInstance<
HeadlessContentUtilityClient::NetworkBinderCreationCallback>::Leaky
g_network_binder_creation_callback = LAZY_INSTANCE_INITIALIZER;
#if BUILDFLAG(ENABLE_PRINTING) && !defined(CHROME_MULTIPLE_DLL_BROWSER)
#if BUILDFLAG(ENABLE_PRINTING)
auto RunPrintCompositor(
mojo::PendingReceiver<printing::mojom::PrintCompositor> receiver) {
return std::make_unique<printing::PrintCompositorImpl>(
@ -51,7 +51,7 @@ HeadlessContentUtilityClient::~HeadlessContentUtilityClient() = default;
mojo::ServiceFactory*
HeadlessContentUtilityClient::GetMainThreadServiceFactory() {
static base::NoDestructor<mojo::ServiceFactory> factory {
#if BUILDFLAG(ENABLE_PRINTING) && !defined(CHROME_MULTIPLE_DLL_BROWSER)
#if BUILDFLAG(ENABLE_PRINTING)
RunPrintCompositor,
#endif
};