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

Unified Diff: net/websockets/websocket_job.cc

Issue 5682008: Make members of Singleton<T> private and only visible to the singleton type. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 10 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 side-by-side diff with in-line comments
Download patch
Index: net/websockets/websocket_job.cc
diff --git a/net/websockets/websocket_job.cc b/net/websockets/websocket_job.cc
index 9adbaa341ce1dcaa94f6116f550eedd11c544032..44c944db39ff3fad6a1ef2c1df87923cedcfefc7 100644
--- a/net/websockets/websocket_job.cc
+++ b/net/websockets/websocket_job.cc
@@ -6,7 +6,7 @@
#include <algorithm>
-#include "base/singleton.h"
+#include "base/lazy_instance.h"
#include "base/string_tokenizer.h"
#include "googleurl/src/gurl.h"
#include "net/base/net_errors.h"
@@ -40,20 +40,23 @@ net::SocketStreamJob* WebSocketJobFactory(
class WebSocketJobInitSingleton {
private:
- friend struct DefaultSingletonTraits<WebSocketJobInitSingleton>;
+ friend struct base::DefaultLazyInstanceTraits<WebSocketJobInitSingleton>;
WebSocketJobInitSingleton() {
net::SocketStreamJob::RegisterProtocolFactory("ws", WebSocketJobFactory);
net::SocketStreamJob::RegisterProtocolFactory("wss", WebSocketJobFactory);
}
};
+static base::LazyInstance<WebSocketJobInitSingleton> g_websocket_job_init(
+ base::LINKER_INITIALIZED);
+
} // anonymous namespace
namespace net {
// static
void WebSocketJob::EnsureInit() {
- Singleton<WebSocketJobInitSingleton>::get();
+ g_websocket_job_init.Get();
}
WebSocketJob::WebSocketJob(SocketStream::Delegate* delegate)

Powered by Google App Engine
This is Rietveld 408576698