| 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 011befdc74880ebeb30ef3f93e971756e9db6896..868cf2e09dc106ae7965bd4278e8c940e8215c4e 100644
|
| --- a/content/browser/devtools/devtools_agent_host_impl.cc
|
| +++ b/content/browser/devtools/devtools_agent_host_impl.cc
|
| @@ -31,10 +31,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
|
|
|
| char DevToolsAgentHost::kTypePage[] = "page";
|
| @@ -96,7 +97,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
|
|
|
| @@ -131,10 +133,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;
|
| }
|
| @@ -295,12 +297,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);
|
| @@ -317,8 +319,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);
|
| }
|
|
|
| @@ -326,7 +328,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
|
| @@ -335,9 +337,9 @@ 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);
|
| }
|
|
|
| @@ -351,7 +353,7 @@ void DevToolsAgentHostImpl::NotifyAttached() {
|
| }
|
| ++s_attached_count_;
|
|
|
| - for (auto& observer : g_observers.Get())
|
| + for (auto& observer : g_devtools_observers.Get())
|
| observer.DevToolsAgentHostAttached(this);
|
| }
|
|
|
| @@ -364,15 +366,15 @@ void DevToolsAgentHostImpl::NotifyDetached() {
|
| base::Bind(&NetLogObserver::Detach));
|
| }
|
|
|
| - 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 -----------------------------------------------
|
|
|