⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 244077 in webkit


Ignore:
Timestamp:
Apr 9, 2019, 8:56:45 AM (7 years ago)
Author:
sihui_liu@apple.com
Message:

Remove unnecessary network process assertion for IDB close
https://bugs.webkit.org/show_bug.cgi?id=196693

Reviewed by Geoffrey Garen.

Source/WebCore:

We already took assertion at WebCore::SQLiteDatabase::close.

  • Modules/indexeddb/server/IDBServer.cpp:

(WebCore::IDBServer::IDBServer::create):
(WebCore::IDBServer::IDBServer::IDBServer):
(WebCore::IDBServer::m_quotaManagerGetter): Deleted.
(WebCore::IDBServer::IDBServer::closeDatabase): Deleted.
(WebCore::IDBServer::IDBServer::didCloseDatabase): Deleted.

  • Modules/indexeddb/server/IDBServer.h:

(WebCore::IDBServer::IDBServer::create): Deleted.

  • Modules/indexeddb/server/UniqueIDBDatabase.cpp:

(WebCore::IDBServer::UniqueIDBDatabase::performCurrentDeleteOperation):
(WebCore::IDBServer::UniqueIDBDatabase::scheduleShutdownForClose):
(WebCore::IDBServer::UniqueIDBDatabase::didShutdownForClose):
(WebCore::IDBServer::UniqueIDBDatabase::didDeleteBackingStore):
(WebCore::IDBServer::UniqueIDBDatabase::immediateCloseForUserDelete):
(WebCore::IDBServer::UniqueIDBDatabase::notifyServerAboutClose): Deleted.

  • Modules/indexeddb/server/UniqueIDBDatabase.h:

Source/WebKit:

  • NetworkProcess/NetworkProcess.cpp:

(WebKit::NetworkProcess::createIDBServer):
(WebKit::NetworkProcess::notifyHoldingLockedFiles): Deleted.

  • NetworkProcess/NetworkProcess.h:
  • UIProcess/Network/NetworkProcessProxy.cpp:

(WebKit::NetworkProcessProxy::didClose):
(WebKit::NetworkProcessProxy::setIsIDBDatabaseHoldingLockedFiles): Deleted.

  • UIProcess/Network/NetworkProcessProxy.h:
  • UIProcess/Network/NetworkProcessProxy.messages.in:
