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

Unified Diff: content/common/socket_stream_dispatcher.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/common/np_channel_base.cc ('k') | content/renderer/devtools_agent.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/socket_stream_dispatcher.cc
diff --git a/content/common/socket_stream_dispatcher.cc b/content/common/socket_stream_dispatcher.cc
index a44dd94a1f18ed8589ab18a129624acd3dc67638..6ee499ea0dc89befa0f5fe58f50eea4155abb67a 100644
--- a/content/common/socket_stream_dispatcher.cc
+++ b/content/common/socket_stream_dispatcher.cc
@@ -7,6 +7,7 @@
#include <vector>
#include "base/id_map.h"
+#include "base/lazy_instance.h"
#include "base/memory/ref_counted.h"
#include "base/message_loop.h"
#include "base/task.h"
@@ -56,16 +57,22 @@ class IPCWebSocketStreamHandleBridge
WebKit::WebSocketStreamHandle* handle_;
webkit_glue::WebSocketStreamHandleDelegate* delegate_;
- static IDMap<IPCWebSocketStreamHandleBridge> all_bridges;
+ static base::LazyInstance<
+ IDMap<IPCWebSocketStreamHandleBridge>,
+ base::LeakyLazyInstanceTraits<IDMap<IPCWebSocketStreamHandleBridge> > >
+ all_bridges;
};
-IDMap<IPCWebSocketStreamHandleBridge>
-IPCWebSocketStreamHandleBridge::all_bridges;
+// static
+base::LazyInstance<
+ IDMap<IPCWebSocketStreamHandleBridge>,
+ base::LeakyLazyInstanceTraits<IDMap<IPCWebSocketStreamHandleBridge> > >
+ IPCWebSocketStreamHandleBridge::all_bridges(base::LINKER_INITIALIZED);
/* static */
IPCWebSocketStreamHandleBridge* IPCWebSocketStreamHandleBridge::FromSocketId(
int id) {
- return all_bridges.Lookup(id);
+ return all_bridges.Get().Lookup(id);
}
IPCWebSocketStreamHandleBridge::~IPCWebSocketStreamHandleBridge() {
@@ -127,7 +134,7 @@ void IPCWebSocketStreamHandleBridge::OnReceivedData(
void IPCWebSocketStreamHandleBridge::OnClosed() {
DVLOG(1) << "IPCWebSocketStreamHandleBridge::OnClosed";
if (socket_id_ != content_common::kNoSocketId) {
- all_bridges.Remove(socket_id_);
+ all_bridges.Get().Remove(socket_id_);
socket_id_ = content_common::kNoSocketId;
}
if (delegate_)
@@ -142,7 +149,7 @@ void IPCWebSocketStreamHandleBridge::DoConnect(const GURL& url) {
if (delegate_)
delegate_->WillOpenStream(handle_, url);
- socket_id_ = all_bridges.Add(this);
+ socket_id_ = all_bridges.Get().Add(this);
DCHECK_NE(socket_id_, content_common::kNoSocketId);
AddRef(); // Released in OnClosed().
if (child_thread_->Send(new SocketStreamHostMsg_Connect(url, socket_id_))) {
« no previous file with comments | « content/common/np_channel_base.cc ('k') | content/renderer/devtools_agent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698