summaryrefslogtreecommitdiffstats
path: root/content/common/socket_stream_dispatcher.cc
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-08 07:48:23 +0000
committerthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-08 07:48:23 +0000
commitc08596702d2a16f21777c707db6641897fda5964 (patch)
tree05a192b585f9f63cd5d7b09f720cf657934109d2 /content/common/socket_stream_dispatcher.cc
parentdd33a3dc4f6483334d8d32212c49305e7a882971 (diff)
downloadchromium_src-c08596702d2a16f21777c707db6641897fda5964.zip
chromium_src-c08596702d2a16f21777c707db6641897fda5964.tar.gz
chromium_src-c08596702d2a16f21777c707db6641897fda5964.tar.bz2
content: Remove 16 exit time destructors and 15 static initializers.
BUG=101600,94925 TEST=none TBR=ben Review URL: http://codereview.chromium.org/8493016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@108982 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/common/socket_stream_dispatcher.cc')
-rw-r--r--content/common/socket_stream_dispatcher.cc19
1 files changed, 13 insertions, 6 deletions
diff --git a/content/common/socket_stream_dispatcher.cc b/content/common/socket_stream_dispatcher.cc
index a44dd94..6ee499e 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_))) {