Commit db709282 authored by Daniel Bratell's avatar Daniel Bratell Committed by Commit Bot

Give two g_lazy_tls global variables unique names

In content/child there were two g_lazy_tls global variables
in two different anonymous namespaces. In jumbo build experiments,
where many files compile together and share anonymous namespace,
those globals collided. This patch gives them more distinct names.

Bug: 746953
Change-Id: Icac936f2092d1c8b1bc5de38d443d71cb8955045
Reviewed-on: https://chromium-review.googlesource.com/1251605Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Daniel Bratell <bratell@opera.com>
Cr-Commit-Position: refs/heads/master@{#595100}
parent 734515a0
......@@ -21,7 +21,7 @@ namespace content {
namespace {
base::LazyInstance<base::ThreadLocalPointer<ChildProcess>>::DestructorAtExit
g_lazy_tls = LAZY_INSTANCE_INITIALIZER;
g_lazy_child_process_tls = LAZY_INSTANCE_INITIALIZER;
}
ChildProcess::ChildProcess(
......@@ -32,8 +32,8 @@ ChildProcess::ChildProcess(
shutdown_event_(base::WaitableEvent::ResetPolicy::MANUAL,
base::WaitableEvent::InitialState::NOT_SIGNALED),
io_thread_("Chrome_ChildIOThread") {
DCHECK(!g_lazy_tls.Pointer()->Get());
g_lazy_tls.Pointer()->Set(this);
DCHECK(!g_lazy_child_process_tls.Pointer()->Get());
g_lazy_child_process_tls.Pointer()->Set(this);
// Initialize TaskScheduler if not already done. A TaskScheduler may already
// exist when ChildProcess is instantiated in the browser process or in a
......@@ -63,7 +63,7 @@ ChildProcess::ChildProcess(
}
ChildProcess::~ChildProcess() {
DCHECK(g_lazy_tls.Pointer()->Get() == this);
DCHECK(g_lazy_child_process_tls.Pointer()->Get() == this);
// Signal this event before destroying the child process. That way all
// background threads can cleanup.
......@@ -82,7 +82,7 @@ ChildProcess::~ChildProcess() {
}
}
g_lazy_tls.Pointer()->Set(nullptr);
g_lazy_child_process_tls.Pointer()->Set(nullptr);
io_thread_.Stop();
if (initialized_task_scheduler_) {
......@@ -117,7 +117,7 @@ void ChildProcess::ReleaseProcess() {
}
ChildProcess* ChildProcess::current() {
return g_lazy_tls.Pointer()->Get();
return g_lazy_child_process_tls.Pointer()->Get();
}
base::WaitableEvent* ChildProcess::GetShutDownEvent() {
......
......@@ -84,7 +84,7 @@ namespace {
const int kConnectionTimeoutS = 15;
base::LazyInstance<base::ThreadLocalPointer<ChildThreadImpl>>::DestructorAtExit
g_lazy_tls = LAZY_INSTANCE_INITIALIZER;
g_lazy_child_thread_impl_tls = LAZY_INSTANCE_INITIALIZER;
// This isn't needed on Windows because there the sandbox's job object
// terminates child processes automatically. For unsandboxed processes (i.e.
......@@ -402,7 +402,7 @@ void ChildThreadImpl::ConnectChannel() {
void ChildThreadImpl::Init(const Options& options) {
TRACE_EVENT0("startup", "ChildThreadImpl::Init");
g_lazy_tls.Pointer()->Set(this);
g_lazy_child_thread_impl_tls.Pointer()->Set(this);
on_channel_error_called_ = false;
main_thread_runner_ = base::ThreadTaskRunnerHandle::Get();
#if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
......@@ -605,7 +605,7 @@ ChildThreadImpl::~ChildThreadImpl() {
// automatically. We used to watch the object handle on Windows to do this,
// but it wasn't possible to do so on POSIX.
channel_->ClearIPCTaskRunner();
g_lazy_tls.Pointer()->Set(nullptr);
g_lazy_child_thread_impl_tls.Pointer()->Set(nullptr);
}
void ChildThreadImpl::Shutdown() {}
......@@ -771,7 +771,7 @@ void ChildThreadImpl::OnChildControlRequest(
}
ChildThreadImpl* ChildThreadImpl::current() {
return g_lazy_tls.Pointer()->Get();
return g_lazy_child_thread_impl_tls.Pointer()->Get();
}
#if defined(OS_ANDROID)
......
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