| Index: content/browser/debugger/devtools_client_host.cc
|
| diff --git a/content/browser/debugger/devtools_client_host.cc b/content/browser/debugger/devtools_client_host.cc
|
| index 68fa25fffca955cf9b7d723c4d15fa815a3659f7..3ff2c5496e3d2bac3b3369f78fb6a97dc27e41a2 100644
|
| --- a/content/browser/debugger/devtools_client_host.cc
|
| +++ b/content/browser/debugger/devtools_client_host.cc
|
| @@ -2,14 +2,45 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "content/browser/debugger/devtools_client_host.h"
|
| +#include <algorithm>
|
|
|
| +#include "base/lazy_instance.h"
|
| +#include "base/logging.h"
|
| +#include "content/browser/debugger/devtools_client_host.h"
|
| #include "content/browser/debugger/devtools_manager.h"
|
|
|
| +typedef std::vector<DevToolsClientHost*> DevToolsClientHostList;
|
| +namespace {
|
| +base::LazyInstance<DevToolsClientHostList,
|
| + base::LeakyLazyInstanceTraits<DevToolsClientHostList> >
|
| + g_instances = LAZY_INSTANCE_INITIALIZER;
|
| +} // namespace
|
| +
|
| +// static
|
| +DevToolsClientHost* DevToolsClientHost::FindOwnerClientHost(
|
| + RenderViewHost* client_rvh) {
|
| + for (DevToolsClientHostList::iterator it = g_instances.Get().begin();
|
| + it != g_instances.Get().end(); ++it) {
|
| + if ((*it)->GetClientRenderViewHost() == client_rvh)
|
| + return *it;
|
| + }
|
| + return NULL;
|
| +}
|
| +
|
| DevToolsClientHost::~DevToolsClientHost() {
|
| + DevToolsClientHostList::iterator it = std::find(g_instances.Get().begin(),
|
| + g_instances.Get().end(),
|
| + this);
|
| + DCHECK(it != g_instances.Get().end());
|
| + g_instances.Get().erase(it);
|
| +}
|
| +
|
| +RenderViewHost* DevToolsClientHost::GetClientRenderViewHost() {
|
| + return NULL;
|
| }
|
|
|
| DevToolsClientHost::DevToolsClientHost() : close_listener_(NULL) {
|
| + g_instances.Get().push_back(this);
|
| }
|
|
|
| void DevToolsClientHost::ForwardToDevToolsAgent(const IPC::Message& message) {
|
|
|