Location:
trunk/Source
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r244074 r244077  
     12019-04-09  Sihui Liu  <sihui_liu@apple.com>
     2
     3        Remove unnecessary network process assertion for IDB close
     4        https://bugs.webkit.org/show_bug.cgi?id=196693
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        We already took assertion at WebCore::SQLiteDatabase::close.
     9
     10        * Modules/indexeddb/server/IDBServer.cpp:
     11        (WebCore::IDBServer::IDBServer::create):
     12        (WebCore::IDBServer::IDBServer::IDBServer):
     13        (WebCore::IDBServer::m_quotaManagerGetter): Deleted.
     14        (WebCore::IDBServer::IDBServer::closeDatabase): Deleted.
     15        (WebCore::IDBServer::IDBServer::didCloseDatabase): Deleted.
     16        * Modules/indexeddb/server/IDBServer.h:
     17        (WebCore::IDBServer::IDBServer::create): Deleted.
     18        * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
     19        (WebCore::IDBServer::UniqueIDBDatabase::performCurrentDeleteOperation):
     20        (WebCore::IDBServer::UniqueIDBDatabase::scheduleShutdownForClose):
     21        (WebCore::IDBServer::UniqueIDBDatabase::didShutdownForClose):
     22        (WebCore::IDBServer::UniqueIDBDatabase::didDeleteBackingStore):
     23        (WebCore::IDBServer::UniqueIDBDatabase::immediateCloseForUserDelete):
     24        (WebCore::IDBServer::UniqueIDBDatabase::notifyServerAboutClose): Deleted.
     25        * Modules/indexeddb/server/UniqueIDBDatabase.h:
     26
    1272019-04-09  Eike Rathke  <erack@redhat.com>
    228
  • trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp

    r243339 r244077  
    4646namespace IDBServer {
    4747
    48 Ref<IDBServer> IDBServer::create(PAL::SessionID sessionID, IDBBackingStoreTemporaryFileHandler& fileHandler, QuotaManagerGetter&& quotaManagerGetter, WTF::Function<void(bool)>&& isClosingDatabaseCallback)
    49 {
    50     return adoptRef(*new IDBServer(sessionID, fileHandler, WTFMove(quotaManagerGetter), WTFMove(isClosingDatabaseCallback)));
    51 }
    52 
    53 Ref<IDBServer> IDBServer::create(PAL::SessionID sessionID, const String& databaseDirectoryPath, IDBBackingStoreTemporaryFileHandler& fileHandler, QuotaManagerGetter&& quotaManagerGetter, WTF::Function<void(bool)>&& isClosingDatabaseCallback)
    54 {
    55     return adoptRef(*new IDBServer(sessionID, databaseDirectoryPath, fileHandler, WTFMove(quotaManagerGetter), WTFMove(isClosingDatabaseCallback)));
    56 }
    57 
    58 IDBServer::IDBServer(PAL::SessionID sessionID, IDBBackingStoreTemporaryFileHandler& fileHandler, QuotaManagerGetter&& quotaManagerGetter, WTF::Function<void(bool)>&& isClosingDatabaseCallback)
     48Ref<IDBServer> IDBServer::create(PAL::SessionID sessionID, IDBBackingStoreTemporaryFileHandler& fileHandler, QuotaManagerGetter&& quotaManagerGetter)
     49{
     50    return adoptRef(*new IDBServer(sessionID, fileHandler, WTFMove(quotaManagerGetter)));
     51}
     52
     53Ref<IDBServer> IDBServer::create(PAL::SessionID sessionID, const String& databaseDirectoryPath, IDBBackingStoreTemporaryFileHandler& fileHandler, QuotaManagerGetter&& quotaManagerGetter)
     54{
     55    return adoptRef(*new IDBServer(sessionID, databaseDirectoryPath, fileHandler, WTFMove(quotaManagerGetter)));
     56}
     57
     58IDBServer::IDBServer(PAL::SessionID sessionID, IDBBackingStoreTemporaryFileHandler& fileHandler, QuotaManagerGetter&& quotaManagerGetter)
    5959    : CrossThreadTaskHandler("IndexedDatabase Server")
    6060    , m_sessionID(sessionID)
    6161    , m_backingStoreTemporaryFileHandler(fileHandler)
    62     , m_isClosingDatabaseCallback(WTFMove(isClosingDatabaseCallback))
    63     , m_isClosingDatabaseHysteresis([&](PAL::HysteresisState state) { m_isClosingDatabaseCallback(state == PAL::HysteresisState::Started); })
    6462    , m_quotaManagerGetter(WTFMove(quotaManagerGetter))
    6563{
    6664}
    6765
    68 IDBServer::IDBServer(PAL::SessionID sessionID, const String& databaseDirectoryPath, IDBBackingStoreTemporaryFileHandler& fileHandler, QuotaManagerGetter&& quotaManagerGetter, WTF::Function<void(bool)>&& isClosingDatabaseCallback)
     66IDBServer::IDBServer(PAL::SessionID sessionID, const String& databaseDirectoryPath, IDBBackingStoreTemporaryFileHandler& fileHandler, QuotaManagerGetter&& quotaManagerGetter)
    6967    : CrossThreadTaskHandler("IndexedDatabase Server")
    7068    , m_sessionID(sessionID)
    7169    , m_databaseDirectoryPath(databaseDirectoryPath)
    7270    , m_backingStoreTemporaryFileHandler(fileHandler)
    73     , m_isClosingDatabaseCallback(WTFMove(isClosingDatabaseCallback))
    74     , m_isClosingDatabaseHysteresis([&](PAL::HysteresisState state) { m_isClosingDatabaseCallback(state == PAL::HysteresisState::Started); })
    7571    , m_quotaManagerGetter(WTFMove(quotaManagerGetter))
    7672{
     
    703699}
    704700
    705 void IDBServer::closeDatabase(UniqueIDBDatabase* database)
    706 {
    707     ASSERT(isMainThread());
    708     if (m_databaseDirectoryPath.isEmpty())
    709         return;
    710 
    711     auto addResult = m_uniqueIDBDatabasesInClose.add(database);
    712     if (addResult.isNewEntry && m_uniqueIDBDatabasesInClose.size() == 1)
    713         m_isClosingDatabaseHysteresis.start();
    714 }
    715 
    716 void IDBServer::didCloseDatabase(UniqueIDBDatabase* database)
    717 {
    718     ASSERT(isMainThread());
    719     if (m_databaseDirectoryPath.isEmpty())
    720         return;
    721 
    722     if (m_uniqueIDBDatabasesInClose.remove(database)) {
    723         if (m_uniqueIDBDatabasesInClose.isEmpty())
    724             m_isClosingDatabaseHysteresis.stop();
    725     }
    726 }
    727 
    728701IDBServer::QuotaUser::QuotaUser(IDBServer& server, StorageQuotaManager* manager, ClientOrigin&& origin)
    729702    : m_server(server)
  • trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.h

    r244027 r244077  
    6262public:
    6363    using QuotaManagerGetter = WTF::Function<StorageQuotaManager*(PAL::SessionID, const ClientOrigin&)>;
    64     static Ref<IDBServer> create(PAL::SessionID, IDBBackingStoreTemporaryFileHandler&, QuotaManagerGetter&&, WTF::Function<void(bool)>&& isClosingDatabaseCallback = [](bool) { });
    65     WEBCORE_EXPORT static Ref<IDBServer> create(PAL::SessionID, const String& databaseDirectoryPath, IDBBackingStoreTemporaryFileHandler&, QuotaManagerGetter&&, WTF::Function<void(bool)>&& isClosingDatabaseCallback = [](bool) { });
     64    static Ref<IDBServer> create(PAL::SessionID, IDBBackingStoreTemporaryFileHandler&, QuotaManagerGetter&&);
     65    WEBCORE_EXPORT static Ref<IDBServer> create(PAL::SessionID, const String& databaseDirectoryPath, IDBBackingStoreTemporaryFileHandler&, QuotaManagerGetter&&);
    6666
    6767    WEBCORE_EXPORT void registerConnection(IDBConnectionToClient&);
     
    117117    WEBCORE_EXPORT void setPerOriginQuota(uint64_t);
    118118
    119     void closeDatabase(UniqueIDBDatabase*);
    120     void didCloseDatabase(UniqueIDBDatabase*);
    121     void hysteresisUpdated(PAL::HysteresisState);
    122 
    123119    void requestSpace(const ClientOrigin&, uint64_t taskSize, CompletionHandler<void(StorageQuotaManager::Decision)>&&);
    124120    void increasePotentialSpaceUsed(const ClientOrigin&, uint64_t taskSize);
     
    130126
    131127private:
    132     IDBServer(PAL::SessionID, IDBBackingStoreTemporaryFileHandler&, QuotaManagerGetter&&, WTF::Function<void(bool)>&&);
    133     IDBServer(PAL::SessionID, const String& databaseDirectoryPath, IDBBackingStoreTemporaryFileHandler&, QuotaManagerGetter&&, WTF::Function<void(bool)>&&);
     128    IDBServer(PAL::SessionID, IDBBackingStoreTemporaryFileHandler&, QuotaManagerGetter&&);
     129    IDBServer(PAL::SessionID, const String& databaseDirectoryPath, IDBBackingStoreTemporaryFileHandler&, QuotaManagerGetter&&);
    134130
    135131    UniqueIDBDatabase& getOrCreateUniqueIDBDatabase(const IDBDatabaseIdentifier&);
     
    187183    HashMap<uint64_t, RefPtr<IDBConnectionToClient>> m_connectionMap;
    188184    HashMap<IDBDatabaseIdentifier, std::unique_ptr<UniqueIDBDatabase>> m_uniqueIDBDatabaseMap;
    189     HashSet<UniqueIDBDatabase*> m_uniqueIDBDatabasesInClose;
    190185
    191186    HashMap<uint64_t, UniqueIDBDatabaseConnection*> m_databaseConnections;
     
    198193
    199194    uint64_t m_perOriginQuota { defaultPerOriginQuota };
    200 
    201     WTF::Function<void(bool)> m_isClosingDatabaseCallback;
    202     PAL::HysteresisActivity m_isClosingDatabaseHysteresis;
    203195
    204196    HashMap<ClientOrigin, std::unique_ptr<QuotaUser>> m_quotaUsers;
  • trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp

    r243910 r244077  
    331331        else {
    332332            m_deleteBackingStoreInProgress = true;
    333             notifyServerAboutClose(CloseState::Start);
    334333            postDatabaseTask(createCrossThreadTask(*this, &UniqueIDBDatabase::deleteBackingStore, m_identifier));
    335334        }
     
    384383    m_owningPointerForClose = m_server->closeAndTakeUniqueIDBDatabase(*this);
    385384
    386     notifyServerAboutClose(CloseState::Start);
    387385    postDatabaseTask(createCrossThreadTask(*this, &UniqueIDBDatabase::shutdownForClose));
    388386}
     
    412410    ASSERT(m_databaseReplyQueue.isEmpty());
    413411    m_databaseReplyQueue.kill();
    414     notifyServerAboutClose(CloseState::Done);
    415412}
    416413
     
    448445    if (m_hardClosedForUserDelete)
    449446        return;
    450     notifyServerAboutClose(CloseState::Done);
    451447
    452448    invokeOperationAndTransactionTimer();
     
    22222218        return;
    22232219
    2224     notifyServerAboutClose(CloseState::Start);
    22252220    // Otherwise, this database is still potentially active.
    22262221    // So we'll have it own itself and then perform a clean unconditional delete on the background thread.
     
    23152310}
    23162311
    2317 void UniqueIDBDatabase::notifyServerAboutClose(CloseState state)
    2318 {
    2319     ASSERT(isMainThread());
    2320 #if PLATFORM(IOS_FAMILY)
    2321     if (state == CloseState::Start)
    2322         m_server->closeDatabase(this);
    2323     else
    2324         m_server->didCloseDatabase(this);
    2325 #else
    2326     UNUSED_PARAM(state);
    2327 #endif
    2328 }
    2329 
    23302312} // namespace IDBServer
    23312313} // namespace WebCore
  • trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h

    r243270 r244077  
    129129
    130130private:
    131     enum class CloseState { Start, Done };
    132 
    133131    void handleDatabaseOperations();
    134132    void handleCurrentOperation();
     
    252250    bool isDoneWithHardClose();
    253251
    254     void notifyServerAboutClose(CloseState);
    255 
    256252    void requestSpace(uint64_t taskSize, const char* errorMessage, CompletionHandler<void(Optional<IDBError>&&)>&&);
    257253    void waitForRequestSpaceCompletion(CompletionHandler<void(Optional<IDBError>&&)>&&);
  • trunk/Source/WebKit/ChangeLog

    r244075 r244077  
     12019-04-09  Sihui Liu  <sihui_liu@apple.com>
     2
     3        Remove unnecessary network process assertion for IDB close
     4        https://bugs.webkit.org/show_bug.cgi?id=196693
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        * NetworkProcess/NetworkProcess.cpp:
     9        (WebKit::NetworkProcess::createIDBServer):
     10        (WebKit::NetworkProcess::notifyHoldingLockedFiles): Deleted.
     11        * NetworkProcess/NetworkProcess.h:
     12        * UIProcess/Network/NetworkProcessProxy.cpp:
     13        (WebKit::NetworkProcessProxy::didClose):
     14        (WebKit::NetworkProcessProxy::setIsIDBDatabaseHoldingLockedFiles): Deleted.
     15        * UIProcess/Network/NetworkProcessProxy.h:
     16        * UIProcess/Network/NetworkProcessProxy.messages.in:
     17
    1182019-04-09  Chris Dumez  <cdumez@apple.com>
    219
  • trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp

    r243911 r244077  
    21232123            return nullptr;
    21242124        return &this->storageQuotaManager(sessionID, origin);
    2125     }, [this, weakThis = makeWeakPtr(this)](bool isHoldingLockedFiles) {
    2126         if (!weakThis)
    2127             return;
    2128         this->notifyHoldingLockedFiles(isHoldingLockedFiles);
    21292125    });
    21302126    server->setPerOriginQuota(m_idbPerOriginQuota);
     
    25042500}
    25052501
    2506 void NetworkProcess::notifyHoldingLockedFiles(bool isIDBDatabaseHoldingLockedFiles)
    2507 {
    2508     parentProcessConnection()->send(Messages::NetworkProcessProxy::SetIsIDBDatabaseHoldingLockedFiles(isIDBDatabaseHoldingLockedFiles), 0);
    2509 }
    2510 
    25112502} // namespace WebKit
  • trunk/Source/WebKit/NetworkProcess/NetworkProcess.h

    r243911 r244077  
    408408    void didSyncAllCookies();
    409409
    410     void notifyHoldingLockedFiles(bool isIDBDatabaseHoldingLockedFiles);
    411410#if USE(SOUP)
    412411    void setIgnoreTLSErrors(bool);
  • trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp

    r243911 r244077  
    280280
    281281    m_tokenForHoldingLockedFiles = nullptr;
    282     m_tokenForIDBDatabaseHoldingLockedFiles = nullptr;
    283282   
    284283    m_syncAllCookiesToken = nullptr;
     
    10591058}
    10601059
    1061 void NetworkProcessProxy::setIsIDBDatabaseHoldingLockedFiles(bool isIDBDatabaseHoldingLockedFiles)
    1062 {
    1063     if (!isIDBDatabaseHoldingLockedFiles) {
    1064         RELEASE_LOG(ProcessSuspension, "UIProcess is releasing a background assertion because the Network process is no longer holding locked files for IDBDatabase");
    1065         m_tokenForIDBDatabaseHoldingLockedFiles = nullptr;
    1066         return;
    1067     }
    1068     if (!m_tokenForIDBDatabaseHoldingLockedFiles) {
    1069         RELEASE_LOG(ProcessSuspension, "UIProcess is taking a background assertion because the Network process is holding locked files for IDBDatabase");
    1070         m_tokenForIDBDatabaseHoldingLockedFiles = m_throttler.backgroundActivityToken();
    1071     }
    1072 }
    1073 
    10741060void NetworkProcessProxy::syncAllCookies()
    10751061{
  • trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h

    r243632 r244077  
    160160
    161161    void setIsHoldingLockedFiles(bool);
    162     void setIsIDBDatabaseHoldingLockedFiles(bool);
    163162
    164163    void syncAllCookies();
     
    262261    ProcessThrottler m_throttler;
    263262    ProcessThrottler::BackgroundActivityToken m_tokenForHoldingLockedFiles;
    264     ProcessThrottler::BackgroundActivityToken m_tokenForIDBDatabaseHoldingLockedFiles;
    265263    ProcessThrottler::BackgroundActivityToken m_syncAllCookiesToken;
    266264   
  • trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.messages.in

    r243632 r244077  
    3434    ProcessReadyToSuspend()
    3535    SetIsHoldingLockedFiles(bool isHoldingLockedFiles)
    36     SetIsIDBDatabaseHoldingLockedFiles(bool isIDBDatabaseHoldingLockedFiles)
    3736
    3837    # Diagnostic messages logging
Note: See TracChangeset for help on using the changeset viewer.