Changeset 248780 in webkit


Ignore:
Timestamp:
Aug 16, 2019 11:22:16 AM (5 years ago)
Author:
Chris Dumez
Message:

StorageManager does not need to subclass RefCounted
https://bugs.webkit.org/show_bug.cgi?id=200818

Reviewed by Geoffrey Garen.

StorageManager does not need to subclass RefCounted. It is owned by the StorageManagerSet
and is never ref'd / deref'd.

  • NetworkProcess/WebStorage/StorageManager.h:

(WebKit::StorageManager::create): Deleted.

  • NetworkProcess/WebStorage/StorageManagerSet.cpp:

(WebKit::StorageManagerSet::add):

  • NetworkProcess/WebStorage/StorageManagerSet.h:
Location:
trunk/Source/WebKit
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r248779 r248780  
     12019-08-16  Chris Dumez  <cdumez@apple.com>
     2
     3        StorageManager does not need to subclass RefCounted
     4        https://bugs.webkit.org/show_bug.cgi?id=200818
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        StorageManager does not need to subclass RefCounted. It is owned by the StorageManagerSet
     9        and is never ref'd / deref'd.
     10
     11        * NetworkProcess/WebStorage/StorageManager.h:
     12        (WebKit::StorageManager::create): Deleted.
     13        * NetworkProcess/WebStorage/StorageManagerSet.cpp:
     14        (WebKit::StorageManagerSet::add):
     15        * NetworkProcess/WebStorage/StorageManagerSet.h:
     16
    1172019-08-16  Chris Dumez  <cdumez@apple.com>
    218
  • trunk/Source/WebKit/NetworkProcess/WebStorage/StorageManager.h

    r248779 r248780  
    4949using GetValuesCallback = CompletionHandler<void(const HashMap<String, String>&)>;
    5050
    51 class StorageManager : public RefCounted<StorageManager> {
     51class StorageManager {
     52    WTF_MAKE_NONCOPYABLE(StorageManager);
     53    WTF_MAKE_FAST_ALLOCATED;
    5254public:
    53     static Ref<StorageManager> create(String&& localStorageDirectory)
    54     {
    55         return adoptRef(*new StorageManager(WTFMove(localStorageDirectory)));
    56     }
    57    
     55    explicit StorageManager(String&& localStorageDirectory);
    5856    ~StorageManager();
    5957
     
    8583
    8684private:
    87     explicit StorageManager(String&& localStorageDirectory);
    88 
    8985    LocalStorageNamespace* getOrCreateLocalStorageNamespace(uint64_t storageNamespaceID);
    9086    TransientLocalStorageNamespace* getOrCreateTransientLocalStorageNamespace(uint64_t storageNamespaceID, WebCore::SecurityOriginData&& topLevelOrigin);
  • trunk/Source/WebKit/NetworkProcess/WebStorage/StorageManagerSet.cpp

    r248779 r248780  
    6565            SandboxExtension::consumePermanently(localStorageDirectoryHandle);
    6666
    67         m_queue->dispatch([this, protectedThis = makeRef(*this), sessionID, directory = localStorageDirectory.isolatedCopy()]() mutable {
    68             m_storageManagers.ensure(sessionID, [directory]() mutable {
    69                 return StorageManager::create(WTFMove(directory));
     67        m_queue->dispatch([this, protectedThis = makeRef(*this), sessionID, localStorageDirectory = localStorageDirectory.isolatedCopy()]() mutable {
     68            m_storageManagers.ensure(sessionID, [&]() mutable {
     69                return std::make_unique<StorageManager>(WTFMove(localStorageDirectory));
    7070            });
    7171        });
  • trunk/Source/WebKit/NetworkProcess/WebStorage/StorageManagerSet.h

    r248778 r248780  
    8585    void cloneSessionStorageNamespace(IPC::Connection&, PAL::SessionID, uint64_t fromStorageNamespaceID, uint64_t toStorageNamespaceID);
    8686
    87     HashMap<PAL::SessionID, RefPtr<StorageManager>> m_storageManagers;
     87    HashMap<PAL::SessionID, std::unique_ptr<StorageManager>> m_storageManagers;
    8888    HashMap<PAL::SessionID, String> m_storageManagerPaths;
    8989    HashMap<uint64_t, StorageArea*> m_storageAreas;
Note: See TracChangeset for help on using the changeset viewer.