[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/1225792
Reviewed-by: Sami Kyöstilä <skyostil@chromium.org>
Commit-Queue: Daniel Bratell <bratell@opera.com>
Cr-Commit-Position: refs/heads/master@{#591336}
diff --git a/headless/lib/browser/headless_browser_context_impl.h b/headless/lib/browser/headless_browser_context_impl.h
index d192b10..ad301e7 100644
--- a/headless/lib/browser/headless_browser_context_impl.h
+++ b/headless/lib/browser/headless_browser_context_impl.h
@@ -71,7 +71,7 @@
content::ResourceContext* GetResourceContext() override;
content::DownloadManagerDelegate* GetDownloadManagerDelegate() override;
content::BrowserPluginGuestManager* GetGuestManager() override;
- storage::SpecialStoragePolicy* GetSpecialStoragePolicy() override;
+ ::storage::SpecialStoragePolicy* GetSpecialStoragePolicy() override;
content::PushMessagingService* GetPushMessagingService() override;
content::SSLHostStateDelegate* GetSSLHostStateDelegate() override;
content::PermissionControllerDelegate* GetPermissionControllerDelegate()
diff --git a/headless/lib/browser/headless_content_browser_client.cc b/headless/lib/browser/headless_content_browser_client.cc
index e67fed7..f36d9a6c 100644
--- a/headless/lib/browser/headless_content_browser_client.cc
+++ b/headless/lib/browser/headless_content_browser_client.cc
@@ -200,8 +200,8 @@
void HeadlessContentBrowserClient::GetQuotaSettings(
content::BrowserContext* context,
content::StoragePartition* partition,
- storage::OptionalQuotaSettingsCallback callback) {
- storage::GetNominalDynamicSettings(
+ ::storage::OptionalQuotaSettingsCallback callback) {
+ ::storage::GetNominalDynamicSettings(
partition->GetPath(), context->IsOffTheRecord(), std::move(callback));
}
diff --git a/headless/lib/browser/headless_content_browser_client.h b/headless/lib/browser/headless_content_browser_client.h
index 1393f437..6ca59a3 100644
--- a/headless/lib/browser/headless_content_browser_client.h
+++ b/headless/lib/browser/headless_content_browser_client.h
@@ -31,7 +31,7 @@
void GetQuotaSettings(
content::BrowserContext* context,
content::StoragePartition* partition,
- storage::OptionalQuotaSettingsCallback callback) override;
+ ::storage::OptionalQuotaSettingsCallback callback) override;
#if defined(OS_POSIX) && !defined(OS_MACOSX)
void GetAdditionalMappedFilesForChildProcess(
const base::CommandLine& command_line,
diff --git a/headless/lib/headless_content_main_delegate.cc b/headless/lib/headless_content_main_delegate.cc
index dc18c05..e08d757 100644
--- a/headless/lib/headless_content_main_delegate.cc
+++ b/headless/lib/headless_content_main_delegate.cc
@@ -90,30 +90,30 @@
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
// Make sure all processes know that we're in headless mode.
- if (!command_line->HasSwitch(switches::kHeadless))
- command_line->AppendSwitch(switches::kHeadless);
+ if (!command_line->HasSwitch(::switches::kHeadless))
+ command_line->AppendSwitch(::switches::kHeadless);
if (browser_->options()->single_process_mode)
- command_line->AppendSwitch(switches::kSingleProcess);
+ command_line->AppendSwitch(::switches::kSingleProcess);
if (browser_->options()->disable_sandbox)
command_line->AppendSwitch(service_manager::switches::kNoSandbox);
if (!browser_->options()->enable_resource_scheduler)
- command_line->AppendSwitch(switches::kDisableResourceScheduler);
+ command_line->AppendSwitch(::switches::kDisableResourceScheduler);
#if defined(USE_OZONE)
// 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.
- command_line->AppendSwitchASCII(switches::kOzonePlatform, "headless");
+ command_line->AppendSwitchASCII(::switches::kOzonePlatform, "headless");
#endif
- if (!command_line->HasSwitch(switches::kUseGL)) {
+ if (!command_line->HasSwitch(::switches::kUseGL)) {
if (!browser_->options()->gl_implementation.empty()) {
- command_line->AppendSwitchASCII(switches::kUseGL,
+ command_line->AppendSwitchASCII(::switches::kUseGL,
browser_->options()->gl_implementation);
} else {
- command_line->AppendSwitch(switches::kDisableGpu);
+ command_line->AppendSwitch(::switches::kDisableGpu);
}
}
@@ -121,7 +121,7 @@
// software compositing anyway, but only after attempting and failing to
// initialize GPU compositing. We disable GPU compositing here explicitly to
// preempt this attempt.
- command_line->AppendSwitch(switches::kDisableGpuCompositing);
+ command_line->AppendSwitch(::switches::kDisableGpuCompositing);
SetContentClient(&content_client_);
return false;
@@ -130,9 +130,9 @@
void HeadlessContentMainDelegate::InitLogging(
const base::CommandLine& command_line) {
const std::string process_type =
- command_line.GetSwitchValueASCII(switches::kProcessType);
+ command_line.GetSwitchValueASCII(::switches::kProcessType);
#if !defined(OS_WIN)
- if (!command_line.HasSwitch(switches::kEnableLogging))
+ if (!command_line.HasSwitch(::switches::kEnableLogging))
return;
#else
// Child processes in Windows are not able to initialize logging.
@@ -142,11 +142,12 @@
logging::LoggingDestination log_mode;
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;
} else {
base::FilePath custom_filename(
- command_line.GetSwitchValuePath(switches::kEnableLogging));
+ command_line.GetSwitchValuePath(::switches::kEnableLogging));
if (custom_filename.empty()) {
log_mode = logging::LOG_TO_ALL;
} else {
@@ -155,10 +156,10 @@
}
}
- if (command_line.HasSwitch(switches::kLoggingLevel) &&
+ if (command_line.HasSwitch(::switches::kLoggingLevel) &&
logging::GetMinLogLevel() >= 0) {
std::string log_level =
- command_line.GetSwitchValueASCII(switches::kLoggingLevel);
+ command_line.GetSwitchValueASCII(::switches::kLoggingLevel);
int level = 0;
if (base::StringToInt(log_level, &level) && level >= 0 &&
level < logging::LOG_NUM_SEVERITIES) {
@@ -216,7 +217,7 @@
NOTIMPLEMENTED();
#else
const std::string process_type =
- command_line.GetSwitchValueASCII(switches::kProcessType);
+ command_line.GetSwitchValueASCII(::switches::kProcessType);
crash_reporter::SetCrashReporterClient(g_headless_crash_client.Pointer());
g_headless_crash_client.Pointer()->set_crash_dumps_dir(
browser_->options()->crash_dumps_dir);
@@ -251,7 +252,7 @@
// crash.
InitLogging(command_line);
#else
- if (command_line.HasSwitch(switches::kEnableLogging))
+ if (command_line.HasSwitch(::switches::kEnableLogging))
InitLogging(command_line);
#endif // defined(OS_WIN)
@@ -294,7 +295,7 @@
const base::CommandLine& command_line(
*base::CommandLine::ForCurrentProcess());
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
// to the latest browser options at this point when testing. Breakpad will
// bail out gracefully if the browser process hasn't enabled crash reporting.
@@ -312,7 +313,8 @@
// static
void HeadlessContentMainDelegate::InitializeResourceBundle() {
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(
locale, nullptr, ui::ResourceBundle::DO_NOT_LOAD_COMMON_RESOURCES);
diff --git a/headless/lib/headless_crash_reporter_client.cc b/headless/lib/headless_crash_reporter_client.cc
index bda0c5d6..b1afe73 100644
--- a/headless/lib/headless_crash_reporter_client.cc
+++ b/headless/lib/headless_crash_reporter_client.cc
@@ -55,10 +55,10 @@
bool HeadlessCrashReporterClient::EnableBreakpadForProcess(
const std::string& process_type) {
- return process_type == switches::kRendererProcess ||
- process_type == switches::kPpapiPluginProcess ||
+ return process_type == ::switches::kRendererProcess ||
+ process_type == ::switches::kPpapiPluginProcess ||
process_type == service_manager::switches::kZygoteProcess ||
- process_type == switches::kGpuProcess;
+ process_type == ::switches::kGpuProcess;
}
} // namespace content