Changeset 104623 in webkit


Ignore:
Timestamp:
Jan 10, 2012, 1:14:16 PM (14 years ago)
Author:
andersca@apple.com
Message:

DispatchOnConnectionQueue messages should have a Connection parameter
https://bugs.webkit.org/show_bug.cgi?id=75986

Reviewed by Adam Roben.

Message handlers for messages with the DispatchOnConnectionQueue should have a CoreIPC::Connection
parameter, making it easier to send messages back over that connection.

  • Platform/CoreIPC/HandleMessage.h:

(CoreIPC::callMemberFunction):
(CoreIPC::handleMessageOnConnectionQueue):

  • Scripts/webkit2/messages.py:

(async_case_statement):
(generate_message_handler):

  • Scripts/webkit2/messages_unittest.py:
  • WebProcess/WebPage/EventDispatcher.cpp:

(WebKit::EventDispatcher::wheelEvent):
(WebKit::EventDispatcher::gestureEvent):

  • WebProcess/WebPage/EventDispatcher.h:
  • WebProcess/WebProcess.cpp:

(WebKit::WebProcess::pluginProcessCrashed):

  • WebProcess/WebProcess.h:
Location:
trunk/Source/WebKit2
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r104622 r104623  
     12012-01-10  Anders Carlsson  <andersca@apple.com>
     2
     3        DispatchOnConnectionQueue messages should have a Connection parameter
     4        https://bugs.webkit.org/show_bug.cgi?id=75986
     5
     6        Reviewed by Adam Roben.
     7
     8        Message handlers for messages with the DispatchOnConnectionQueue should have a CoreIPC::Connection
     9        parameter, making it easier to send messages back over that connection.
     10
     11        * Platform/CoreIPC/HandleMessage.h:
     12        (CoreIPC::callMemberFunction):
     13        (CoreIPC::handleMessageOnConnectionQueue):
     14        * Scripts/webkit2/messages.py:
     15        (async_case_statement):
     16        (generate_message_handler):
     17        * Scripts/webkit2/messages_unittest.py:
     18        * WebProcess/WebPage/EventDispatcher.cpp:
     19        (WebKit::EventDispatcher::wheelEvent):
     20        (WebKit::EventDispatcher::gestureEvent):
     21        * WebProcess/WebPage/EventDispatcher.h:
     22        * WebProcess/WebProcess.cpp:
     23        (WebKit::WebProcess::pluginProcessCrashed):
     24        * WebProcess/WebProcess.h:
     25
    1262012-01-10  Chris Marrin  <cmarrin@apple.com>
    227
  • trunk/Source/WebKit2/Platform/CoreIPC/HandleMessage.h

    r95901 r104623  
    197197}
    198198
     199// Dispatch functions with connection parameter.
     200template<typename C, typename MF, typename P1>
     201void callMemberFunction(Connection* connection, const Arguments1<P1>& args, C* object, MF function)
     202{
     203    (object->*function)(connection, args.argument1);
     204}
     205
     206template<typename C, typename MF, typename P1, typename P2>
     207void callMemberFunction(Connection* connection, const Arguments2<P1, P2>& args, C* object, MF function)
     208{
     209    (object->*function)(connection, args.argument1, args.argument2);
     210}
     211
    199212// Variadic dispatch functions.
    200213
     
    291304
    292305template<typename T, typename C, typename MF>
     306void handleMessageOnConnectionQueue(Connection* connection, ArgumentDecoder* argumentDecoder, C* object, MF function)
     307{
     308    typename T::DecodeType::ValueType arguments;
     309    if (!argumentDecoder->decode(arguments))
     310        return;
     311    callMemberFunction(connection, arguments, object, function);
     312}
     313
     314template<typename T, typename C, typename MF>
    293315void handleMessageVariadic(ArgumentDecoder* argumentDecoder, C* object, MF function)
    294316{
  • trunk/Source/WebKit2/Scripts/webkit2/messages.py

    r102615 r104623  
    312312
    313313
    314 def async_case_statement(receiver, message, statement_before_return=None):
     314def async_case_statement(receiver, message):
     315    dispatch_function_args = ['arguments', 'this', '&%s' % handler_function(receiver, message)]
    315316    dispatch_function = 'handleMessage'
    316317    if message_is_variadic(message):
    317318        dispatch_function += 'Variadic'
    318 
     319    if message.has_attribute(DISPATCH_ON_CONNECTION_QUEUE_ATTRIBUTE):
     320        dispatch_function += 'OnConnectionQueue'
     321        dispatch_function_args.insert(0, 'connection')
     322       
    319323    result = []
    320324    result.append('    case Messages::%s::%s:\n' % (receiver.name, message.id()))
    321     result.append('        CoreIPC::%s<Messages::%s::%s>(arguments, this, &%s);\n' % (dispatch_function, receiver.name, message.name, handler_function(receiver, message)))
    322     if statement_before_return:
    323         result.append('        %s\n' % statement_before_return)
     325
     326    result.append('        CoreIPC::%s<Messages::%s::%s>(%s);\n' % (dispatch_function, receiver.name, message.name, ', '.join(dispatch_function_args)))
     327    if message.has_attribute(DISPATCH_ON_CONNECTION_QUEUE_ATTRIBUTE):
     328        result.append('        didHandleMessage = true;\n')
    324329    result.append('        return;\n')
    325330    return surround_in_condition(''.join(result), message.condition)
     
    534539
    535540    if async_dispatch_on_connection_queue_messages:
    536         result.append('void %s::didReceive%sMessageOnConnectionWorkQueue(CoreIPC::Connection*, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, bool& didHandleMessage)\n' % (receiver.name, receiver.name))
     541        result.append('void %s::didReceive%sMessageOnConnectionWorkQueue(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, bool& didHandleMessage)\n' % (receiver.name, receiver.name))
    537542        result.append('{\n')
    538543        result.append('#if COMPILER(MSVC)\n')
     
    541546        result.append('#endif\n')
    542547        result.append('    switch (messageID.get<Messages::%s::Kind>()) {\n' % receiver.name)
    543         result += [async_case_statement(receiver, message, 'didHandleMessage = true;') for message in async_dispatch_on_connection_queue_messages]
     548        result += [async_case_statement(receiver, message) for message in async_dispatch_on_connection_queue_messages]
    544549        result.append('    default:\n')
    545550        result.append('        return;\n')
  • trunk/Source/WebKit2/Scripts/webkit2/messages_unittest.py

    r102615 r104623  
    686686namespace WebKit {
    687687
    688 void WebPage::didReceiveWebPageMessageOnConnectionWorkQueue(CoreIPC::Connection*, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, bool& didHandleMessage)
     688void WebPage::didReceiveWebPageMessageOnConnectionWorkQueue(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, bool& didHandleMessage)
    689689{
    690690#if COMPILER(MSVC)
     
    694694    switch (messageID.get<Messages::WebPage::Kind>()) {
    695695    case Messages::WebPage::TestConnectionQueueID:
    696         CoreIPC::handleMessage<Messages::WebPage::TestConnectionQueue>(arguments, this, &WebPage::testConnectionQueue);
     696        CoreIPC::handleMessageOnConnectionQueue<Messages::WebPage::TestConnectionQueue>(connection, arguments, this, &WebPage::testConnectionQueue);
    697697        didHandleMessage = true;
    698698        return;
  • trunk/Source/WebKit2/WebProcess/WebPage/EventDispatcher.cpp

    r103277 r104623  
    7979}
    8080
    81 void EventDispatcher::wheelEvent(uint64_t pageID, const WebWheelEvent& wheelEvent)
     81void EventDispatcher::wheelEvent(CoreIPC::Connection*, uint64_t pageID, const WebWheelEvent& wheelEvent)
    8282{
    8383#if ENABLE(THREADED_SCROLLING)
     
    9797
    9898#if ENABLE(GESTURE_EVENTS)
    99 void EventDispatcher::gestureEvent(uint64_t pageID, const WebGestureEvent& gestureEvent)
     99void EventDispatcher::gestureEvent(CoreIPC::Connection*, uint64_t pageID, const WebGestureEvent& gestureEvent)
    100100{
    101101#if ENABLE(THREADED_SCROLLING)
  • trunk/Source/WebKit2/WebProcess/WebPage/EventDispatcher.h

    r103277 r104623  
    6767
    6868    // Message handlers
    69     void wheelEvent(uint64_t pageID, const WebWheelEvent&);
     69    void wheelEvent(CoreIPC::Connection*, uint64_t pageID, const WebWheelEvent&);
    7070#if ENABLE(GESTURE_EVENTS)
    71     void gestureEvent(uint64_t pageID, const WebGestureEvent&);
     71    void gestureEvent(CoreIPC::Connection*, uint64_t pageID, const WebGestureEvent&);
    7272#endif
    7373
  • trunk/Source/WebKit2/WebProcess/WebProcess.cpp

    r103686 r104623  
    950950
    951951#if ENABLE(PLUGIN_PROCESS)
    952 void WebProcess::pluginProcessCrashed(const String& pluginPath)
     952void WebProcess::pluginProcessCrashed(CoreIPC::Connection*, const String& pluginPath)
    953953{
    954954    m_pluginProcessConnectionManager.pluginProcessCrashed(pluginPath);
  • trunk/Source/WebKit2/WebProcess/WebProcess.h

    r103179 r104623  
    183183   
    184184#if ENABLE(PLUGIN_PROCESS)
    185     void pluginProcessCrashed(const String& pluginPath);
     185    void pluginProcessCrashed(CoreIPC::Connection*, const String& pluginPath);
    186186#endif
    187187
Note: See TracChangeset for help on using the changeset viewer.