Commit 777cd8c8 authored by Daniel Bratell's avatar Daniel Bratell Committed by Commit Bot

[headless] Specify namespace in cases where it might be ambiguous

There are sub-namespaces to ::headless named storage and
switches and those will be chosen by the compiler instead of
::storage or ::switches if the compiler knows about them.

This problem appeared in jumbo builds where the compiler knew
more about all the namespaces. Fix is to either rename/remove
the sub-namespaces or to do what this patch does, prefix
storage with :: (so ::storage and ::switches) to clarify what
namespace is intended.

Bug: 883727
Change-Id: I1f6e428926f0a959787c2205f92505280d96b831
Reviewed-on: https://chromium-review.googlesource.com/1225792Reviewed-by: default avatarSami Kyöstilä <skyostil@chromium.org>
Commit-Queue: Daniel Bratell <bratell@opera.com>
Cr-Commit-Position: refs/heads/master@{#591336}
parent 38b72391
...@@ -71,7 +71,7 @@ class HEADLESS_EXPORT HeadlessBrowserContextImpl final ...@@ -71,7 +71,7 @@ class HEADLESS_EXPORT HeadlessBrowserContextImpl final
content::ResourceContext* GetResourceContext() override; content::ResourceContext* GetResourceContext() override;
content::DownloadManagerDelegate* GetDownloadManagerDelegate() override; content::DownloadManagerDelegate* GetDownloadManagerDelegate() override;
content::BrowserPluginGuestManager* GetGuestManager() override; content::BrowserPluginGuestManager* GetGuestManager() override;
storage::SpecialStoragePolicy* GetSpecialStoragePolicy() override; ::storage::SpecialStoragePolicy* GetSpecialStoragePolicy() override;
content::PushMessagingService* GetPushMessagingService() override; content::PushMessagingService* GetPushMessagingService() override;
content::SSLHostStateDelegate* GetSSLHostStateDelegate() override; content::SSLHostStateDelegate* GetSSLHostStateDelegate() override;
content::PermissionControllerDelegate* GetPermissionControllerDelegate() content::PermissionControllerDelegate* GetPermissionControllerDelegate()
......
...@@ -200,8 +200,8 @@ HeadlessContentBrowserClient::CreateQuotaPermissionContext() { ...@@ -200,8 +200,8 @@ HeadlessContentBrowserClient::CreateQuotaPermissionContext() {
void HeadlessContentBrowserClient::GetQuotaSettings( void HeadlessContentBrowserClient::GetQuotaSettings(
content::BrowserContext* context, content::BrowserContext* context,
content::StoragePartition* partition, content::StoragePartition* partition,
storage::OptionalQuotaSettingsCallback callback) { ::storage::OptionalQuotaSettingsCallback callback) {
storage::GetNominalDynamicSettings( ::storage::GetNominalDynamicSettings(
partition->GetPath(), context->IsOffTheRecord(), std::move(callback)); partition->GetPath(), context->IsOffTheRecord(), std::move(callback));
} }
......
...@@ -31,7 +31,7 @@ class HeadlessContentBrowserClient : public content::ContentBrowserClient { ...@@ -31,7 +31,7 @@ class HeadlessContentBrowserClient : public content::ContentBrowserClient {
void GetQuotaSettings( void GetQuotaSettings(
content::BrowserContext* context, content::BrowserContext* context,
content::StoragePartition* partition, content::StoragePartition* partition,
storage::OptionalQuotaSettingsCallback callback) override; ::storage::OptionalQuotaSettingsCallback callback) override;
#if defined(OS_POSIX) && !defined(OS_MACOSX) #if defined(OS_POSIX) && !defined(OS_MACOSX)
void GetAdditionalMappedFilesForChildProcess( void GetAdditionalMappedFilesForChildProcess(
const base::CommandLine& command_line, const base::CommandLine& command_line,
......
...@@ -90,30 +90,30 @@ bool HeadlessContentMainDelegate::BasicStartupComplete(int* exit_code) { ...@@ -90,30 +90,30 @@ bool HeadlessContentMainDelegate::BasicStartupComplete(int* exit_code) {
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
// Make sure all processes know that we're in headless mode. // Make sure all processes know that we're in headless mode.
if (!command_line->HasSwitch(switches::kHeadless)) if (!command_line->HasSwitch(::switches::kHeadless))
command_line->AppendSwitch(switches::kHeadless); command_line->AppendSwitch(::switches::kHeadless);
if (browser_->options()->single_process_mode) if (browser_->options()->single_process_mode)
command_line->AppendSwitch(switches::kSingleProcess); command_line->AppendSwitch(::switches::kSingleProcess);
if (browser_->options()->disable_sandbox) if (browser_->options()->disable_sandbox)
command_line->AppendSwitch(service_manager::switches::kNoSandbox); command_line->AppendSwitch(service_manager::switches::kNoSandbox);
if (!browser_->options()->enable_resource_scheduler) if (!browser_->options()->enable_resource_scheduler)
command_line->AppendSwitch(switches::kDisableResourceScheduler); command_line->AppendSwitch(::switches::kDisableResourceScheduler);
#if defined(USE_OZONE) #if defined(USE_OZONE)
// The headless backend is automatically chosen for a headless build, but also // The headless backend is automatically chosen for a headless build, but also
// adding it here allows us to run in a non-headless build too. // adding it here allows us to run in a non-headless build too.
command_line->AppendSwitchASCII(switches::kOzonePlatform, "headless"); command_line->AppendSwitchASCII(::switches::kOzonePlatform, "headless");
#endif #endif
if (!command_line->HasSwitch(switches::kUseGL)) { if (!command_line->HasSwitch(::switches::kUseGL)) {
if (!browser_->options()->gl_implementation.empty()) { if (!browser_->options()->gl_implementation.empty()) {
command_line->AppendSwitchASCII(switches::kUseGL, command_line->AppendSwitchASCII(::switches::kUseGL,
browser_->options()->gl_implementation); browser_->options()->gl_implementation);
} else { } else {
command_line->AppendSwitch(switches::kDisableGpu); command_line->AppendSwitch(::switches::kDisableGpu);
} }
} }
...@@ -121,7 +121,7 @@ bool HeadlessContentMainDelegate::BasicStartupComplete(int* exit_code) { ...@@ -121,7 +121,7 @@ bool HeadlessContentMainDelegate::BasicStartupComplete(int* exit_code) {
// software compositing anyway, but only after attempting and failing to // software compositing anyway, but only after attempting and failing to
// initialize GPU compositing. We disable GPU compositing here explicitly to // initialize GPU compositing. We disable GPU compositing here explicitly to
// preempt this attempt. // preempt this attempt.
command_line->AppendSwitch(switches::kDisableGpuCompositing); command_line->AppendSwitch(::switches::kDisableGpuCompositing);
SetContentClient(&content_client_); SetContentClient(&content_client_);
return false; return false;
...@@ -130,9 +130,9 @@ bool HeadlessContentMainDelegate::BasicStartupComplete(int* exit_code) { ...@@ -130,9 +130,9 @@ bool HeadlessContentMainDelegate::BasicStartupComplete(int* exit_code) {
void HeadlessContentMainDelegate::InitLogging( void HeadlessContentMainDelegate::InitLogging(
const base::CommandLine& command_line) { const base::CommandLine& command_line) {
const std::string process_type = const std::string process_type =
command_line.GetSwitchValueASCII(switches::kProcessType); command_line.GetSwitchValueASCII(::switches::kProcessType);
#if !defined(OS_WIN) #if !defined(OS_WIN)
if (!command_line.HasSwitch(switches::kEnableLogging)) if (!command_line.HasSwitch(::switches::kEnableLogging))
return; return;
#else #else
// Child processes in Windows are not able to initialize logging. // Child processes in Windows are not able to initialize logging.
...@@ -142,11 +142,12 @@ void HeadlessContentMainDelegate::InitLogging( ...@@ -142,11 +142,12 @@ void HeadlessContentMainDelegate::InitLogging(
logging::LoggingDestination log_mode; logging::LoggingDestination log_mode;
base::FilePath log_filename(FILE_PATH_LITERAL("chrome_debug.log")); base::FilePath log_filename(FILE_PATH_LITERAL("chrome_debug.log"));
if (command_line.GetSwitchValueASCII(switches::kEnableLogging) == "stderr") { if (command_line.GetSwitchValueASCII(::switches::kEnableLogging) ==
"stderr") {
log_mode = logging::LOG_TO_SYSTEM_DEBUG_LOG; log_mode = logging::LOG_TO_SYSTEM_DEBUG_LOG;
} else { } else {
base::FilePath custom_filename( base::FilePath custom_filename(
command_line.GetSwitchValuePath(switches::kEnableLogging)); command_line.GetSwitchValuePath(::switches::kEnableLogging));
if (custom_filename.empty()) { if (custom_filename.empty()) {
log_mode = logging::LOG_TO_ALL; log_mode = logging::LOG_TO_ALL;
} else { } else {
...@@ -155,10 +156,10 @@ void HeadlessContentMainDelegate::InitLogging( ...@@ -155,10 +156,10 @@ void HeadlessContentMainDelegate::InitLogging(
} }
} }
if (command_line.HasSwitch(switches::kLoggingLevel) && if (command_line.HasSwitch(::switches::kLoggingLevel) &&
logging::GetMinLogLevel() >= 0) { logging::GetMinLogLevel() >= 0) {
std::string log_level = std::string log_level =
command_line.GetSwitchValueASCII(switches::kLoggingLevel); command_line.GetSwitchValueASCII(::switches::kLoggingLevel);
int level = 0; int level = 0;
if (base::StringToInt(log_level, &level) && level >= 0 && if (base::StringToInt(log_level, &level) && level >= 0 &&
level < logging::LOG_NUM_SEVERITIES) { level < logging::LOG_NUM_SEVERITIES) {
...@@ -216,7 +217,7 @@ void HeadlessContentMainDelegate::InitCrashReporter( ...@@ -216,7 +217,7 @@ void HeadlessContentMainDelegate::InitCrashReporter(
NOTIMPLEMENTED(); NOTIMPLEMENTED();
#else #else
const std::string process_type = const std::string process_type =
command_line.GetSwitchValueASCII(switches::kProcessType); command_line.GetSwitchValueASCII(::switches::kProcessType);
crash_reporter::SetCrashReporterClient(g_headless_crash_client.Pointer()); crash_reporter::SetCrashReporterClient(g_headless_crash_client.Pointer());
g_headless_crash_client.Pointer()->set_crash_dumps_dir( g_headless_crash_client.Pointer()->set_crash_dumps_dir(
browser_->options()->crash_dumps_dir); browser_->options()->crash_dumps_dir);
...@@ -251,7 +252,7 @@ void HeadlessContentMainDelegate::PreSandboxStartup() { ...@@ -251,7 +252,7 @@ void HeadlessContentMainDelegate::PreSandboxStartup() {
// crash. // crash.
InitLogging(command_line); InitLogging(command_line);
#else #else
if (command_line.HasSwitch(switches::kEnableLogging)) if (command_line.HasSwitch(::switches::kEnableLogging))
InitLogging(command_line); InitLogging(command_line);
#endif // defined(OS_WIN) #endif // defined(OS_WIN)
...@@ -294,7 +295,7 @@ void HeadlessContentMainDelegate::ZygoteForked() { ...@@ -294,7 +295,7 @@ void HeadlessContentMainDelegate::ZygoteForked() {
const base::CommandLine& command_line( const base::CommandLine& command_line(
*base::CommandLine::ForCurrentProcess()); *base::CommandLine::ForCurrentProcess());
const std::string process_type = const std::string process_type =
command_line.GetSwitchValueASCII(switches::kProcessType); command_line.GetSwitchValueASCII(::switches::kProcessType);
// Unconditionally try to turn on crash reporting since we do not have access // Unconditionally try to turn on crash reporting since we do not have access
// to the latest browser options at this point when testing. Breakpad will // to the latest browser options at this point when testing. Breakpad will
// bail out gracefully if the browser process hasn't enabled crash reporting. // bail out gracefully if the browser process hasn't enabled crash reporting.
...@@ -312,7 +313,8 @@ HeadlessContentMainDelegate* HeadlessContentMainDelegate::GetInstance() { ...@@ -312,7 +313,8 @@ HeadlessContentMainDelegate* HeadlessContentMainDelegate::GetInstance() {
// static // static
void HeadlessContentMainDelegate::InitializeResourceBundle() { void HeadlessContentMainDelegate::InitializeResourceBundle() {
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
const std::string locale = command_line->GetSwitchValueASCII(switches::kLang); const std::string locale =
command_line->GetSwitchValueASCII(::switches::kLang);
ui::ResourceBundle::InitSharedInstanceWithLocale( ui::ResourceBundle::InitSharedInstanceWithLocale(
locale, nullptr, ui::ResourceBundle::DO_NOT_LOAD_COMMON_RESOURCES); locale, nullptr, ui::ResourceBundle::DO_NOT_LOAD_COMMON_RESOURCES);
......
...@@ -55,10 +55,10 @@ bool HeadlessCrashReporterClient::GetCrashDumpLocation( ...@@ -55,10 +55,10 @@ bool HeadlessCrashReporterClient::GetCrashDumpLocation(
bool HeadlessCrashReporterClient::EnableBreakpadForProcess( bool HeadlessCrashReporterClient::EnableBreakpadForProcess(
const std::string& process_type) { const std::string& process_type) {
return process_type == switches::kRendererProcess || return process_type == ::switches::kRendererProcess ||
process_type == switches::kPpapiPluginProcess || process_type == ::switches::kPpapiPluginProcess ||
process_type == service_manager::switches::kZygoteProcess || process_type == service_manager::switches::kZygoteProcess ||
process_type == switches::kGpuProcess; process_type == ::switches::kGpuProcess;
} }
} // namespace content } // namespace content
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment