Make NetworkCache's constructor private
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Feb 2015 01:18:28 +0000 (01:18 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Feb 2015 01:18:28 +0000 (01:18 +0000)
https://bugs.webkit.org/show_bug.cgi?id=141181

Reviewed by Antti Koivisto.

Make NetworkCache's constructor private and mark its destructor as
deleted as it is a singleton class.

* NetworkProcess/cache/NetworkCache.cpp:
(WebKit::NetworkCache::NetworkCache): Deleted.
* NetworkProcess/cache/NetworkCache.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@179529 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp
Source/WebKit2/NetworkProcess/cache/NetworkCache.h

index 81d17f4..c6d8d59 100644 (file)
@@ -1,3 +1,17 @@
+2015-02-02  Chris Dumez  <cdumez@apple.com>
+
+        Make NetworkCache's constructor private
+        https://bugs.webkit.org/show_bug.cgi?id=141181
+
+        Reviewed by Antti Koivisto.
+
+        Make NetworkCache's constructor private and mark its destructor as
+        deleted as it is a singleton class.
+
+        * NetworkProcess/cache/NetworkCache.cpp:
+        (WebKit::NetworkCache::NetworkCache): Deleted.
+        * NetworkProcess/cache/NetworkCache.h:
+
 2015-02-02  Filip Pizlo  <fpizlo@apple.com>
 
         Revert accidental (and super bad) change in r179490.
index c1dacc1..cb038e6 100644 (file)
@@ -49,10 +49,6 @@ NetworkCache& NetworkCache::singleton()
     return instance;
 }
 
-NetworkCache::NetworkCache()
-{
-}
-
 bool NetworkCache::initialize(const String& cachePath)
 {
     m_storage = NetworkCacheStorage::open(cachePath);
index 583ca01..5aa7b51 100644 (file)
@@ -43,11 +43,10 @@ namespace WebKit {
 
 class NetworkCache {
     WTF_MAKE_NONCOPYABLE(NetworkCache);
+    friend class WTF::NeverDestroyed<NetworkCache>;
 public:
     static NetworkCache& singleton();
 
-    NetworkCache();
-
     bool initialize(const String& cachePath);
     void setMaximumSize(size_t);
 
@@ -69,6 +68,9 @@ public:
     void clear();
 
 private:
+    NetworkCache() = default;
+    ~NetworkCache() = delete;
+
     std::unique_ptr<NetworkCacheStorage> m_storage;
 };