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

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

Issue 8493016: content: Remove 16 exit time destructors and 15 static initializers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: mac compile Created 9 years, 1 month 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
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> 5 #include <algorithm>
6 6
7 #include "base/lazy_instance.h"
7 #include "base/logging.h" 8 #include "base/logging.h"
8 #include "content/browser/debugger/devtools_client_host.h" 9 #include "content/browser/debugger/devtools_client_host.h"
9 #include "content/browser/debugger/devtools_manager.h" 10 #include "content/browser/debugger/devtools_manager.h"
10 11
11 DevToolsClientHost::DevToolsClientHostList DevToolsClientHost::instances_; 12 typedef std::vector<DevToolsClientHost*> DevToolsClientHostList;
13 namespace {
14 base::LazyInstance<DevToolsClientHostList,
15 base::LeakyLazyInstanceTraits<DevToolsClientHostList> >
16 g_instances(base::LINKER_INITIALIZED);
17 } // namespace
12 18
13 // static 19 // static
14 DevToolsClientHost* DevToolsClientHost::FindOwnerClientHost( 20 DevToolsClientHost* DevToolsClientHost::FindOwnerClientHost(
15 RenderViewHost* client_rvh) { 21 RenderViewHost* client_rvh) {
16 for (DevToolsClientHostList::iterator it = instances_.begin(); 22 for (DevToolsClientHostList::iterator it = g_instances.Get().begin();
17 it != instances_.end(); ++it) { 23 it != g_instances.Get().end(); ++it) {
18 if ((*it)->GetClientRenderViewHost() == client_rvh) 24 if ((*it)->GetClientRenderViewHost() == client_rvh)
19 return *it; 25 return *it;
20 } 26 }
21 return NULL; 27 return NULL;
22 } 28 }
23 29
24 DevToolsClientHost::~DevToolsClientHost() { 30 DevToolsClientHost::~DevToolsClientHost() {
25 DevToolsClientHostList::iterator it = std::find(instances_.begin(), 31 DevToolsClientHostList::iterator it = std::find(g_instances.Get().begin(),
26 instances_.end(), 32 g_instances.Get().end(),
27 this); 33 this);
28 DCHECK(it != instances_.end()); 34 DCHECK(it != g_instances.Get().end());
29 instances_.erase(it); 35 g_instances.Get().erase(it);
30 } 36 }
31 37
32 RenderViewHost* DevToolsClientHost::GetClientRenderViewHost() { 38 RenderViewHost* DevToolsClientHost::GetClientRenderViewHost() {
33 return NULL; 39 return NULL;
34 } 40 }
35 41
36 DevToolsClientHost::DevToolsClientHost() : close_listener_(NULL) { 42 DevToolsClientHost::DevToolsClientHost() : close_listener_(NULL) {
37 instances_.push_back(this); 43 g_instances.Get().push_back(this);
38 } 44 }
39 45
40 void DevToolsClientHost::ForwardToDevToolsAgent(const IPC::Message& message) { 46 void DevToolsClientHost::ForwardToDevToolsAgent(const IPC::Message& message) {
41 DevToolsManager::GetInstance()->ForwardToDevToolsAgent(this, message); 47 DevToolsManager::GetInstance()->ForwardToDevToolsAgent(this, message);
42 } 48 }
43 49
44 void DevToolsClientHost::NotifyCloseListener() { 50 void DevToolsClientHost::NotifyCloseListener() {
45 if (close_listener_) { 51 if (close_listener_) {
46 close_listener_->ClientHostClosing(this); 52 close_listener_->ClientHostClosing(this);
47 close_listener_ = NULL; 53 close_listener_ = NULL;
48 } 54 }
49 } 55 }
OLDNEW
« no previous file with comments | « content/browser/debugger/devtools_client_host.h ('k') | content/browser/debugger/devtools_http_protocol_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698