[Webkit-unassigned] [Bug 134042] Don't kill the UIProcess until all local storage transactions have been committed

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Jun 18 17:11:40 PDT 2014


https://bugs.webkit.org/show_bug.cgi?id=134042


Anders Carlsson <andersca at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #233330|review?                     |review-
               Flag|                            |




--- Comment #3 from Anders Carlsson <andersca at apple.com>  2014-06-18 17:12:02 PST ---
(From update of attachment 233330)
View in context: https://bugs.webkit.org/attachment.cgi?id=233330&action=review

> Source/WebKit2/UIProcess/WebContext.cpp:723
> +void WebContext::closeConnectionsInResponseToQuit()

I think calling this applicationWillTerminate is better.

> Source/WebKit2/UIProcess/Storage/StorageManager.cpp:611
> +void StorageManager::closeConnectionsInResponseToQuit()
> +{
> +    Vector<std::pair<RefPtr<IPC::Connection>, uint64_t>> connectionAndStorageMapIDPairsToRemove;
> +    HashMap<std::pair<RefPtr<IPC::Connection>, uint64_t>, RefPtr<StorageArea>> storageAreasByConnection = m_storageAreasByConnection;
> +    for (HashMap<std::pair<RefPtr<IPC::Connection>, uint64_t>, RefPtr<StorageArea>>::const_iterator it = storageAreasByConnection.begin(), end = storageAreasByConnection.end(); it != end; ++it) {
> +        it->value->removeListener(it->key.first.get(), it->key.second);
> +        connectionAndStorageMapIDPairsToRemove.append(it->key);
> +    }
> +
> +    for (size_t i = 0; i < connectionAndStorageMapIDPairsToRemove.size(); ++i)
> +        m_storageAreasByConnection.remove(connectionAndStorageMapIDPairsToRemove[i]);
> +
> +    m_closeMutex.unlock();
> +}

How is this ensuring that everything is written to disk?

> Source/WebKit2/UIProcess/Storage/StorageManager.h:115
> +    std::mutex m_closeMutex;

A mutex is the wrong synchronization primitive here. You should use a BinarySemaphore instead. For example, StorageManager::applicationWillTerminate() could do something like:

void StorageManager::applicationWillTerminate()
{
    BinarySemaphore semaphore;
    m_queue->dispatch([this, &semaphore]) {
        // Do cleanup work.
        semaphore.signal();
    });

    semaphore.wait();

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list