Changeset 81362 in webkit


Ignore:
Timestamp:
Mar 17, 2011 10:03:07 AM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2011-03-17 Oleg Romashin <oleg.romashin@nokia.com>

Reviewed by Anders Carlsson.

Teach WebKit2 messages.py generator to ifdef headers include
which are related to ifdef-ed methods/types
https://bugs.webkit.org/show_bug.cgi?id=55658

  • Scripts/webkit2/messages.py:
  • Scripts/webkit2/messages_unittest.py:
Location:
trunk/Source/WebKit2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r81309 r81362  
     12011-03-17  Oleg Romashin  <oleg.romashin@nokia.com>
     2
     3        Reviewed by Anders Carlsson.
     4
     5        Teach WebKit2 messages.py generator to ifdef headers include
     6        which are related to ifdef-ed methods/types
     7        https://bugs.webkit.org/show_bug.cgi?id=55658
     8
     9        * Scripts/webkit2/messages.py:
     10        * Scripts/webkit2/messages_unittest.py:
     11
    1122011-03-16  Joseph Pecoraro  <joepeck@webkit.org>
    213
  • trunk/Source/WebKit2/Scripts/webkit2/messages.py

    r81208 r81362  
    9090                    parameters = []
    9191
     92                for parameter in parameters:
     93                    parameter.condition = condition
     94
    9295                delayed = delayed_string == 'delayed'
    9396
     
    121124
    122125class Parameter(object):
    123     def __init__(self, type, name):
     126    def __init__(self, type, name, condition=None):
    124127        self.type = type
    125128        self.name = name
     129        self.condition = condition
    126130
    127131
     
    452456def generate_message_handler(file):
    453457    receiver = MessageReceiver.parse(file)
    454     headers = set([
    455         '"%s"' % messages_header_filename(receiver),
    456         '"HandleMessage.h"',
    457         '"ArgumentDecoder.h"',
    458     ])
    459 
     458    headers = {
     459        '"%s"' % messages_header_filename(receiver): None,
     460        '"HandleMessage.h"': None,
     461        '"ArgumentDecoder.h"': None,
     462    }
     463
     464    type_conditions = {}
    460465    for parameter in receiver.iterparameters():
    461466        type = parameter.type
     467        condition = parameter.condition
     468
     469        if type in type_conditions:
     470            if not type_conditions[type]:
     471                condition = type_conditions[type]
     472            else:
     473                if not condition:
     474                    type_conditions[type] = condition
     475        else:
     476            type_conditions[type] = condition
     477
    462478        argument_encoder_headers = argument_coder_headers_for_type(parameter.type)
    463479        if argument_encoder_headers:
    464             headers.update(argument_encoder_headers)
     480            for header in argument_encoder_headers:
     481                headers[header] = condition
    465482            continue
    466483
    467484        type_headers = headers_for_type(type)
    468         headers.update(type_headers)
     485        for header in type_headers:
     486            headers[header] = condition
    469487
    470488    for message in receiver.messages:
     
    474492                argument_encoder_headers = argument_coder_headers_for_type(type)
    475493                if argument_encoder_headers:
    476                     headers.update(argument_encoder_headers)
     494                    for header in argument_encoder_headers:
     495                        headers[header] = message.condition
    477496                    continue
    478497
    479498                type_headers = headers_for_type(type)
    480                 headers.update(type_headers)
     499                for header in type_headers:
     500                    headers[header] = message.condition
    481501
    482502    result = []
     
    490510
    491511    result.append('#include "%s.h"\n\n' % receiver.name)
    492     result += ['#include %s\n' % header for header in sorted(headers)]
     512    for headercondition in sorted(headers):
     513        if headers[headercondition]:
     514            result.append('#if %s\n' % headers[headercondition])
     515            result += ['#include %s\n' % headercondition]
     516            result.append('#endif\n')
     517        else:
     518            result += ['#include %s\n' % headercondition]
    493519    result.append('\n')
    494520
  • trunk/Source/WebKit2/Scripts/webkit2/messages_unittest.py

    r77000 r81362  
    6969    GetPluginProcessConnection(WTF::String pluginPath) -> (CoreIPC::Connection::Handle connectionHandle) delayed
    7070
     71#if PLATFORM(MAC)
    7172    DidCreateWebProcessConnection(CoreIPC::MachPort connectionIdentifier)
     73#endif
    7274
    7375#if PLATFORM(MAC)
     
    180182                ('CoreIPC::MachPort', 'connectionIdentifier'),
    181183            ),
    182             'condition': None,
     184            'condition': 'PLATFORM(MAC)',
    183185        },
    184186        {
     
    292294    GetPluginsID,
    293295    GetPluginProcessConnectionID,
     296#if PLATFORM(MAC)
    294297    DidCreateWebProcessConnectionID,
     298#endif
    295299#if PLATFORM(MAC)
    296300    InterpretKeyEventID,
     
    419423};
    420424
     425#if PLATFORM(MAC)
    421426struct DidCreateWebProcessConnection : CoreIPC::Arguments1<const CoreIPC::MachPort&> {
    422427    static const Kind messageID = DidCreateWebProcessConnectionID;
     
    427432    }
    428433};
     434#endif
    429435
    430436#if PLATFORM(MAC)
     
    487493#include "WebPage.h"
    488494
     495#if PLATFORM(MAC)
    489496#include "ArgumentCoders.h"
     497#endif
    490498#include "ArgumentDecoder.h"
    491499#include "Connection.h"
    492500#include "HandleMessage.h"
     501#if PLATFORM(MAC)
    493502#include "MachPort.h"
     503#endif
    494504#include "Plugin.h"
     505#if PLATFORM(MAC)
    495506#include "WebCoreArgumentCoders.h"
     507#endif
     508#if ENABLE(TOUCH_EVENTS)
    496509#include "WebEvent.h"
     510#endif
    497511#include "WebPageMessages.h"
    498512#include "WebPreferencesStore.h"
     
    526540        CoreIPC::handleMessage<Messages::WebPage::SendInts>(arguments, this, &WebPage::sendInts);
    527541        return;
     542#if PLATFORM(MAC)
    528543    case Messages::WebPage::DidCreateWebProcessConnectionID:
    529544        CoreIPC::handleMessage<Messages::WebPage::DidCreateWebProcessConnection>(arguments, this, &WebPage::didCreateWebProcessConnection);
    530545        return;
     546#endif
    531547    default:
    532548        break;
Note: See TracChangeset for help on using the changeset viewer.