| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <algorithm> | 5 #include <algorithm> |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "content/browser/debugger/devtools_client_host.h" | 9 #include "content/browser/debugger/devtools_client_host.h" |
| 10 #include "content/browser/debugger/devtools_manager.h" | 10 #include "content/browser/debugger/devtools_manager.h" |
| 11 | 11 |
| 12 typedef std::vector<DevToolsClientHost*> DevToolsClientHostList; | 12 typedef std::vector<DevToolsClientHost*> DevToolsClientHostList; |
| 13 namespace { | 13 namespace { |
| 14 base::LazyInstance<DevToolsClientHostList, | 14 base::LazyInstance<DevToolsClientHostList, |
| 15 base::LeakyLazyInstanceTraits<DevToolsClientHostList> > | 15 base::LeakyLazyInstanceTraits<DevToolsClientHostList> > |
| 16 g_instances(base::LINKER_INITIALIZED); | 16 g_instances = LAZY_INSTANCE_INITIALIZER; |
| 17 } // namespace | 17 } // namespace |
| 18 | 18 |
| 19 // static | 19 // static |
| 20 DevToolsClientHost* DevToolsClientHost::FindOwnerClientHost( | 20 DevToolsClientHost* DevToolsClientHost::FindOwnerClientHost( |
| 21 RenderViewHost* client_rvh) { | 21 RenderViewHost* client_rvh) { |
| 22 for (DevToolsClientHostList::iterator it = g_instances.Get().begin(); | 22 for (DevToolsClientHostList::iterator it = g_instances.Get().begin(); |
| 23 it != g_instances.Get().end(); ++it) { | 23 it != g_instances.Get().end(); ++it) { |
| 24 if ((*it)->GetClientRenderViewHost() == client_rvh) | 24 if ((*it)->GetClientRenderViewHost() == client_rvh) |
| 25 return *it; | 25 return *it; |
| 26 } | 26 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 46 void DevToolsClientHost::ForwardToDevToolsAgent(const IPC::Message& message) { | 46 void DevToolsClientHost::ForwardToDevToolsAgent(const IPC::Message& message) { |
| 47 DevToolsManager::GetInstance()->ForwardToDevToolsAgent(this, message); | 47 DevToolsManager::GetInstance()->ForwardToDevToolsAgent(this, message); |
| 48 } | 48 } |
| 49 | 49 |
| 50 void DevToolsClientHost::NotifyCloseListener() { | 50 void DevToolsClientHost::NotifyCloseListener() { |
| 51 if (close_listener_) { | 51 if (close_listener_) { |
| 52 close_listener_->ClientHostClosing(this); | 52 close_listener_->ClientHostClosing(this); |
| 53 close_listener_ = NULL; | 53 close_listener_ = NULL; |
| 54 } | 54 } |
| 55 } | 55 } |
| OLD | NEW |