Bug 46117 - Add a way to delay sending replies to sync requests
Summary: Add a way to delay sending replies to sync requests
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: Other OS X 10.5
: P2 Normal
Assignee: Anders Carlsson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-20 13:10 PDT by Anders Carlsson
Modified: 2010-09-20 16:27 PDT (History)
0 users

See Also:


Attachments
Patch (8.82 KB, patch)
2010-09-20 13:19 PDT, Anders Carlsson
aroben: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Anders Carlsson 2010-09-20 13:10:52 PDT
Add a way to delay sending replies to sync requests
Comment 1 Anders Carlsson 2010-09-20 13:19:12 PDT
Created attachment 68129 [details]
Patch
Comment 2 Adam Roben (:aroben) 2010-09-20 14:02:36 PDT
Comment on attachment 68129 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=68129&action=review

> WebKit2/Platform/CoreIPC/Connection.cpp:276
> -            OwnPtr<ArgumentEncoder> replyEncoder(new ArgumentEncoder(syncRequestID));
> +            ArgumentEncoder* replyEncoder = new ArgumentEncoder(syncRequestID);
>              
>              // Hand off both the decoder and encoder to the client..
> -            m_client->didReceiveSyncMessage(this, message.messageID(), arguments.get(), replyEncoder.get());
> +            SyncReplyMode syncReplyMode = m_client->didReceiveSyncMessage(this, message.messageID(), arguments.get(), replyEncoder);
>              
>              // FIXME: If the message was invalid, we should send back a SyncMessageError.
>              ASSERT(!arguments->isInvalid());
>  
> -            // Send the reply.
> -            sendMessage(MessageID(CoreIPCMessage::SyncMessageReply), replyEncoder.release());
> +            if (syncReplyMode == AutomaticReply) {
> +                // Send the reply.
> +                sendSyncReply(replyEncoder);
> +            } else {
> +                // The client will take ownership of the reply encoder and send it at some point in the future.
> +                // We won't do anything here.
> +            }

Another option is to continue to use OwnPtr, and then call leakPtr in the ManualReply case. Yet another option is to use a bare pointer, but wrap the call to new in adoptPtr/leakPtr.
Comment 3 Anders Carlsson 2010-09-20 16:27:32 PDT
Committed r67891: <http://trac.webkit.org/changeset/67891>