| Index: content/browser/devtools/devtools_agent_host_impl.cc
|
| diff --git a/content/browser/devtools/devtools_agent_host_impl.cc b/content/browser/devtools/devtools_agent_host_impl.cc
|
| index 11cbc87d150eed097dfc8c027726d5df23445e37..8193f6dfb384dcc3034b23b9f49b97d6455c6b6a 100644
|
| --- a/content/browser/devtools/devtools_agent_host_impl.cc
|
| +++ b/content/browser/devtools/devtools_agent_host_impl.cc
|
| @@ -30,10 +30,11 @@ namespace content {
|
|
|
| namespace {
|
| typedef std::map<std::string, DevToolsAgentHostImpl*> Instances;
|
| -base::LazyInstance<Instances>::Leaky g_instances = LAZY_INSTANCE_INITIALIZER;
|
| +base::LazyInstance<Instances>::Leaky g_devtools_instances =
|
| + LAZY_INSTANCE_INITIALIZER;
|
|
|
| base::LazyInstance<base::ObserverList<DevToolsAgentHostObserver>>::Leaky
|
| - g_observers = LAZY_INSTANCE_INITIALIZER;
|
| + g_devtools_observers = LAZY_INSTANCE_INITIALIZER;
|
| } // namespace
|
|
|
| const char DevToolsAgentHost::kTypePage[] = "page";
|
| @@ -93,7 +94,8 @@ DevToolsAgentHost::List DevToolsAgentHost::GetOrCreateAll() {
|
| #if DCHECK_IS_ON()
|
| for (auto it : result) {
|
| DevToolsAgentHostImpl* host = static_cast<DevToolsAgentHostImpl*>(it.get());
|
| - DCHECK(g_instances.Get().find(host->id_) != g_instances.Get().end());
|
| + DCHECK(g_devtools_instances.Get().find(host->id_) !=
|
| + g_devtools_instances.Get().end());
|
| }
|
| #endif
|
|
|
| @@ -128,10 +130,10 @@ DevToolsAgentHostImpl::~DevToolsAgentHostImpl() {
|
| // static
|
| scoped_refptr<DevToolsAgentHost> DevToolsAgentHost::GetForId(
|
| const std::string& id) {
|
| - if (g_instances == NULL)
|
| + if (g_devtools_instances == NULL)
|
| return NULL;
|
| - Instances::iterator it = g_instances.Get().find(id);
|
| - if (it == g_instances.Get().end())
|
| + Instances::iterator it = g_devtools_instances.Get().find(id);
|
| + if (it == g_devtools_instances.Get().end())
|
| return NULL;
|
| return it->second;
|
| }
|
| @@ -289,12 +291,12 @@ void DevToolsAgentHostImpl::InspectElement(
|
|
|
| // static
|
| void DevToolsAgentHost::DetachAllClients() {
|
| - if (g_instances == NULL)
|
| + if (g_devtools_instances == NULL)
|
| return;
|
|
|
| // Make a copy, since detaching may lead to agent destruction, which
|
| // removes it from the instances.
|
| - Instances copy = g_instances.Get();
|
| + Instances copy = g_devtools_instances.Get();
|
| for (Instances::iterator it(copy.begin()); it != copy.end(); ++it) {
|
| DevToolsAgentHostImpl* agent_host = it->second;
|
| agent_host->ForceDetachAllClients(true);
|
| @@ -311,8 +313,8 @@ void DevToolsAgentHost::AddObserver(DevToolsAgentHostObserver* observer) {
|
| DevToolsAgentHostImpl::s_force_creation_count_++;
|
| }
|
|
|
| - g_observers.Get().AddObserver(observer);
|
| - for (const auto& id_host : g_instances.Get())
|
| + g_devtools_observers.Get().AddObserver(observer);
|
| + for (const auto& id_host : g_devtools_instances.Get())
|
| observer->DevToolsAgentHostCreated(id_host.second);
|
| }
|
|
|
| @@ -320,7 +322,7 @@ void DevToolsAgentHost::AddObserver(DevToolsAgentHostObserver* observer) {
|
| void DevToolsAgentHost::RemoveObserver(DevToolsAgentHostObserver* observer) {
|
| if (observer->ShouldForceDevToolsAgentHostCreation())
|
| DevToolsAgentHostImpl::s_force_creation_count_--;
|
| - g_observers.Get().RemoveObserver(observer);
|
| + g_devtools_observers.Get().RemoveObserver(observer);
|
| }
|
|
|
| // static
|
| @@ -329,27 +331,27 @@ bool DevToolsAgentHostImpl::ShouldForceCreation() {
|
| }
|
|
|
| void DevToolsAgentHostImpl::NotifyCreated() {
|
| - DCHECK(g_instances.Get().find(id_) == g_instances.Get().end());
|
| - g_instances.Get()[id_] = this;
|
| - for (auto& observer : g_observers.Get())
|
| + DCHECK(g_devtools_instances.Get().find(id_) == g_devtools_instances.Get().end());
|
| + g_devtools_instances.Get()[id_] = this;
|
| + for (auto& observer : g_devtools_observers.Get())
|
| observer.DevToolsAgentHostCreated(this);
|
| }
|
|
|
| void DevToolsAgentHostImpl::NotifyAttached() {
|
| - for (auto& observer : g_observers.Get())
|
| + for (auto& observer : g_devtools_observers.Get())
|
| observer.DevToolsAgentHostAttached(this);
|
| }
|
|
|
| void DevToolsAgentHostImpl::NotifyDetached() {
|
| - for (auto& observer : g_observers.Get())
|
| + for (auto& observer : g_devtools_observers.Get())
|
| observer.DevToolsAgentHostDetached(this);
|
| }
|
|
|
| void DevToolsAgentHostImpl::NotifyDestroyed() {
|
| - DCHECK(g_instances.Get().find(id_) != g_instances.Get().end());
|
| - for (auto& observer : g_observers.Get())
|
| + DCHECK(g_devtools_instances.Get().find(id_) != g_devtools_instances.Get().end());
|
| + for (auto& observer : g_devtools_observers.Get())
|
| observer.DevToolsAgentHostDestroyed(this);
|
| - g_instances.Get().erase(id_);
|
| + g_devtools_instances.Get().erase(id_);
|
| }
|
|
|
| // DevToolsMessageChunkProcessor -----------------------------------------------
|
|
|