Changeset 143050 in webkit


Ignore:
Timestamp:
Feb 15, 2013 2:01:04 PM (11 years ago)
Author:
andersca@apple.com
Message:

Add a synchronous GetValues message to StorageManager
https://bugs.webkit.org/show_bug.cgi?id=109968

Reviewed by Sam Weinig.

  • Platform/CoreIPC/Connection.cpp:

(CoreIPC::Connection::dispatchWorkQueueMessageReceiverMessage):
Handle synchronous messages.

(CoreIPC::Connection::processIncomingMessage):
Check for work queue message receivers before doing any other processing.

  • UIProcess/Storage/StorageManager.cpp:

(WebKit::StorageManager::getValues):
Add empty stub.

  • UIProcess/Storage/StorageManager.h:
  • UIProcess/Storage/StorageManager.messages.in:

Add GetValues message.

  • WebProcess/Storage/StorageAreaProxy.cpp:

(WebKit::StorageAreaProxy::loadValuesIfNeeded):
Send the GetValues message.

Location:
trunk/Source/WebKit2
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r143038 r143050  
     12013-02-15  Anders Carlsson  <andersca@apple.com>
     2
     3        Add a synchronous GetValues message to StorageManager
     4        https://bugs.webkit.org/show_bug.cgi?id=109968
     5
     6        Reviewed by Sam Weinig.
     7
     8        * Platform/CoreIPC/Connection.cpp:
     9        (CoreIPC::Connection::dispatchWorkQueueMessageReceiverMessage):
     10        Handle synchronous messages.
     11
     12        (CoreIPC::Connection::processIncomingMessage):
     13        Check for work queue message receivers before doing any other processing.
     14
     15        * UIProcess/Storage/StorageManager.cpp:
     16        (WebKit::StorageManager::getValues):
     17        Add empty stub.
     18
     19        * UIProcess/Storage/StorageManager.h:
     20        * UIProcess/Storage/StorageManager.messages.in:
     21        Add GetValues message.
     22
     23        * WebProcess/Storage/StorageAreaProxy.cpp:
     24        (WebKit::StorageAreaProxy::loadValuesIfNeeded):
     25        Send the GetValues message.
     26
    1272013-02-15  Anders Carlsson  <andersca@apple.com>
    228
  • trunk/Source/WebKit2/Platform/CoreIPC/Connection.cpp

    r142792 r143050  
    286286    OwnPtr<MessageDecoder> decoder = adoptPtr(incomingMessageDecoder);
    287287
    288     // FIXME: Handle sync messages.
    289     ASSERT(!decoder->isSyncMessage());
    290 
    291     workQueueMessageReceiver->didReceiveMessage(this, *decoder);
     288    if (!decoder->isSyncMessage()) {
     289        workQueueMessageReceiver->didReceiveMessage(this, *decoder);
     290        return;
     291    }
     292
     293    uint64_t syncRequestID = 0;
     294    if (!decoder->decode(syncRequestID) || !syncRequestID) {
     295        // We received an invalid sync message.
     296        // FIXME: Handle this.
     297        decoder->markInvalid();
     298        return;
     299    }
     300
     301    OwnPtr<MessageEncoder> replyEncoder = MessageEncoder::create("IPC", "SyncMessageReply", syncRequestID);
     302
     303    // Hand off both the decoder and encoder to the work queue message receiver.
     304    workQueueMessageReceiver->didReceiveSyncMessage(this, *decoder, replyEncoder);
     305
     306    // FIXME: If the message was invalid, we should send back a SyncMessageError.
     307    ASSERT(!decoder->isInvalid());
     308
     309    if (replyEncoder)
     310        sendSyncReply(replyEncoder.release());
    292311}
    293312
     
    594613    }
    595614
     615    // Check if any work queue message receivers are interested in this message.
     616    HashMap<StringReference, std::pair<RefPtr<WorkQueue>, RefPtr<WorkQueueMessageReceiver> > >::const_iterator it = m_workQueueMessageReceivers.find(message->messageReceiverName());
     617    if (it != m_workQueueMessageReceivers.end()) {
     618        it->value.first->dispatch(bind(&Connection::dispatchWorkQueueMessageReceiverMessage, this, it->value.second, message.release().leakPtr()));
     619        return;
     620    }
     621
    596622    // Check if this is a sync message or if it's a message that should be dispatched even when waiting for
    597623    // a sync reply. If it is, and we're waiting for a sync reply this message needs to be dispatched.
     
    614640    }
    615641
    616     // Check if any work queue message receivers are interested in this message.
    617     HashMap<StringReference, std::pair<RefPtr<WorkQueue>, RefPtr<WorkQueueMessageReceiver> > >::const_iterator it = m_workQueueMessageReceivers.find(message->messageReceiverName());
    618     if (it != m_workQueueMessageReceivers.end()) {
    619         it->value.first->dispatch(bind(&Connection::dispatchWorkQueueMessageReceiverMessage, this, it->value.second, message.release().leakPtr()));
    620         return;
    621     }
    622 
    623642    enqueueIncomingMessage(message.release());
    624643}
  • trunk/Source/WebKit2/UIProcess/Storage/StorageManager.cpp

    r142781 r143050  
    6767}
    6868
     69void StorageManager::getValues(uint64_t, HashMap<String, String>&)
     70{
     71    // FIXME: Implement this.
     72}
     73
    6974} // namespace WebKit
  • trunk/Source/WebKit2/UIProcess/Storage/StorageManager.h

    r142781 r143050  
    3030#include <wtf/PassRefPtr.h>
    3131#include <wtf/ThreadSafeRefCounted.h>
     32#include <wtf/text/StringHash.h>
    3233
    3334class WorkQueue;
     
    5152    // CoreIPC::Connection::WorkQueueMessageReceiver.
    5253    virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageDecoder&) OVERRIDE;
     54    virtual void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageDecoder&, OwnPtr<CoreIPC::MessageEncoder>& replyEncoder) OVERRIDE;
    5355
    5456    // Message handlers.
    5557    void createStorageArea(uint64_t storageAreaID, uint64_t storageNamespaceID, const SecurityOriginData&);
    5658    void destroyStorageArea(uint64_t storageAreaID);
     59    void getValues(uint64_t storageAreaID, HashMap<String, String>& values);
    5760
    5861    RefPtr<WorkQueue> m_queue;
  • trunk/Source/WebKit2/UIProcess/Storage/StorageManager.messages.in

    r142781 r143050  
    2424    CreateStorageArea(uint64_t storageAreaID, uint64_t storageNamespaceID, WebKit::SecurityOriginData securityOriginData)
    2525    DestroyStorageArea(uint64_t storageAreaID)
     26
     27    GetValues(uint64_t storageAreaID) -> (WTF::HashMap<WTF::String, WTF::String> values)
    2628}
  • trunk/Source/WebKit2/WebProcess/Storage/StorageAreaProxy.cpp

    r143038 r143050  
    7575
    7676    loadValuesIfNeeded();
    77 
    7877    return m_values->size();
    7978}
     
    161160        return;
    162161
    163     // FIXME: Actually load the values.
    164     m_values = adoptPtr(new HashMap<String, String>());
     162    HashMap<String, String> values;
     163    // FIXME: This should use a special sendSync flag to indicate that we don't want to process incoming messages while waiting for a reply.
     164    // (This flag does not yet exist).
     165    WebProcess::shared().connection()->sendSync(Messages::StorageManager::GetValues(m_storageAreaID), Messages::StorageManager::GetValues::Reply(values), 0);
     166
     167    // FIXME: Don't copy the hash map.
     168    m_values = adoptPtr(new HashMap<String, String>(values));
    165169}
    166170
Note: See TracChangeset for help on using the changeset viewer.