Title: [159115] trunk/Source/WebCore
Revision
159115
Author
zandober...@gmail.com
Date
2013-11-12 09:33:10 -0800 (Tue, 12 Nov 2013)

Log Message

Manage StorageThread through std::unique_ptr
https://bugs.webkit.org/show_bug.cgi?id=124197

Reviewed by Anders Carlsson.

New StorageThread objects are crafted through std::make_unique. This removes the need for the static
StorageThread::create() method but requires that the StorageThread constructor is made public.

* storage/StorageSyncManager.cpp:
(WebCore::StorageSyncManager::StorageSyncManager):
* storage/StorageSyncManager.h:
* storage/StorageThread.cpp:
* storage/StorageThread.h:
* storage/StorageTracker.cpp:
(WebCore::StorageTracker::StorageTracker):
* storage/StorageTracker.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (159114 => 159115)


--- trunk/Source/WebCore/ChangeLog	2013-11-12 17:30:16 UTC (rev 159114)
+++ trunk/Source/WebCore/ChangeLog	2013-11-12 17:33:10 UTC (rev 159115)
@@ -1,5 +1,24 @@
 2013-11-12  Zan Dobersek  <zdober...@igalia.com>
 
+        Manage StorageThread through std::unique_ptr
+        https://bugs.webkit.org/show_bug.cgi?id=124197
+
+        Reviewed by Anders Carlsson.
+
+        New StorageThread objects are crafted through std::make_unique. This removes the need for the static
+        StorageThread::create() method but requires that the StorageThread constructor is made public.
+
+        * storage/StorageSyncManager.cpp:
+        (WebCore::StorageSyncManager::StorageSyncManager):
+        * storage/StorageSyncManager.h:
+        * storage/StorageThread.cpp:
+        * storage/StorageThread.h:
+        * storage/StorageTracker.cpp:
+        (WebCore::StorageTracker::StorageTracker):
+        * storage/StorageTracker.h:
+
+2013-11-12  Zan Dobersek  <zdober...@igalia.com>
+
         Remove unnecessary PassOwnPtr.h header includes under Source/WebCore/fileapi
         https://bugs.webkit.org/show_bug.cgi?id=124196
 

Modified: trunk/Source/WebCore/storage/StorageSyncManager.cpp (159114 => 159115)


--- trunk/Source/WebCore/storage/StorageSyncManager.cpp	2013-11-12 17:30:16 UTC (rev 159114)
+++ trunk/Source/WebCore/storage/StorageSyncManager.cpp	2013-11-12 17:33:10 UTC (rev 159115)
@@ -46,7 +46,7 @@
 }
 
 StorageSyncManager::StorageSyncManager(const String& path)
-    : m_thread(StorageThread::create())
+    : m_thread(std::make_unique<StorageThread>())
     , m_path(path.isolatedCopy())
 {
     ASSERT(isMainThread());

Modified: trunk/Source/WebCore/storage/StorageSyncManager.h (159114 => 159115)


--- trunk/Source/WebCore/storage/StorageSyncManager.h	2013-11-12 17:30:16 UTC (rev 159114)
+++ trunk/Source/WebCore/storage/StorageSyncManager.h	2013-11-12 17:33:10 UTC (rev 159115)
@@ -29,7 +29,6 @@
 #include <wtf/Forward.h>
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
-#include <wtf/OwnPtr.h>
 #include <wtf/text/WTFString.h>
 
 namespace WebCore {
@@ -48,7 +47,7 @@
 private:
     explicit StorageSyncManager(const String& path);
 
-    OwnPtr<StorageThread> m_thread;
+    std::unique_ptr<StorageThread> m_thread;
 
 // The following members are subject to thread synchronization issues
 public:

Modified: trunk/Source/WebCore/storage/StorageThread.cpp (159114 => 159115)


--- trunk/Source/WebCore/storage/StorageThread.cpp	2013-11-12 17:30:16 UTC (rev 159114)
+++ trunk/Source/WebCore/storage/StorageThread.cpp	2013-11-12 17:33:10 UTC (rev 159115)
@@ -40,11 +40,6 @@
     return threads;
 }
 
-PassOwnPtr<StorageThread> StorageThread::create()
-{
-    return adoptPtr(new StorageThread);
-}
-
 StorageThread::StorageThread()
     : m_threadID(0)
 {

Modified: trunk/Source/WebCore/storage/StorageThread.h (159114 => 159115)


--- trunk/Source/WebCore/storage/StorageThread.h	2013-11-12 17:30:16 UTC (rev 159114)
+++ trunk/Source/WebCore/storage/StorageThread.h	2013-11-12 17:33:10 UTC (rev 159115)
@@ -29,7 +29,6 @@
 #include <wtf/Functional.h>
 #include <wtf/HashSet.h>
 #include <wtf/MessageQueue.h>
-#include <wtf/PassOwnPtr.h>
 #include <wtf/PassRefPtr.h>
 #include <wtf/Threading.h>
 
@@ -41,7 +40,7 @@
 class StorageThread {
     WTF_MAKE_NONCOPYABLE(StorageThread); WTF_MAKE_FAST_ALLOCATED;
 public:
-    static PassOwnPtr<StorageThread> create();
+    StorageThread();
     ~StorageThread();
 
     bool start();
@@ -52,8 +51,6 @@
     static void releaseFastMallocFreeMemoryInAllThreads();
 
 private:
-    StorageThread();
-
     // Called on background thread.
     static void threadEntryPointCallback(void*);
     void threadEntryPoint();

Modified: trunk/Source/WebCore/storage/StorageTracker.cpp (159114 => 159115)


--- trunk/Source/WebCore/storage/StorageTracker.cpp	2013-11-12 17:30:16 UTC (rev 159114)
+++ trunk/Source/WebCore/storage/StorageTracker.cpp	2013-11-12 17:33:10 UTC (rev 159115)
@@ -90,7 +90,7 @@
 StorageTracker::StorageTracker(const String& storagePath)
     : m_storageDirectoryPath(storagePath.isolatedCopy())
     , m_client(0)
-    , m_thread(StorageThread::create())
+    , m_thread(std::make_unique<StorageThread>())
     , m_isActive(false)
     , m_needsInitialization(false)
     , m_StorageDatabaseIdleInterval(DefaultStorageDatabaseIdleInterval)

Modified: trunk/Source/WebCore/storage/StorageTracker.h (159114 => 159115)


--- trunk/Source/WebCore/storage/StorageTracker.h	2013-11-12 17:30:16 UTC (rev 159114)
+++ trunk/Source/WebCore/storage/StorageTracker.h	2013-11-12 17:33:10 UTC (rev 159115)
@@ -28,7 +28,6 @@
 
 #include "SQLiteDatabase.h"
 #include <wtf/HashSet.h>
-#include <wtf/OwnPtr.h>
 #include <wtf/Vector.h>
 #include <wtf/text/StringHash.h>
 #include <wtf/text/WTFString.h>
@@ -109,7 +108,7 @@
     OriginSet m_originSet;
     OriginSet m_originsBeingDeleted;
 
-    OwnPtr<StorageThread> m_thread;
+    std::unique_ptr<StorageThread> m_thread;
     
     bool m_isActive;
     bool m_needsInitialization;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to