Bug 75986 - DispatchOnConnectionQueue messages should have a Connection parameter
Summary: DispatchOnConnectionQueue messages should have a Connection parameter
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Anders Carlsson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-10 12:50 PST by Anders Carlsson
Modified: 2012-01-10 13:14 PST (History)
0 users

See Also:


Attachments
Patch (10.62 KB, patch)
2012-01-10 12:53 PST, 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 2012-01-10 12:50:58 PST
DispatchOnConnectionQueue messages should have a Connection parameter
Comment 1 Anders Carlsson 2012-01-10 12:53:46 PST
Created attachment 121895 [details]
Patch
Comment 2 Adam Roben (:aroben) 2012-01-10 13:01:00 PST
Comment on attachment 121895 [details]
Patch

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

> Source/WebKit2/Platform/CoreIPC/HandleMessage.h:211
> +// Dispatch functions with connection parameter.
> +template<typename C, typename MF, typename P1, typename P2>
> +void callMemberFunction(Connection* connection, const Arguments2<P1, P2>& args, C* object, MF function)
> +{
> +    (object->*function)(connection, args.argument1, args.argument2);
> +}
> +
> +// Dispatch functions with connection parameter.
> +template<typename C, typename MF, typename P1>
> +void callMemberFunction(Connection* connection, const Arguments1<P1>& args, C* object, MF function)
> +{
> +    (object->*function)(connection, args.argument1);
> +}

I was expecting these to be listed in the opposite order to match the rest of the file.

> Source/WebKit2/Scripts/webkit2/messages.py:317
>      dispatch_function = 'handleMessage'
>      if message_is_variadic(message):
>          dispatch_function += 'Variadic'

Maybe you should add after this:

if message.has_attribute(DISPATCH_ON_CONNECTION_QUEUE_ATTRIBUTE):
    dispatch_function += 'OnConnectionQueue'

> Source/WebKit2/Scripts/webkit2/messages.py:325
> +    if message.has_attribute(DISPATCH_ON_CONNECTION_QUEUE_ATTRIBUTE):
> +        result.append('        CoreIPC::%sOnConnectionQueue<Messages::%s::%s>(connection, arguments, this, &%s);\n' % (dispatch_function, receiver.name, message.name, handler_function(receiver, message)))
> +        result.append('        didHandleMessage = true;\n')
> +    else:
> +        result.append('        CoreIPC::%s<Messages::%s::%s>(arguments, this, &%s);\n' % (dispatch_function, receiver.name, message.name, handler_function(receiver, message)))

…and then this can become:

dispatch_function_args = ['arguments, 'this', '&%s' % handler_function(receiver, message)]
if message.has_attribute(DISPATCH_ON_CONNECTION_QUEUE_ATTRIBUTE):
    dispatch_function_args.insert(0, 'connection')
result.append('        CoreIPC::%s<Messages::%s::%s>(%s);\n' % (dispatch_function, receiver.name, message.name, ', '.join(dispatch_function_args))
if message.has_attribute(DISPATCH_ON_CONNECTION_QUEUE_ATTRIBUTE):
    result.append('        didHandleMessage = true;\n')

In the end, I'm not that sure if this is better. But it does reduce some duplication between the two cases.
Comment 3 Anders Carlsson 2012-01-10 13:14:31 PST
Committed r104623: <http://trac.webkit.org/changeset/104623>