Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: content/browser/debugger/devtools_client_host.cc

Issue 8636010: Revert "DevTools: remove obsolete methods from DevToolsClientHost" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/browser/debugger/devtools_client_host.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
6
7 #include "base/lazy_instance.h"
8 #include "base/logging.h"
5 #include "content/browser/debugger/devtools_client_host.h" 9 #include "content/browser/debugger/devtools_client_host.h"
6
7 #include "content/browser/debugger/devtools_manager.h" 10 #include "content/browser/debugger/devtools_manager.h"
8 11
12 typedef std::vector<DevToolsClientHost*> DevToolsClientHostList;
13 namespace {
14 base::LazyInstance<DevToolsClientHostList,
15 base::LeakyLazyInstanceTraits<DevToolsClientHostList> >
16 g_instances = LAZY_INSTANCE_INITIALIZER;
17 } // namespace
18
19 // static
20 DevToolsClientHost* DevToolsClientHost::FindOwnerClientHost(
21 RenderViewHost* client_rvh) {
22 for (DevToolsClientHostList::iterator it = g_instances.Get().begin();
23 it != g_instances.Get().end(); ++it) {
24 if ((*it)->GetClientRenderViewHost() == client_rvh)
25 return *it;
26 }
27 return NULL;
28 }
29
9 DevToolsClientHost::~DevToolsClientHost() { 30 DevToolsClientHost::~DevToolsClientHost() {
31 DevToolsClientHostList::iterator it = std::find(g_instances.Get().begin(),
32 g_instances.Get().end(),
33 this);
34 DCHECK(it != g_instances.Get().end());
35 g_instances.Get().erase(it);
36 }
37
38 RenderViewHost* DevToolsClientHost::GetClientRenderViewHost() {
39 return NULL;
10 } 40 }
11 41
12 DevToolsClientHost::DevToolsClientHost() : close_listener_(NULL) { 42 DevToolsClientHost::DevToolsClientHost() : close_listener_(NULL) {
43 g_instances.Get().push_back(this);
13 } 44 }
14 45
15 void DevToolsClientHost::ForwardToDevToolsAgent(const IPC::Message& message) { 46 void DevToolsClientHost::ForwardToDevToolsAgent(const IPC::Message& message) {
16 DevToolsManager::GetInstance()->ForwardToDevToolsAgent(this, message); 47 DevToolsManager::GetInstance()->ForwardToDevToolsAgent(this, message);
17 } 48 }
18 49
19 void DevToolsClientHost::NotifyCloseListener() { 50 void DevToolsClientHost::NotifyCloseListener() {
20 if (close_listener_) { 51 if (close_listener_) {
21 close_listener_->ClientHostClosing(this); 52 close_listener_->ClientHostClosing(this);
22 close_listener_ = NULL; 53 close_listener_ = NULL;
23 } 54 }
24 } 55 }
OLDNEW
« no previous file with comments | « content/browser/debugger/devtools_client_host.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698