[webkit-reviews] review denied: [Bug 134042] Don't kill the UIProcess until all local storage transactions have been committed : [Attachment 233330] patch

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


Anders Carlsson <andersca at apple.com> has denied Roger Fong
<roger_fong at apple.com>'s request for review:
Bug 134042: Don't kill the UIProcess until all local storage transactions have
been committed
https://bugs.webkit.org/show_bug.cgi?id=134042

Attachment 233330: patch
https://bugs.webkit.org/attachment.cgi?id=233330&action=review

------- Additional Comments from Anders Carlsson <andersca at apple.com>
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();


More information about the webkit-reviews mailing list