[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

aroben at apple.com aroben at apple.com
Wed Dec 22 13:39:52 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 24124b8450c6bb32edf0032f03755f356bc0b2d7
Author: aroben at apple.com <aroben at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Sep 22 20:43:49 2010 +0000

    Autogenerate WebPage's message-receiving code and message types
    
    This patch encompasses several changes that allow message types and
    receiving code to be generated by a script, and add some type-safety
    as a bonus. Messages are now represented by structs instead of an ID +
    ArgumentCoder. The struct contains the arguments and the ID together,
    and has a constructor that enforces the use of correct types.
    Correspondingly, a new overload of WebProcessProxy::send that takes a
    message struct (instead of a message ID and separate arguments) has
    been added. Eventually all callers should use this overload and the
    old one can be removed.
    
    This patch only touches WebPage's messages. We should transition other
    message receivers over to this new system eventually.
    
    Fixes <http://webkit.org/b/43636> <rdar://problem/8282462> Add a
    type-safe IPC mechanism to WebKit2
    
    Reviewed by Anders Carlsson.
    
    * DerivedSources.make: Added. Calls generate-message-receiver.py and
    generate-messages-header.py for each message receiver it knows about
    (just WebPage for now).
    
    * Platform/CoreIPC/Arguments.h: Added First/Second/ThirdArgumentType
    typedefs for use in handleMessage.
    
    * Platform/CoreIPC/HandleMessage.h: Added.
    (CoreIPC::handleMessage): This overloaded function template decodes
    arguments and passes them along to the specified function.
    
    * Scripts/generate-message-receiver.py: Added.
    * Scripts/generate-messages-header.py: Added.
    These scripts just wrap functionality in messages.py.
    
    * Scripts/webkit2/__init__.py: Added. This just exists so that Python
    will treat this directory as a package.
    
    * Scripts/webkit2/messages.py: Added. Contains the code to parse
    messages files and generate .cpp/.h files from them.
    (MessageReceiver.__init__): This class represents a single receiver of
    messages.
    (MessageReceiver.iterparameters): Returns a generator that can be used
    to iterate over all the parameters of all the messages of this
    receiver.
    (MessageReceiver.parse): Reads a messages file from a file-like object
    and parses it into a MessageReceiver object.
    (Message.__init__): This class represents a single message.
    (Message.id): Returns the ID name for this message.
    (Parameter.__init__): This class represents a single parameter for a
    message.
    (messages_header_filename): Returns the name of the header that
    defines the messages for a given receiver.
    (surround_in_condition): Surrounds the given string in #if/#endif if
    there is an associated condition.
    (messages_to_kind_enum): Returns a string that defines the Kind enum
    for these messages.
    (function_parameter_type): Returns the type that should be used when
    passing a value of the given type as a parameter to a function.
    (base_class): Returns the base class for a message struct.
    (message_to_struct_declaration): Returns a string that declares the
    struct for this message.
    (forward_declarations_for_namespace): Returns a string that contains
    forward-declarations for a set of types in a given namespace.
    (forward_declarations): Returns a string that contains all the
    forward-declarations needed in order to declare all the message
    structs for this receiver.
    (generate_header_file): Returns a string containing the messages
    header file for this receiver.
    (handler_function): Returns the name of the function that handles a
    given message for a given receiver.
    (case_statement): Returns a string containing a case statement for
    handling the given message.
    (header_for_type): Returns the header needed to define a given type,
    enclosed in quotes or angle brackets as needed.
    (generate_message_handler): Returns a string containing the contents
    of a .cpp file that defines a didReceive*Message function.
    
    * Scripts/webkit2/messages_unittest.py: Added. Contains tests for
    messages.py.
    
    * Shared/CoreIPCSupport/WebPageMessageKinds.h: Removed. This has been
    replaced by a generated WebPageMessages.h header.
    
    * UIProcess/WebEditCommandProxy.cpp:
    * UIProcess/WebPageProxy.cpp:
    Updated to use the new message structs and WebProcessProxy::send
    overload.
    
    * UIProcess/WebProcessProxy.h:
    (WebKit::WebProcessProxy::send): Added this new overload that takes a
    message struct.
    
    * WebKit2.xcodeproj/project.pbxproj: Added a Derived Sources shell
    script target that invokes DerivedSources.make. Added "Derived
    Sources" and "Scripts" groups that contain the various new files.
    
    * WebProcess/WebPage/WebPage.cpp:
    (WebKit::WebPage::didReceivePolicyDecision):
    (WebKit::WebPage::getSourceForFrame):
    Changed these functions to take the raw IPC types and do the necessary
    translation themselves. This keeps the generated code from need to
    know how to perform the translation.
    
    (WebKit::WebPage::didReceiveMessage): Replaced handling of WebPage
    messages with a call to didReceiveWebPageMessage, whose implementation
    is generated by the scripts.
    
    * WebProcess/WebPage/WebPage.h: Added didReceiveWebPageMessage.
    
    * WebProcess/WebPage/WebPage.messages.in: Added. This file declares
    all of the messages that WebPage receives, roughly grouped by
    functionality.
    
    * win/WebKit2.vcproj: Added "Derived Sources" and "Scripts" filters
    that contain the various new files. Let VS resort some other files.
    
    * win/WebKit2Common.vsprops: Added
    $(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources to the include
    path so that the generated messages header can be found.
    
    * win/WebKit2.make: Copy the generated source files to $(DSTROOT).
    
    * win/WebKit2Generated.make: Added a call to build-generated-files.sh.
    
    * win/WebKit2Generated.vcproj: Added build-generated-files.sh.
    
    * win/build-generated-files.sh: Added. Invokes DerivedSources.make.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@68079 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 5fa0d1d..87d8348 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,134 @@
+2010-09-22  Adam Roben  <aroben at apple.com>
+
+        Autogenerate WebPage's message-receiving code and message types
+
+        This patch encompasses several changes that allow message types and
+        receiving code to be generated by a script, and add some type-safety
+        as a bonus. Messages are now represented by structs instead of an ID +
+        ArgumentCoder. The struct contains the arguments and the ID together,
+        and has a constructor that enforces the use of correct types.
+        Correspondingly, a new overload of WebProcessProxy::send that takes a
+        message struct (instead of a message ID and separate arguments) has
+        been added. Eventually all callers should use this overload and the
+        old one can be removed.
+
+        This patch only touches WebPage's messages. We should transition other
+        message receivers over to this new system eventually.
+
+        Fixes <http://webkit.org/b/43636> <rdar://problem/8282462> Add a
+        type-safe IPC mechanism to WebKit2
+
+        Reviewed by Anders Carlsson.
+
+        * DerivedSources.make: Added. Calls generate-message-receiver.py and
+        generate-messages-header.py for each message receiver it knows about
+        (just WebPage for now).
+
+        * Platform/CoreIPC/Arguments.h: Added First/Second/ThirdArgumentType
+        typedefs for use in handleMessage.
+
+        * Platform/CoreIPC/HandleMessage.h: Added.
+        (CoreIPC::handleMessage): This overloaded function template decodes
+        arguments and passes them along to the specified function.
+
+        * Scripts/generate-message-receiver.py: Added.
+        * Scripts/generate-messages-header.py: Added.
+        These scripts just wrap functionality in messages.py.
+
+        * Scripts/webkit2/__init__.py: Added. This just exists so that Python
+        will treat this directory as a package.
+
+        * Scripts/webkit2/messages.py: Added. Contains the code to parse
+        messages files and generate .cpp/.h files from them.
+        (MessageReceiver.__init__): This class represents a single receiver of
+        messages.
+        (MessageReceiver.iterparameters): Returns a generator that can be used
+        to iterate over all the parameters of all the messages of this
+        receiver.
+        (MessageReceiver.parse): Reads a messages file from a file-like object
+        and parses it into a MessageReceiver object.
+        (Message.__init__): This class represents a single message.
+        (Message.id): Returns the ID name for this message.
+        (Parameter.__init__): This class represents a single parameter for a
+        message.
+        (messages_header_filename): Returns the name of the header that
+        defines the messages for a given receiver.
+        (surround_in_condition): Surrounds the given string in #if/#endif if
+        there is an associated condition.
+        (messages_to_kind_enum): Returns a string that defines the Kind enum
+        for these messages.
+        (function_parameter_type): Returns the type that should be used when
+        passing a value of the given type as a parameter to a function.
+        (base_class): Returns the base class for a message struct.
+        (message_to_struct_declaration): Returns a string that declares the
+        struct for this message.
+        (forward_declarations_for_namespace): Returns a string that contains
+        forward-declarations for a set of types in a given namespace.
+        (forward_declarations): Returns a string that contains all the
+        forward-declarations needed in order to declare all the message
+        structs for this receiver.
+        (generate_header_file): Returns a string containing the messages
+        header file for this receiver.
+        (handler_function): Returns the name of the function that handles a
+        given message for a given receiver.
+        (case_statement): Returns a string containing a case statement for
+        handling the given message.
+        (header_for_type): Returns the header needed to define a given type,
+        enclosed in quotes or angle brackets as needed.
+        (generate_message_handler): Returns a string containing the contents
+        of a .cpp file that defines a didReceive*Message function.
+
+        * Scripts/webkit2/messages_unittest.py: Added. Contains tests for
+        messages.py.
+
+        * Shared/CoreIPCSupport/WebPageMessageKinds.h: Removed. This has been
+        replaced by a generated WebPageMessages.h header.
+
+        * UIProcess/WebEditCommandProxy.cpp:
+        * UIProcess/WebPageProxy.cpp:
+        Updated to use the new message structs and WebProcessProxy::send
+        overload.
+
+        * UIProcess/WebProcessProxy.h:
+        (WebKit::WebProcessProxy::send): Added this new overload that takes a
+        message struct.
+
+        * WebKit2.xcodeproj/project.pbxproj: Added a Derived Sources shell
+        script target that invokes DerivedSources.make. Added "Derived
+        Sources" and "Scripts" groups that contain the various new files.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::didReceivePolicyDecision):
+        (WebKit::WebPage::getSourceForFrame):
+        Changed these functions to take the raw IPC types and do the necessary
+        translation themselves. This keeps the generated code from need to
+        know how to perform the translation.
+
+        (WebKit::WebPage::didReceiveMessage): Replaced handling of WebPage
+        messages with a call to didReceiveWebPageMessage, whose implementation
+        is generated by the scripts.
+
+        * WebProcess/WebPage/WebPage.h: Added didReceiveWebPageMessage.
+
+        * WebProcess/WebPage/WebPage.messages.in: Added. This file declares
+        all of the messages that WebPage receives, roughly grouped by
+        functionality.
+
+        * win/WebKit2.vcproj: Added "Derived Sources" and "Scripts" filters
+        that contain the various new files. Let VS resort some other files.
+
+        * win/WebKit2Common.vsprops: Added
+        $(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources to the include
+        path so that the generated messages header can be found.
+
+        * win/WebKit2.make: Copy the generated source files to $(DSTROOT).
+
+        * win/WebKit2Generated.make: Added a call to build-generated-files.sh.
+
+        * win/WebKit2Generated.vcproj: Added build-generated-files.sh.
+
+        * win/build-generated-files.sh: Added. Invokes DerivedSources.make.
+
 2010-09-22  Anders Carlsson  <andersca at apple.com>
 
         Reviewed by Darin Adler.
diff --git a/WebKit2/DerivedSources.make b/WebKit2/DerivedSources.make
new file mode 100644
index 0000000..87ff134
--- /dev/null
+++ b/WebKit2/DerivedSources.make
@@ -0,0 +1,29 @@
+VPATH = \
+    $(WebKit2)/WebProcess/WebPage \
+#
+
+MESSAGE_RECEIVERS = \
+    WebPage \
+#
+
+SCRIPTS = \
+    $(WebKit2)/Scripts/generate-message-receiver.py \
+    $(WebKit2)/Scripts/generate-messages-header.py \
+    $(WebKit2)/Scripts/webkit2/__init__.py \
+    $(WebKit2)/Scripts/webkit2/messages.py \
+#
+
+.PHONY : all
+
+all : \
+    $(MESSAGE_RECEIVERS:%=%MessageReceiver.cpp) \
+    $(MESSAGE_RECEIVERS:%=%Messages.h) \
+#
+
+%MessageReceiver.cpp : %.messages.in $(SCRIPTS)
+	@echo Generating messages header for $*...
+	@python $(WebKit2)/Scripts/generate-message-receiver.py $< > $@
+
+%Messages.h : %.messages.in $(SCRIPTS)
+	@echo Generating message receiver for $*...
+	@python $(WebKit2)/Scripts/generate-messages-header.py $< > $@
diff --git a/WebKit2/Platform/CoreIPC/Arguments.h b/WebKit2/Platform/CoreIPC/Arguments.h
index 675a75e..e469598 100644
--- a/WebKit2/Platform/CoreIPC/Arguments.h
+++ b/WebKit2/Platform/CoreIPC/Arguments.h
@@ -55,6 +55,8 @@ inline Arguments0 Out()
 
 template<typename T1> class Arguments1 {
 public:
+    typedef T1 FirstArgumentType;
+
     Arguments1(T1 t1) 
         : m_value(t1)
     {
@@ -86,6 +88,9 @@ template<typename T1> Arguments1<T1&> Out(T1& t1)
 
 template<typename T1, typename T2> class Arguments2 : Arguments1<T1> {
 public:
+    typedef T1 FirstArgumentType;
+    typedef T2 SecondArgumentType;
+
     Arguments2(T1 t1, T2 t2) 
         : Arguments1<T1>(t1)
         , m_value(t2)
@@ -122,6 +127,10 @@ template<typename T1, typename T2> Arguments2<T1&, T2&> Out(T1& t1, T2& t2)
 
 template<typename T1, typename T2, typename T3> class Arguments3 : Arguments2<T1, T2> {
 public:
+    typedef T1 FirstArgumentType;
+    typedef T2 SecondArgumentType;
+    typedef T3 ThirdArgumentType;
+
     Arguments3(T1 t1, T2 t2, T3 t3) 
         : Arguments2<T1, T2>(t1, t2)
         , m_value(t3)
diff --git a/WebKit2/Platform/CoreIPC/HandleMessage.h b/WebKit2/Platform/CoreIPC/HandleMessage.h
new file mode 100644
index 0000000..7127ad7
--- /dev/null
+++ b/WebKit2/Platform/CoreIPC/HandleMessage.h
@@ -0,0 +1,53 @@
+#ifndef HandleMessage_h
+#define HandleMessage_h
+
+namespace CoreIPC {
+
+template<typename T> struct RemoveReference { typedef T Type; };
+template<typename T> struct RemoveReference<T&> { typedef T Type; };
+
+template<typename T, typename C>
+void handleMessage(ArgumentDecoder* arguments, C* object, void (C::*function)())
+{
+    (object->*function)();
+}
+
+template<typename T, typename C, typename P>
+void handleMessage(ArgumentDecoder* arguments, C* object, void (C::*function)(P))
+{
+    typename RemoveReference<typename T::FirstArgumentType>::Type argument;
+    if (!arguments->decode(argument))
+        return;
+    (object->*function)(argument);
+}
+
+template<typename T, typename C, typename P1, typename P2>
+void handleMessage(ArgumentDecoder* arguments, C* object, void (C::*function)(P1, P2))
+{
+    typename RemoveReference<typename T::FirstArgumentType>::Type firstArgument;
+    if (!arguments->decode(firstArgument))
+        return;
+    typename RemoveReference<typename T::SecondArgumentType>::Type secondArgument;
+    if (!arguments->decode(secondArgument))
+        return;
+    (object->*function)(firstArgument, secondArgument);
+}
+
+template<typename T, typename C, typename P1, typename P2, typename P3>
+void handleMessage(ArgumentDecoder* arguments, C* object, void (C::*function)(P1, P2, P3))
+{
+    typename RemoveReference<typename T::FirstArgumentType>::Type firstArgument;
+    if (!arguments->decode(firstArgument))
+        return;
+    typename RemoveReference<typename T::SecondArgumentType>::Type secondArgument;
+    if (!arguments->decode(secondArgument))
+        return;
+    typename RemoveReference<typename T::ThirdArgumentType>::Type thirdArgument;
+    if (!arguments->decode(thirdArgument))
+        return;
+    (object->*function)(firstArgument, secondArgument, thirdArgument);
+}
+
+} // namespace CoreIPC
+
+#endif // HandleMessage_h
diff --git a/WebKit2/Scripts/generate-message-receiver.py b/WebKit2/Scripts/generate-message-receiver.py
new file mode 100644
index 0000000..7a6f1c9
--- /dev/null
+++ b/WebKit2/Scripts/generate-message-receiver.py
@@ -0,0 +1,40 @@
+#!/usr/bin/env python
+#
+# Copyright (C) 2010 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1.  Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+# 2.  Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in the
+#     documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+from __future__ import with_statement
+import sys
+
+import webkit2.messages
+
+
+def main(argv=None):
+    if not argv:
+        argv = sys.argv
+    input_path = argv[1]
+    with open(input_path) as input_file:
+        print webkit2.messages.generate_message_handler(input_file),
+    return 0
+
+if __name__ == '__main__':
+    sys.exit(main(sys.argv))
diff --git a/WebKit2/Scripts/generate-messages-header.py b/WebKit2/Scripts/generate-messages-header.py
new file mode 100644
index 0000000..fd888b3
--- /dev/null
+++ b/WebKit2/Scripts/generate-messages-header.py
@@ -0,0 +1,40 @@
+#!/usr/bin/env python
+#
+# Copyright (C) 2010 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1.  Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+# 2.  Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in the
+#     documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+from __future__ import with_statement
+import sys
+
+import webkit2.messages
+
+
+def main(argv=None):
+    if not argv:
+        argv = sys.argv
+    input_path = argv[1]
+    with open(input_path) as input_file:
+        print webkit2.messages.generate_messages_header(input_file),
+    return 0
+
+if __name__ == '__main__':
+    sys.exit(main(sys.argv))
diff --git a/WebKit2/Scripts/webkit2/__init__.py b/WebKit2/Scripts/webkit2/__init__.py
new file mode 100644
index 0000000..27e3fc3
--- /dev/null
+++ b/WebKit2/Scripts/webkit2/__init__.py
@@ -0,0 +1,23 @@
+# Copyright (C) 2010 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1.  Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+# 2.  Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in the
+#     documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# Required for Python to search this directory for module files
diff --git a/WebKit2/Scripts/webkit2/messages.py b/WebKit2/Scripts/webkit2/messages.py
new file mode 100644
index 0000000..df7392d
--- /dev/null
+++ b/WebKit2/Scripts/webkit2/messages.py
@@ -0,0 +1,274 @@
+# Copyright (C) 2010 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1.  Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+# 2.  Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in the
+#     documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import collections
+import re
+
+
+_license_header = """/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+"""
+
+class MessageReceiver(object):
+    def __init__(self, name, messages):
+        self.name = name
+        self.messages = messages
+
+    def iterparameters(self):
+        return (parameter for message in self.messages for parameter in message.parameters)
+
+    @classmethod
+    def parse(cls, file):
+        destination = None
+        messages = []
+        condition = None
+        for line in file:
+            match = re.search(r'messages -> ([A-Za-z_0-9]+) {', line)
+            if match:
+                destination = match.group(1)
+                continue
+            if line.startswith('#'):
+                if line.startswith('#if '):
+                    condition = line.rstrip()[4:]
+                elif line.startswith('#endif'):
+                    condition = None
+                continue
+            match = re.search(r'([A-Za-z_0-9]+)\((.*)\)', line)
+            if match:
+                name, parameters_string = match.groups()
+                if parameters_string:
+                    parameters = [Parameter(*type_and_name.split(' ')) for type_and_name in parameters_string.split(', ')]
+                else:
+                    parameters = []
+                messages.append(Message(name, parameters, condition))
+        return MessageReceiver(destination, messages)
+
+
+class Message(object):
+    def __init__(self, name, parameters, condition):
+        self.name = name
+        self.parameters = parameters
+        self.condition = condition
+
+    def id(self):
+        return '%sID' % self.name
+
+
+class Parameter(object):
+    def __init__(self, type, name):
+        self.type = type
+        self.name = name
+
+
+def messages_header_filename(receiver):
+    return '%sMessages.h' % receiver.name
+
+
+def surround_in_condition(string, condition):
+    if not condition:
+        return string
+    return '#if %s\n%s#endif\n' % (condition, string)
+
+
+def messages_to_kind_enum(messages):
+    result = []
+    result.append('enum Kind {\n')
+    result += [surround_in_condition('    %s,\n' % message.id(), message.condition) for message in messages]
+    result.append('};\n')
+    return ''.join(result)
+
+
+def function_parameter_type(type):
+    # We assume that we must use a reference for a type iff it contains a scope
+    # resolution operator (::).
+    if re.search(r'::', type):
+        return 'const %s&' % type
+    return type
+
+
+def base_class(message):
+    base_class = 'CoreIPC::Arguments%d' % len(message.parameters)
+    if len(message.parameters):
+        base_class = '%s<%s>' % (base_class, ', '.join(function_parameter_type(parameter.type) for parameter in message.parameters))
+    return base_class
+
+
+def message_to_struct_declaration(message):
+    result = []
+    function_parameters = [(function_parameter_type(x.type), x.name) for x in message.parameters]
+    result.append('struct %s : %s' % (message.name, base_class(message)))
+    result.append(' {\n')
+    result.append('    static const Kind messageID = %s;\n' % message.id())
+    if len(function_parameters):
+        result.append('    %s%s(%s)' % (len(function_parameters) == 1 and 'explicit ' or '', message.name, ', '.join([' '.join(x) for x in function_parameters])))
+        result.append('\n        : %s(%s)\n' % (base_class(message), ', '.join([x[1] for x in function_parameters])))
+        result.append('    {\n')
+        result.append('    }\n')
+    result.append('};\n')
+    return surround_in_condition(''.join(result), message.condition)
+
+
+def forward_declarations_for_namespace(namespace, types):
+    result = []
+    result.append('namespace %s {\n' % namespace)
+    result += ['    class %s;\n' % x for x in types]
+    result.append('}\n')
+    return ''.join(result)
+
+
+def forward_declarations(receiver):
+    types_by_namespace = collections.defaultdict(set)
+    for parameter in receiver.iterparameters():
+        type = parameter.type
+        split = type.split('::')
+        if len(split) != 2:
+            continue
+        namespace = split[0]
+        inner_type = split[1]
+        types_by_namespace[namespace].add(inner_type)
+    return '\n'.join([forward_declarations_for_namespace(namespace, types) for (namespace, types) in sorted(types_by_namespace.iteritems())])
+
+
+def generate_messages_header(file):
+    receiver = MessageReceiver.parse(file)
+    header_guard = messages_header_filename(receiver).replace('.', '_')
+
+    headers = set([
+        '"Arguments.h"',
+        '"MessageID.h"',
+    ])
+
+    result = []
+
+    result.append(_license_header)
+    result.append('\n')
+
+    result.append('#ifndef %s\n' % header_guard)
+    result.append('#define %s\n\n' % header_guard)
+
+    result += ['#include %s\n' % header for header in sorted(headers)]
+    result.append('\n')
+
+    result.append(forward_declarations(receiver))
+    result.append('\n')
+
+    result.append('namespace Messages {\n\nnamespace %s {\n\n' % receiver.name)
+    result.append(messages_to_kind_enum(receiver.messages))
+    result.append('\n')
+    result.append('\n'.join([message_to_struct_declaration(x) for x in receiver.messages]))
+    result.append('\n} // namespace %s\n\n} // namespace Messages\n' % receiver.name)
+
+    result.append('\nnamespace CoreIPC {\n\n')
+    result.append('template<> struct MessageKindTraits<Messages::%s::Kind> {\n' % receiver.name)
+    result.append('    static const MessageClass messageClass = MessageClass%s;\n' % receiver.name)
+    result.append('};\n')
+    result.append('\n} // namespace CoreIPC\n')
+
+    result.append('\n#endif // %s\n' % header_guard)
+    return ''.join(result)
+
+
+def handler_function(receiver, message):
+    return '%s::%s' % (receiver.name, message.name[0].lower() + message.name[1:])
+
+
+def case_statement(receiver, message):
+    result = []
+    result.append('    case Messages::%s::%s:\n' % (receiver.name, message.id()))
+    result.append('        CoreIPC::handleMessage<Messages::%s::%s>(arguments, this, &%s);\n' % (receiver.name, message.name, handler_function(receiver, message)))
+    result.append('        return;\n')
+    return surround_in_condition(''.join(result), message.condition)
+
+
+def header_for_type(type):
+    special_cases = {
+        'WTF::String': '<wtf/text/WTFString.h>',
+        'WebKit::WebKeyboardEvent': '"WebEvent.h"',
+        'WebKit::WebMouseEvent': '"WebEvent.h"',
+        'WebKit::WebWheelEvent': '"WebEvent.h"',
+        'WebKit::WebTouchEvent': '"WebEvent.h"',
+    }
+    if type in special_cases:
+        return special_cases[type]
+
+    # We assume that we must include a header for a type iff it has a scope
+    # resolution operator (::).
+    split = type.split('::')
+    if len(split) != 2:
+        return None
+    if split[0] == 'WebKit':
+        return '"%s.h"' % split[1]
+    return '<%s/%s.h>' % tuple(split)
+
+
+def generate_message_handler(file):
+    receiver = MessageReceiver.parse(file)
+    headers = set([
+        '"%s"' % messages_header_filename(receiver),
+        '"HandleMessage.h"',
+        '"ArgumentDecoder.h"',
+    ])
+    [headers.add(header) for header in [header_for_type(parameter.type) for parameter in receiver.iterparameters()] if header]
+
+    result = []
+
+    result.append(_license_header)
+    result.append('\n')
+
+    result.append('#include "%s.h"\n\n' % receiver.name)
+    result += ['#include %s\n' % header for header in sorted(headers)]
+    result.append('\n')
+
+    result.append('namespace WebKit {\n\n')
+
+    result.append('void %s::didReceive%sMessage(CoreIPC::Connection*, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments)\n' % (receiver.name, receiver.name))
+    result.append('{\n')
+    result.append('    switch (messageID.get<Messages::%s::Kind>()) {\n' % receiver.name)
+    result += [case_statement(receiver, message) for message in receiver.messages]
+    result.append('    }\n\n')
+    result.append('    ASSERT_NOT_REACHED();\n')
+    result.append('}\n')
+
+    result.append('\n} // namespace WebKit\n')
+
+    return ''.join(result)
diff --git a/WebKit2/Scripts/webkit2/messages_unittest.py b/WebKit2/Scripts/webkit2/messages_unittest.py
new file mode 100644
index 0000000..6884ba8
--- /dev/null
+++ b/WebKit2/Scripts/webkit2/messages_unittest.py
@@ -0,0 +1,141 @@
+# Copyright (C) 2010 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1.  Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+# 2.  Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in the
+#     documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import unittest
+from StringIO import StringIO
+
+import messages
+
+_messages_file_contents = """# Copyright (C) 2010 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1.  Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+# 2.  Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in the
+#     documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+messages -> WebPage {
+    LoadURL(WTF::String url)
+#if ENABLE(TOUCH_EVENTS)
+    TouchEvent(WebKit::WebTouchEvent event)
+#endif
+    DidReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, uint32_t policyAction)
+    Close()
+}
+"""
+
+_expected_results = {
+    'name': 'WebPage',
+    'messages': (
+        {
+            'name': 'LoadURL',
+            'parameters': (
+                ('WTF::String', 'url'),
+            ),
+            'condition': None,
+            'base_class': 'CoreIPC::Arguments1<const WTF::String&>',
+        },
+        {
+            'name': 'TouchEvent',
+            'parameters': (
+                ('WebKit::WebTouchEvent', 'event'),
+            ),
+            'condition': 'ENABLE(TOUCH_EVENTS)',
+            'base_class': 'CoreIPC::Arguments1<const WebKit::WebTouchEvent&>',
+        },
+        {
+            'name': 'DidReceivePolicyDecision',
+            'parameters': (
+                ('uint64_t', 'frameID'),
+                ('uint64_t', 'listenerID'),
+                ('uint32_t', 'policyAction'),
+            ),
+            'condition': None,
+            'base_class': 'CoreIPC::Arguments3<uint64_t, uint64_t, uint32_t>',
+        },
+        {
+            'name': 'Close',
+            'parameters': (),
+            'condition': None,
+            'base_class': 'CoreIPC::Arguments0',
+        },
+    ),
+}
+
+
+class MessagesTest(unittest.TestCase):
+    def setUp(self):
+        self.receiver = messages.MessageReceiver.parse(StringIO(_messages_file_contents))
+
+
+class ParsingTest(MessagesTest):
+    def check_message(self, message, expected_message):
+        self.assertEquals(message.name, expected_message['name'])
+        self.assertEquals(len(message.parameters), len(expected_message['parameters']))
+        for index, parameter in enumerate(message.parameters):
+            self.assertEquals(parameter.type, expected_message['parameters'][index][0])
+            self.assertEquals(parameter.name, expected_message['parameters'][index][1])
+        self.assertEquals(message.condition, expected_message['condition'])
+
+    def test_receiver(self):
+        """Receiver should be parsed as expected"""
+        self.assertEquals(self.receiver.name, _expected_results['name'])
+        self.assertEquals(len(self.receiver.messages), len(_expected_results['messages']))
+        for index, message in enumerate(self.receiver.messages):
+            self.check_message(message, _expected_results['messages'][index])
+
+
+class HeaderTest(MessagesTest):
+    def test_base_class(self):
+        """Base classes for message structs should match expectations"""
+        for index, message in enumerate(self.receiver.messages):
+            self.assertEquals(messages.base_class(message), _expected_results['messages'][index]['base_class'])
+
+class ReceiverImplementationTest(unittest.TestCase):
+    def setUp(self):
+        self.file_contents = messages.generate_message_handler(StringIO(_messages_file_contents))
+
+    def test_receiver_header_listed_first(self):
+        """Receiver's header file should be the first included header"""
+        self.assertEquals(self.file_contents.index('#include'), self.file_contents.index('#include "%s.h"' % _expected_results['name']))
+
+    def test_receiver_header_listed_separately(self):
+        """Receiver's header should be in its own paragraph"""
+        self.assertTrue(self.file_contents.find('\n\n#include "%s.h"\n\n' % _expected_results['name']))
+
+
+if __name__ == '__main__':
+    unittest.main()
diff --git a/WebKit2/Shared/CoreIPCSupport/WebPageMessageKinds.h b/WebKit2/Shared/CoreIPCSupport/WebPageMessageKinds.h
deleted file mode 100644
index a4a0d56..0000000
--- a/WebKit2/Shared/CoreIPCSupport/WebPageMessageKinds.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef WebPageMessageKinds_h
-#define WebPageMessageKinds_h
-
-// Messages sent from the UIProcess to the web process.
-
-#include "MessageID.h"
-
-namespace WebPageMessage {
-
-enum Kind {
-    Close,
-    DidReceivePolicyDecision,
-    DidRemoveEditCommand,
-    GetRenderTreeExternalRepresentation,
-    GetSourceForFrame,
-    GoBack,
-    GoForward,
-    GoToBackForwardItem,
-    KeyEvent,
-    LoadURL,
-    LoadURLRequest,
-    LoadHTMLString,
-    LoadPlainTextString,
-    MouseEvent,
-    PreferencesDidChange,
-    ReapplyEditCommand,
-    Reload,
-    RunJavaScriptInMainFrame,
-    SetActive,
-    SetCustomUserAgent,
-    SetFocused,
-    SetIsInWindow,
-#if PLATFORM(MAC)
-    SetWindowIsVisible,
-    SetWindowFrame,
-#endif
-    SetPageAndTextZoomFactors,
-    SetPageZoomFactor,
-    SetTextZoomFactor,
-    StopLoading,
-    TryClose,
-    SelectAll,
-    Copy,
-    Cut,
-    Paste,
-    UnapplyEditCommand,
-    WheelEvent
-#if ENABLE(TOUCH_EVENTS)
-    , TouchEvent
-#endif
-};
-
-}
-
-namespace CoreIPC {
-
-template<> struct MessageKindTraits<WebPageMessage::Kind> { 
-    static const MessageClass messageClass = MessageClassWebPage;
-};
-
-}
-
-#endif // WebPageMessageKinds_h
diff --git a/WebKit2/UIProcess/WebEditCommandProxy.cpp b/WebKit2/UIProcess/WebEditCommandProxy.cpp
index 6395685..70b7d19 100644
--- a/WebKit2/UIProcess/WebEditCommandProxy.cpp
+++ b/WebKit2/UIProcess/WebEditCommandProxy.cpp
@@ -25,7 +25,7 @@
 
 #include "WebEditCommandProxy.h"
 
-#include "WebPageMessageKinds.h"
+#include "WebPageMessages.h"
 #include "WebPageProxy.h"
 #include "WebProcessProxy.h"
 
@@ -52,7 +52,7 @@ void WebEditCommandProxy::unapply()
     if (!m_page || !m_page->isValid())
         return;
 
-    m_page->process()->connection()->send(WebPageMessage::UnapplyEditCommand, m_page->pageID(), CoreIPC::In(m_commandID));
+    m_page->process()->send(Messages::WebPage::UnapplyEditCommand(m_commandID), m_page->pageID());
     m_page->registerEditCommandForRedo(this);
 }
 
@@ -61,7 +61,7 @@ void WebEditCommandProxy::reapply()
     if (!m_page || !m_page->isValid())
         return;
 
-    m_page->process()->connection()->send(WebPageMessage::ReapplyEditCommand, m_page->pageID(), CoreIPC::In(m_commandID));
+    m_page->process()->send(Messages::WebPage::ReapplyEditCommand(m_commandID), m_page->pageID());
     m_page->registerEditCommandForUndo(this);
 }
 
diff --git a/WebKit2/UIProcess/WebPageProxy.cpp b/WebKit2/UIProcess/WebPageProxy.cpp
index 81882a8..7f08125 100644
--- a/WebKit2/UIProcess/WebPageProxy.cpp
+++ b/WebKit2/UIProcess/WebPageProxy.cpp
@@ -39,7 +39,7 @@
 #include "WebEvent.h"
 #include "WebFormSubmissionListenerProxy.h"
 #include "WebFramePolicyListenerProxy.h"
-#include "WebPageMessageKinds.h"
+#include "WebPageMessages.h"
 #include "WebPageNamespace.h"
 #include "WebPageProxyMessageKinds.h"
 #include "WebPreferences.h"
@@ -211,7 +211,7 @@ void WebPageProxy::close()
 
     m_drawingArea.clear();
 
-    process()->send(WebPageMessage::Close, m_pageID, CoreIPC::In());
+    process()->send(Messages::WebPage::Close(), m_pageID);
     process()->removeWebPage(m_pageID);
 }
 
@@ -220,7 +220,7 @@ bool WebPageProxy::tryClose()
     if (!isValid())
         return true;
 
-    process()->send(WebPageMessage::TryClose, m_pageID, CoreIPC::In());
+    process()->send(Messages::WebPage::TryClose(), m_pageID);
     return false;
 }
 
@@ -231,7 +231,7 @@ void WebPageProxy::loadURL(const String& url)
         revive();
     }
 
-    process()->send(WebPageMessage::LoadURL, m_pageID, CoreIPC::In(url));
+    process()->send(Messages::WebPage::LoadURL(url), m_pageID);
 }
 
 void WebPageProxy::loadURLRequest(WebURLRequest* urlRequest)
@@ -241,35 +241,35 @@ void WebPageProxy::loadURLRequest(WebURLRequest* urlRequest)
         revive();
     }
 
-    process()->send(WebPageMessage::LoadURLRequest, m_pageID, CoreIPC::In(urlRequest->resourceRequest()));
+    process()->send(Messages::WebPage::LoadURLRequest(urlRequest->resourceRequest()), m_pageID);
 }
 
 void WebPageProxy::loadHTMLString(const String& htmlString, const String& baseURL)
 {
     if (!isValid())
         return;
-    process()->send(WebPageMessage::LoadHTMLString, m_pageID, CoreIPC::In(htmlString, baseURL));
+    process()->send(Messages::WebPage::LoadHTMLString(htmlString, baseURL), m_pageID);
 }
 
 void WebPageProxy::loadPlainTextString(const String& string)
 {
     if (!isValid())
         return;
-    process()->send(WebPageMessage::LoadPlainTextString, m_pageID, CoreIPC::In(string));
+    process()->send(Messages::WebPage::LoadPlainTextString(string), m_pageID);
 }
 
 void WebPageProxy::stopLoading()
 {
     if (!isValid())
         return;
-    process()->send(WebPageMessage::StopLoading, m_pageID, CoreIPC::In());
+    process()->send(Messages::WebPage::StopLoading(), m_pageID);
 }
 
 void WebPageProxy::reload(bool reloadFromOrigin)
 {
     if (!isValid())
         return;
-    process()->send(WebPageMessage::Reload, m_pageID, CoreIPC::In(reloadFromOrigin));
+    process()->send(Messages::WebPage::Reload(reloadFromOrigin), m_pageID);
 }
 
 void WebPageProxy::goForward()
@@ -280,7 +280,7 @@ void WebPageProxy::goForward()
     if (!canGoForward())
         return;
 
-    process()->send(WebPageMessage::GoForward, m_pageID, CoreIPC::In(m_backForwardList->forwardItem()->itemID()));
+    process()->send(Messages::WebPage::GoForward(m_backForwardList->forwardItem()->itemID()), m_pageID);
 }
 
 bool WebPageProxy::canGoForward() const
@@ -296,7 +296,7 @@ void WebPageProxy::goBack()
     if (!canGoBack())
         return;
 
-    process()->send(WebPageMessage::GoBack, m_pageID, CoreIPC::In(m_backForwardList->backItem()->itemID()));
+    process()->send(Messages::WebPage::GoBack(m_backForwardList->backItem()->itemID()), m_pageID);
 }
 
 bool WebPageProxy::canGoBack() const
@@ -309,7 +309,7 @@ void WebPageProxy::goToBackForwardItem(WebBackForwardListItem* item)
     if (!isValid())
         return;
 
-    process()->send(WebPageMessage::GoToBackForwardItem, m_pageID, CoreIPC::In(item->itemID()));
+    process()->send(Messages::WebPage::GoToBackForwardItem(item->itemID()), m_pageID);
 }
 
 void WebPageProxy::didChangeBackForwardList()
@@ -321,14 +321,14 @@ void WebPageProxy::setFocused(bool isFocused)
 {
     if (!isValid())
         return;
-    process()->send(WebPageMessage::SetFocused, m_pageID, CoreIPC::In(isFocused));
+    process()->send(Messages::WebPage::SetFocused(isFocused), m_pageID);
 }
 
 void WebPageProxy::setActive(bool active)
 {
     if (!isValid())
         return;
-    process()->send(WebPageMessage::SetActive, m_pageID, CoreIPC::In(active));
+    process()->send(Messages::WebPage::SetActive(active), m_pageID);
 }
 
 void WebPageProxy::selectAll()
@@ -336,7 +336,7 @@ void WebPageProxy::selectAll()
     if (!isValid())
         return;
 
-    process()->send(WebPageMessage::SelectAll, m_pageID, CoreIPC::In());
+    process()->send(Messages::WebPage::SelectAll(), m_pageID);
 }
 
 void WebPageProxy::copy()
@@ -344,7 +344,7 @@ void WebPageProxy::copy()
     if (!isValid())
         return;
 
-    process()->send(WebPageMessage::Copy, m_pageID, CoreIPC::In());
+    process()->send(Messages::WebPage::Copy(), m_pageID);
 }
 
 void WebPageProxy::cut()
@@ -352,7 +352,7 @@ void WebPageProxy::cut()
     if (!isValid())
         return;
 
-    process()->send(WebPageMessage::Cut, m_pageID, CoreIPC::In());
+    process()->send(Messages::WebPage::Cut(), m_pageID);
 }
 
 void WebPageProxy::paste()
@@ -360,7 +360,7 @@ void WebPageProxy::paste()
     if (!isValid())
         return;
 
-    process()->send(WebPageMessage::Paste, m_pageID, CoreIPC::In());
+    process()->send(Messages::WebPage::Paste(), m_pageID);
 }
     
 void WebPageProxy::setIsInWindow(bool isInWindow)
@@ -371,7 +371,7 @@ void WebPageProxy::setIsInWindow(bool isInWindow)
     m_isInWindow = isInWindow;
     if (!isValid())
         return;
-    process()->send(WebPageMessage::SetIsInWindow, m_pageID, CoreIPC::In(isInWindow));
+    process()->send(Messages::WebPage::SetIsInWindow(isInWindow), m_pageID);
 }
 
 #if PLATFORM(MAC)
@@ -379,14 +379,14 @@ void WebPageProxy::setWindowIsVisible(bool windowIsVisible)
 {
     if (!isValid())
         return;
-    process()->send(WebPageMessage::SetWindowIsVisible, m_pageID, CoreIPC::In(windowIsVisible));
+    process()->send(Messages::WebPage::SetWindowIsVisible(windowIsVisible), m_pageID);
 }
 
 void WebPageProxy::setWindowFrame(const IntRect& windowFrame)
 {
     if (!isValid())
         return;
-    process()->send(WebPageMessage::SetWindowFrame, m_pageID, CoreIPC::In(windowFrame));
+    process()->send(Messages::WebPage::SetWindowFrame(windowFrame), m_pageID);
 }
 
 #endif
@@ -399,7 +399,7 @@ void WebPageProxy::mouseEvent(const WebMouseEvent& event)
     // NOTE: This does not start the responsiveness timer because mouse move should not indicate interaction.
     if (event.type() != WebEvent::MouseMove)
         process()->responsivenessTimer()->start();
-    process()->send(WebPageMessage::MouseEvent, m_pageID, CoreIPC::In(event));
+    process()->send(Messages::WebPage::MouseEvent(event), m_pageID);
 }
 
 void WebPageProxy::wheelEvent(const WebWheelEvent& event)
@@ -408,7 +408,7 @@ void WebPageProxy::wheelEvent(const WebWheelEvent& event)
         return;
 
     process()->responsivenessTimer()->start();
-    process()->send(WebPageMessage::WheelEvent, m_pageID, CoreIPC::In(event));
+    process()->send(Messages::WebPage::WheelEvent(event), m_pageID);
 }
 
 void WebPageProxy::keyEvent(const WebKeyboardEvent& event)
@@ -417,7 +417,7 @@ void WebPageProxy::keyEvent(const WebKeyboardEvent& event)
         return;
 
     process()->responsivenessTimer()->start();
-    process()->send(WebPageMessage::KeyEvent, m_pageID, CoreIPC::In(event));
+    process()->send(Messages::WebPage::KeyEvent(event), m_pageID);
 }
 
 #if ENABLE(TOUCH_EVENTS)
@@ -425,7 +425,7 @@ void WebPageProxy::touchEvent(const WebTouchEvent& event)
 {
     if (!isValid())
         return;
-    process()->send(WebPageMessage::TouchEvent, m_pageID, CoreIPC::In(event)); 
+    process()->send(Messages::WebPage::TouchEvent(event), m_pageID); 
 }
 #endif
 
@@ -434,7 +434,7 @@ void WebPageProxy::receivedPolicyDecision(WebCore::PolicyAction action, WebFrame
     if (!isValid())
         return;
 
-    process()->send(WebPageMessage::DidReceivePolicyDecision, m_pageID, CoreIPC::In(frame->frameID(), listenerID, (uint32_t)action));
+    process()->send(Messages::WebPage::DidReceivePolicyDecision(frame->frameID(), listenerID, action), m_pageID);
 }
 
 void WebPageProxy::setCustomUserAgent(const String& userAgent)
@@ -442,7 +442,7 @@ void WebPageProxy::setCustomUserAgent(const String& userAgent)
     if (!isValid())
         return;
 
-    process()->send(WebPageMessage::SetCustomUserAgent, m_pageID, CoreIPC::In(userAgent));
+    process()->send(Messages::WebPage::SetCustomUserAgent(userAgent), m_pageID);
 }
 
 void WebPageProxy::terminateProcess()
@@ -473,7 +473,7 @@ void WebPageProxy::setTextZoomFactor(double zoomFactor)
         return;
 
     m_textZoomFactor = zoomFactor;
-    process()->send(WebPageMessage::SetTextZoomFactor, m_pageID, CoreIPC::In(m_textZoomFactor)); 
+    process()->send(Messages::WebPage::SetTextZoomFactor(m_textZoomFactor), m_pageID); 
 }
 
 void WebPageProxy::setPageZoomFactor(double zoomFactor)
@@ -485,7 +485,7 @@ void WebPageProxy::setPageZoomFactor(double zoomFactor)
         return;
 
     m_pageZoomFactor = zoomFactor;
-    process()->send(WebPageMessage::SetPageZoomFactor, m_pageID, CoreIPC::In(m_pageZoomFactor)); 
+    process()->send(Messages::WebPage::SetPageZoomFactor(m_pageZoomFactor), m_pageID); 
 }
 
 void WebPageProxy::setPageAndTextZoomFactors(double pageZoomFactor, double textZoomFactor)
@@ -498,7 +498,7 @@ void WebPageProxy::setPageAndTextZoomFactors(double pageZoomFactor, double textZ
 
     m_pageZoomFactor = pageZoomFactor;
     m_textZoomFactor = textZoomFactor;
-    process()->send(WebPageMessage::SetPageAndTextZoomFactors, m_pageID, CoreIPC::In(m_pageZoomFactor, m_textZoomFactor)); 
+    process()->send(Messages::WebPage::SetPageAndTextZoomFactors(m_pageZoomFactor, m_textZoomFactor), m_pageID); 
 }
 
 void WebPageProxy::runJavaScriptInMainFrame(const String& script, PassRefPtr<ScriptReturnValueCallback> prpCallback)
@@ -506,7 +506,7 @@ void WebPageProxy::runJavaScriptInMainFrame(const String& script, PassRefPtr<Scr
     RefPtr<ScriptReturnValueCallback> callback = prpCallback;
     uint64_t callbackID = callback->callbackID();
     m_scriptReturnValueCallbacks.set(callbackID, callback.get());
-    process()->send(WebPageMessage::RunJavaScriptInMainFrame, m_pageID, CoreIPC::In(script, callbackID));
+    process()->send(Messages::WebPage::RunJavaScriptInMainFrame(script, callbackID), m_pageID);
 }
 
 void WebPageProxy::getRenderTreeExternalRepresentation(PassRefPtr<RenderTreeExternalRepresentationCallback> prpCallback)
@@ -514,7 +514,7 @@ void WebPageProxy::getRenderTreeExternalRepresentation(PassRefPtr<RenderTreeExte
     RefPtr<RenderTreeExternalRepresentationCallback> callback = prpCallback;
     uint64_t callbackID = callback->callbackID();
     m_renderTreeExternalRepresentationCallbacks.set(callbackID, callback.get());
-    process()->send(WebPageMessage::GetRenderTreeExternalRepresentation, m_pageID, callbackID);
+    process()->send(Messages::WebPage::GetRenderTreeExternalRepresentation(callbackID), m_pageID);
 }
 
 void WebPageProxy::getSourceForFrame(WebFrameProxy* frame, PassRefPtr<FrameSourceCallback> prpCallback)
@@ -522,7 +522,7 @@ void WebPageProxy::getSourceForFrame(WebFrameProxy* frame, PassRefPtr<FrameSourc
     RefPtr<FrameSourceCallback> callback = prpCallback;
     uint64_t callbackID = callback->callbackID();
     m_frameSourceCallbacks.set(callbackID, callback.get());
-    process()->send(WebPageMessage::GetSourceForFrame, m_pageID, CoreIPC::In(frame->frameID(), callbackID));
+    process()->send(Messages::WebPage::GetSourceForFrame(frame->frameID(), callbackID), m_pageID);
 }
 
 void WebPageProxy::preferencesDidChange()
@@ -532,7 +532,7 @@ void WebPageProxy::preferencesDidChange()
 
     // FIXME: It probably makes more sense to send individual preference changes.
     // However, WebKitTestRunner depends on getting a preference change notification even if nothing changed in UI process, so that overrides get removed.
-    process()->send(WebPageMessage::PreferencesDidChange, m_pageID, CoreIPC::In(pageNamespace()->context()->preferences()->store()));
+    process()->send(Messages::WebPage::PreferencesDidChange(pageNamespace()->context()->preferences()->store()), m_pageID);
 }
 
 void WebPageProxy::getStatistics(WKContextStatistics* statistics)
@@ -1181,7 +1181,7 @@ void WebPageProxy::removeEditCommand(WebEditCommandProxy* command)
 
     if (!isValid())
         return;
-    process()->send(WebPageMessage::DidRemoveEditCommand, m_pageID, command->commandID());
+    process()->send(Messages::WebPage::DidRemoveEditCommand(command->commandID()), m_pageID);
 }
 
 // Other
diff --git a/WebKit2/UIProcess/WebProcessProxy.h b/WebKit2/UIProcess/WebProcessProxy.h
index 356d6a1..a18f91f 100644
--- a/WebKit2/UIProcess/WebProcessProxy.h
+++ b/WebKit2/UIProcess/WebProcessProxy.h
@@ -62,6 +62,7 @@ public:
     void terminate();
 
     template<typename E, typename T> bool send(E messageID, uint64_t destinationID, const T& arguments);
+    template<typename T> bool send(const T& message, uint64_t destinationID);
     
     CoreIPC::Connection* connection() const
     { 
@@ -155,6 +156,15 @@ bool WebProcessProxy::send(E messageID, uint64_t destinationID, const T& argumen
     return sendMessage(CoreIPC::MessageID(messageID), argumentEncoder.release());
 }
 
+template<typename T>
+bool WebProcessProxy::send(const T& message, uint64_t destinationID)
+{
+    OwnPtr<CoreIPC::ArgumentEncoder> argumentEncoder(new CoreIPC::ArgumentEncoder(destinationID));
+    argumentEncoder->encode(message);
+
+    return sendMessage(CoreIPC::MessageID(T::messageID), argumentEncoder.release());
+}
+
 } // namespace WebKit
 
 #endif // WebProcessProxy_h
diff --git a/WebKit2/WebKit2.xcodeproj/project.pbxproj b/WebKit2/WebKit2.xcodeproj/project.pbxproj
index d2c8839..eb5a64a 100644
--- a/WebKit2/WebKit2.xcodeproj/project.pbxproj
+++ b/WebKit2/WebKit2.xcodeproj/project.pbxproj
@@ -14,12 +14,24 @@
 				1A50DB70110A3D67000D3FE5 /* CopyFiles */,
 			);
 			dependencies = (
+				C0CE72931247E6CD00BC0EC4 /* PBXTargetDependency */,
 				1A50DB3E110A3C1C000D3FE5 /* PBXTargetDependency */,
 				1A50DB3C110A3C19000D3FE5 /* PBXTargetDependency */,
 			);
 			name = All;
 			productName = WebKit2;
 		};
+		C0CE72851247E66800BC0EC4 /* Derived Sources */ = {
+			isa = PBXAggregateTarget;
+			buildConfigurationList = C0CE72891247E68600BC0EC4 /* Build configuration list for PBXAggregateTarget "Derived Sources" */;
+			buildPhases = (
+				C0CE72841247E66800BC0EC4 /* Generate Derived Sources */,
+			);
+			dependencies = (
+			);
+			name = "Derived Sources";
+			productName = "Derived Sources";
+		};
 /* End PBXAggregateTarget section */
 
 /* Begin PBXBuildFile section */
@@ -149,7 +161,6 @@
 		BC111B51112F619200337BAB /* PageClientImpl.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC111B4C112F619200337BAB /* PageClientImpl.mm */; };
 		BC111B5D112F629800337BAB /* WebEventFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = BC111B5B112F629800337BAB /* WebEventFactory.h */; };
 		BC111B5E112F629800337BAB /* WebEventFactory.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC111B5C112F629800337BAB /* WebEventFactory.mm */; };
-		BC111B63112F638300337BAB /* WebPageMessageKinds.h in Headers */ = {isa = PBXBuildFile; fileRef = BC111B60112F638300337BAB /* WebPageMessageKinds.h */; };
 		BC111B64112F638300337BAB /* WebPageProxyMessageKinds.h in Headers */ = {isa = PBXBuildFile; fileRef = BC111B61112F638300337BAB /* WebPageProxyMessageKinds.h */; };
 		BC111B65112F638300337BAB /* WebProcessMessageKinds.h in Headers */ = {isa = PBXBuildFile; fileRef = BC111B62112F638300337BAB /* WebProcessMessageKinds.h */; };
 		BC131BC911726C2800B69727 /* CoreIPCMessageKinds.h in Headers */ = {isa = PBXBuildFile; fileRef = BC131BC811726C2800B69727 /* CoreIPCMessageKinds.h */; };
@@ -352,6 +363,9 @@
 		BCF69FA31176D01400471A52 /* WebNavigationData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCF69FA11176D01400471A52 /* WebNavigationData.cpp */; };
 		BCF69FA91176D1CB00471A52 /* WKNavigationData.h in Headers */ = {isa = PBXBuildFile; fileRef = BCF69FA71176D1CB00471A52 /* WKNavigationData.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		BCF69FAA1176D1CB00471A52 /* WKNavigationData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCF69FA81176D1CB00471A52 /* WKNavigationData.cpp */; };
+		C0CE72A01247E71D00BC0EC4 /* WebPageMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C0CE729E1247E71D00BC0EC4 /* WebPageMessageReceiver.cpp */; };
+		C0CE72A11247E71D00BC0EC4 /* WebPageMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = C0CE729F1247E71D00BC0EC4 /* WebPageMessages.h */; };
+		C0CE72AD1247E78D00BC0EC4 /* HandleMessage.h in Headers */ = {isa = PBXBuildFile; fileRef = C0CE72AC1247E78D00BC0EC4 /* HandleMessage.h */; };
 		C0E3AA7A1209E83000A49D01 /* ModuleMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = C0E3AA481209E45000A49D01 /* ModuleMac.mm */; };
 		C0E3AA7B1209E83500A49D01 /* Module.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C0E3AA451209E2BA00A49D01 /* Module.cpp */; };
 		C0E3AA7C1209E83C00A49D01 /* Module.h in Headers */ = {isa = PBXBuildFile; fileRef = C0E3AA441209E2BA00A49D01 /* Module.h */; };
@@ -386,6 +400,13 @@
 			remoteGlobalIDString = 8DC2EF4F0486A6940098B216;
 			remoteInfo = WebKit2;
 		};
+		C0CE72921247E6CD00BC0EC4 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = C0CE72851247E66800BC0EC4;
+			remoteInfo = "Derived Sources";
+		};
 /* End PBXContainerItemProxy section */
 
 /* Begin PBXCopyFilesBuildPhase section */
@@ -542,7 +563,6 @@
 		BC111B4C112F619200337BAB /* PageClientImpl.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PageClientImpl.mm; sourceTree = "<group>"; };
 		BC111B5B112F629800337BAB /* WebEventFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebEventFactory.h; sourceTree = "<group>"; };
 		BC111B5C112F629800337BAB /* WebEventFactory.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebEventFactory.mm; sourceTree = "<group>"; };
-		BC111B60112F638300337BAB /* WebPageMessageKinds.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPageMessageKinds.h; sourceTree = "<group>"; };
 		BC111B61112F638300337BAB /* WebPageProxyMessageKinds.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPageProxyMessageKinds.h; sourceTree = "<group>"; };
 		BC111B62112F638300337BAB /* WebProcessMessageKinds.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebProcessMessageKinds.h; sourceTree = "<group>"; };
 		BC131BC811726C2800B69727 /* CoreIPCMessageKinds.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CoreIPCMessageKinds.h; sourceTree = "<group>"; };
@@ -747,6 +767,16 @@
 		BCF69FA11176D01400471A52 /* WebNavigationData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebNavigationData.cpp; sourceTree = "<group>"; };
 		BCF69FA71176D1CB00471A52 /* WKNavigationData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKNavigationData.h; sourceTree = "<group>"; };
 		BCF69FA81176D1CB00471A52 /* WKNavigationData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKNavigationData.cpp; sourceTree = "<group>"; };
+		C08FDE87124A851C007645BD /* messages_unittest.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = messages_unittest.py; sourceTree = "<group>"; };
+		C0CE72581247E4DA00BC0EC4 /* WebPage.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebPage.messages.in; sourceTree = "<group>"; };
+		C0CE729E1247E71D00BC0EC4 /* WebPageMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPageMessageReceiver.cpp; sourceTree = "<group>"; };
+		C0CE729F1247E71D00BC0EC4 /* WebPageMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPageMessages.h; sourceTree = "<group>"; };
+		C0CE72AC1247E78D00BC0EC4 /* HandleMessage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HandleMessage.h; sourceTree = "<group>"; };
+		C0CE72DB1247E8F700BC0EC4 /* DerivedSources.make */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DerivedSources.make; sourceTree = "<group>"; };
+		C0CE73361247F70E00BC0EC4 /* generate-message-receiver.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = "generate-message-receiver.py"; sourceTree = "<group>"; };
+		C0CE73371247F70E00BC0EC4 /* generate-messages-header.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = "generate-messages-header.py"; sourceTree = "<group>"; };
+		C0CE73391247F70E00BC0EC4 /* __init__.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = __init__.py; sourceTree = "<group>"; };
+		C0CE734612480B7D00BC0EC4 /* messages.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = messages.py; sourceTree = "<group>"; };
 		C0E3AA441209E2BA00A49D01 /* Module.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Module.h; sourceTree = "<group>"; };
 		C0E3AA451209E2BA00A49D01 /* Module.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Module.cpp; sourceTree = "<group>"; };
 		C0E3AA481209E45000A49D01 /* ModuleMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ModuleMac.mm; sourceTree = "<group>"; };
@@ -791,11 +821,14 @@
 		0867D691FE84028FC02AAC07 /* WebKit2 */ = {
 			isa = PBXGroup;
 			children = (
+				C0CE72DB1247E8F700BC0EC4 /* DerivedSources.make */,
 				BC2E6E74114196F000A63B1E /* Platform */,
 				1AADDF4B10D82AF000D3D63D /* Shared */,
 				BC032D5C10F436D50058C15A /* WebProcess */,
 				BC032DC310F438260058C15A /* UIProcess */,
 				32C88DFF0371C24200C91783 /* Other Sources */,
+				C0CE729D1247E71D00BC0EC4 /* Derived Sources */,
+				C0CE73351247F70E00BC0EC4 /* Scripts */,
 				089C1665FE841158C02AAC07 /* Resources */,
 				1A4F9769100E7B6600637A18 /* Configurations */,
 				0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */,
@@ -990,6 +1023,7 @@
 				BC032DA210F437D10058C15A /* Connection.cpp */,
 				BC032DA310F437D10058C15A /* Connection.h */,
 				BC131BC811726C2800B69727 /* CoreIPCMessageKinds.h */,
+				C0CE72AC1247E78D00BC0EC4 /* HandleMessage.h */,
 				BC032DA410F437D10058C15A /* MessageID.h */,
 			);
 			path = CoreIPC;
@@ -1085,6 +1119,7 @@
 				BC032D8910F437A00058C15A /* WebFrame.h */,
 				BC963D6A113DD19200574BE2 /* WebPage.cpp */,
 				BC032D8B10F437A00058C15A /* WebPage.h */,
+				C0CE72581247E4DA00BC0EC4 /* WebPage.messages.in */,
 			);
 			path = WebPage;
 			sourceTree = "<group>";
@@ -1298,7 +1333,6 @@
 				BC9E969911457EDE00870E71 /* DrawingAreaProxyMessageKinds.h */,
 				BCB28CBF120233D9007D99BC /* InjectedBundleMessageKinds.h */,
 				BCCB75C51203A1CE00222D1B /* WebContextMessageKinds.h */,
-				BC111B60112F638300337BAB /* WebPageMessageKinds.h */,
 				BC111B61112F638300337BAB /* WebPageProxyMessageKinds.h */,
 				BC111B62112F638300337BAB /* WebProcessMessageKinds.h */,
 				BCB7346D11CEE3FF00EC5002 /* WebProcessProxyMessageKinds.h */,
@@ -1477,6 +1511,36 @@
 			path = mac;
 			sourceTree = "<group>";
 		};
+		C0CE729D1247E71D00BC0EC4 /* Derived Sources */ = {
+			isa = PBXGroup;
+			children = (
+				C0CE729E1247E71D00BC0EC4 /* WebPageMessageReceiver.cpp */,
+				C0CE729F1247E71D00BC0EC4 /* WebPageMessages.h */,
+			);
+			name = "Derived Sources";
+			path = DerivedSources/WebKit2;
+			sourceTree = BUILT_PRODUCTS_DIR;
+		};
+		C0CE73351247F70E00BC0EC4 /* Scripts */ = {
+			isa = PBXGroup;
+			children = (
+				C0CE73371247F70E00BC0EC4 /* generate-messages-header.py */,
+				C0CE73361247F70E00BC0EC4 /* generate-message-receiver.py */,
+				C0CE73381247F70E00BC0EC4 /* webkit2 */,
+			);
+			path = Scripts;
+			sourceTree = "<group>";
+		};
+		C0CE73381247F70E00BC0EC4 /* webkit2 */ = {
+			isa = PBXGroup;
+			children = (
+				C0CE73391247F70E00BC0EC4 /* __init__.py */,
+				C0CE734612480B7D00BC0EC4 /* messages.py */,
+				C08FDE87124A851C007645BD /* messages_unittest.py */,
+			);
+			path = webkit2;
+			sourceTree = "<group>";
+		};
 /* End PBXGroup section */
 
 /* Begin PBXHeadersBuildPhase section */
@@ -1551,7 +1615,6 @@
 				BCF69FA21176D01400471A52 /* WebNavigationData.h in Headers */,
 				BCF69F9A1176CED600471A52 /* WebNavigationDataStore.h in Headers */,
 				BC032D8F10F437A00058C15A /* WebPage.h in Headers */,
-				BC111B63112F638300337BAB /* WebPageMessageKinds.h in Headers */,
 				BCEE98C7113314D7006BCC24 /* WebPageNamespace.h in Headers */,
 				BC032DD110F4389F0058C15A /* WebPageProxy.h in Headers */,
 				BC111B64112F638300337BAB /* WebPageProxyMessageKinds.h in Headers */,
@@ -1659,6 +1722,8 @@
 				BCF50724124328A9005955AE /* WKCertificateInfo.h in Headers */,
 				BCF50728124329AA005955AE /* WebCertificateInfo.h in Headers */,
 				BCF5072E12432A97005955AE /* WKCertificateInfoMac.h in Headers */,
+				C0CE72A11247E71D00BC0EC4 /* WebPageMessages.h in Headers */,
+				C0CE72AD1247E78D00BC0EC4 /* HandleMessage.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -1708,7 +1773,6 @@
 			isa = PBXProject;
 			buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "WebKit2" */;
 			compatibilityVersion = "Xcode 3.1";
-			developmentRegion = English;
 			hasScannedForEncodings = 1;
 			knownRegions = (
 				English,
@@ -1724,6 +1788,7 @@
 				1A50DB38110A3C13000D3FE5 /* All */,
 				8DC2EF4F0486A6940098B216 /* WebKit2 */,
 				1A50DB1D110A3BDC000D3FE5 /* WebProcess */,
+				C0CE72851247E66800BC0EC4 /* Derived Sources */,
 			);
 		};
 /* End PBXProject section */
@@ -1747,6 +1812,23 @@
 		};
 /* End PBXResourcesBuildPhase section */
 
+/* Begin PBXShellScriptBuildPhase section */
+		C0CE72841247E66800BC0EC4 /* Generate Derived Sources */ = {
+			isa = PBXShellScriptBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			inputPaths = (
+			);
+			name = "Generate Derived Sources";
+			outputPaths = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+			shellPath = /bin/sh;
+			shellScript = "mkdir -p \"${BUILT_PRODUCTS_DIR}/DerivedSources/WebKit2\"\ncd \"${BUILT_PRODUCTS_DIR}/DerivedSources/WebKit2\"\n\nexport WebKit2=\"${SRCROOT}\"\n\nif [ \"${ACTION}\" = \"build\" -o \"${ACTION}\" = \"install\" -o \"${ACTION}\" = \"installhdrs\" ]; then\n    make -f \"${WebKit2}/DerivedSources.make\" -j `/usr/sbin/sysctl -n hw.availcpu`\nfi\n";
+		};
+/* End PBXShellScriptBuildPhase section */
+
 /* Begin PBXSourcesBuildPhase section */
 		1A50DB1B110A3BDC000D3FE5 /* Sources */ = {
 			isa = PBXSourcesBuildPhase;
@@ -1911,6 +1993,7 @@
 				BCF505E81243047B005955AE /* PlatformCertificateInfo.mm in Sources */,
 				BCF50725124328A9005955AE /* WKCertificateInfo.cpp in Sources */,
 				BCF5072F12432A97005955AE /* WKCertificateInfoMac.mm in Sources */,
+				C0CE72A01247E71D00BC0EC4 /* WebPageMessageReceiver.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -1932,6 +2015,11 @@
 			target = 8DC2EF4F0486A6940098B216 /* WebKit2 */;
 			targetProxy = 1A50DB3D110A3C1C000D3FE5 /* PBXContainerItemProxy */;
 		};
+		C0CE72931247E6CD00BC0EC4 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = C0CE72851247E66800BC0EC4 /* Derived Sources */;
+			targetProxy = C0CE72921247E6CD00BC0EC4 /* PBXContainerItemProxy */;
+		};
 /* End PBXTargetDependency section */
 
 /* Begin PBXVariantGroup section */
@@ -2046,6 +2134,34 @@
 			};
 			name = Production;
 		};
+		C0CE72861247E66800BC0EC4 /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				COPY_PHASE_STRIP = NO;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				PRODUCT_NAME = "Derived Sources";
+			};
+			name = Debug;
+		};
+		C0CE72871247E66800BC0EC4 /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				COPY_PHASE_STRIP = YES;
+				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				PRODUCT_NAME = "Derived Sources";
+				ZERO_LINK = NO;
+			};
+			name = Release;
+		};
+		C0CE72881247E66800BC0EC4 /* Production */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				PRODUCT_NAME = "Derived Sources";
+			};
+			name = Production;
+		};
 /* End XCBuildConfiguration section */
 
 /* Begin XCConfigurationList section */
@@ -2089,6 +2205,16 @@
 			defaultConfigurationIsVisible = 0;
 			defaultConfigurationName = Production;
 		};
+		C0CE72891247E68600BC0EC4 /* Build configuration list for PBXAggregateTarget "Derived Sources" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				C0CE72861247E66800BC0EC4 /* Debug */,
+				C0CE72871247E66800BC0EC4 /* Release */,
+				C0CE72881247E66800BC0EC4 /* Production */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Production;
+		};
 /* End XCConfigurationList section */
 	};
 	rootObject = 0867D690FE84028FC02AAC07 /* Project object */;
diff --git a/WebKit2/WebProcess/WebPage/WebPage.cpp b/WebKit2/WebProcess/WebPage/WebPage.cpp
index 9344e0f..8c6506a 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.cpp
+++ b/WebKit2/WebProcess/WebPage/WebPage.cpp
@@ -42,7 +42,6 @@
 #include "WebEventConversion.h"
 #include "WebFrame.h"
 #include "WebInspectorClient.h"
-#include "WebPageMessageKinds.h"
 #include "WebPageProxyMessageKinds.h"
 #include "WebProcessProxyMessageKinds.h"
 #include "WebPreferencesStore.h"
@@ -546,11 +545,12 @@ void WebPage::setIsInWindow(bool isInWindow)
     }
 }
 
-void WebPage::didReceivePolicyDecision(WebFrame* frame, uint64_t listenerID, WebCore::PolicyAction policyAction)
+void WebPage::didReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, uint32_t policyAction)
 {
+    WebFrame* frame = WebProcess::shared().webFrame(frameID);
     if (!frame)
         return;
-    frame->didReceivePolicyDecision(listenerID, policyAction);
+    frame->didReceivePolicyDecision(listenerID, static_cast<WebCore::PolicyAction>(policyAction));
 }
 
 void WebPage::show()
@@ -609,10 +609,10 @@ void WebPage::getRenderTreeExternalRepresentation(uint64_t callbackID)
     WebProcess::shared().connection()->send(WebPageProxyMessage::DidGetRenderTreeExternalRepresentation, m_pageID, CoreIPC::In(resultString, callbackID));
 }
 
-void WebPage::getSourceForFrame(WebFrame* frame, uint64_t callbackID)
+void WebPage::getSourceForFrame(uint64_t frameID, uint64_t callbackID)
 {
     String resultString;
-    if (frame)
+    if (WebFrame* frame = WebProcess::shared().webFrame(frameID))
        resultString = frame->source();
     WebProcess::shared().connection()->send(WebPageProxyMessage::DidGetSourceForFrame, m_pageID, CoreIPC::In(resultString, callbackID));
 }
@@ -748,261 +748,7 @@ void WebPage::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::Messag
         return;
     }
 
-    switch (messageID.get<WebPageMessage::Kind>()) {
-        case WebPageMessage::SetActive: {
-            bool active;
-            if (!arguments->decode(active))
-                return;
-         
-            setActive(active);
-            return;
-        }
-        case WebPageMessage::SetFocused: {
-            bool focused;
-            if (!arguments->decode(focused))
-                return;
-            
-            setFocused(focused);
-            return;
-        }
-        case WebPageMessage::SetIsInWindow: {
-            bool isInWindow;
-            if (!arguments->decode(isInWindow))
-                return;
-            
-            setIsInWindow(isInWindow);
-            return;
-        }
-#if PLATFORM(MAC)
-        case WebPageMessage::SetWindowIsVisible: {
-            bool windowIsVisible;
-            if (!arguments->decode(windowIsVisible))
-                return;
-            setWindowIsVisible(windowIsVisible);
-            return;
-        }
-        
-        case WebPageMessage::SetWindowFrame: {
-            IntRect windowFrame;
-            if (!arguments->decode(windowFrame))
-                return;
-            setWindowFrame(windowFrame);
-            return;
-        }
-#endif
-        case WebPageMessage::MouseEvent: {
-            WebMouseEvent event;
-            if (!arguments->decode(event))
-                return;
-            mouseEvent(event);
-            return;
-        }
-        case WebPageMessage::PreferencesDidChange: {
-            WebPreferencesStore store;
-            if (!arguments->decode(store))
-                return;
-            
-            preferencesDidChange(store);
-            return;
-        }
-        case WebPageMessage::WheelEvent: {
-            WebWheelEvent event;
-            if (!arguments->decode(event))
-                return;
-
-            wheelEvent(event);
-            return;
-        }
-        case WebPageMessage::KeyEvent: {
-            WebKeyboardEvent event;
-            if (!arguments->decode(event))
-                return;
-
-            keyEvent(event);
-            return;
-        }
-        case WebPageMessage::SelectAll: {
-            selectAll();
-            return;
-        }
-        case WebPageMessage::Copy: {
-            copy();
-            return;
-        }
-        case WebPageMessage::Cut: {
-            cut();
-            return;
-        }
-        case WebPageMessage::Paste: {
-            paste();
-            return;
-        }            
-#if ENABLE(TOUCH_EVENTS)
-        case WebPageMessage::TouchEvent: {
-            WebTouchEvent event;
-            if (!arguments->decode(event))
-                return;
-            touchEvent(event);
-        }
-#endif
-        case WebPageMessage::LoadURL: {
-            String url;
-            if (!arguments->decode(url))
-                return;
-            
-            loadURL(url);
-            return;
-        }
-        case WebPageMessage::LoadURLRequest: {
-            ResourceRequest request;
-            if (!arguments->decode(request))
-                return;
-            
-            loadURLRequest(request);
-            return;
-        }
-        case WebPageMessage::LoadHTMLString: {
-            String htmlString;
-            String baseURL;
-            if (!arguments->decode(CoreIPC::Out(htmlString, baseURL)))
-                return;
-            
-            loadHTMLString(htmlString, baseURL);
-            return;
-        }
-        case WebPageMessage::LoadPlainTextString: {
-            String string;
-            if (!arguments->decode(CoreIPC::Out(string)))
-                return;
-            
-            loadPlainTextString(string);
-            return;
-        }
-        case WebPageMessage::StopLoading:
-            stopLoading();
-            return;
-        case WebPageMessage::Reload: {
-            bool reloadFromOrigin;
-            if (!arguments->decode(CoreIPC::Out(reloadFromOrigin)))
-                return;
-
-            reload(reloadFromOrigin);
-            return;
-        }
-        case WebPageMessage::GoForward: {
-            uint64_t backForwardItemID;
-            if (!arguments->decode(CoreIPC::Out(backForwardItemID)))
-                return;
-            goForward(backForwardItemID);
-            return;
-        }
-        case WebPageMessage::GoBack: {
-            uint64_t backForwardItemID;
-            if (!arguments->decode(CoreIPC::Out(backForwardItemID)))
-                return;
-            goBack(backForwardItemID);
-            return;
-        }
-       case WebPageMessage::GoToBackForwardItem: {
-            uint64_t backForwardItemID;
-            if (!arguments->decode(CoreIPC::Out(backForwardItemID)))
-                return;
-            goToBackForwardItem(backForwardItemID);
-            return;
-        }
-        case WebPageMessage::DidReceivePolicyDecision: {
-            uint64_t frameID;
-            uint64_t listenerID;
-            uint32_t policyAction;
-            if (!arguments->decode(CoreIPC::Out(frameID, listenerID, policyAction)))
-                return;
-            didReceivePolicyDecision(WebProcess::shared().webFrame(frameID), listenerID, (WebCore::PolicyAction)policyAction);
-            return;
-        }
-        case WebPageMessage::RunJavaScriptInMainFrame: {
-            String script;
-            uint64_t callbackID;
-            if (!arguments->decode(CoreIPC::Out(script, callbackID)))
-                return;
-            runJavaScriptInMainFrame(script, callbackID);
-            return;
-        }
-        case WebPageMessage::GetRenderTreeExternalRepresentation: {
-            uint64_t callbackID;
-            if (!arguments->decode(callbackID))
-                return;
-            getRenderTreeExternalRepresentation(callbackID);
-            return;
-        }
-        case WebPageMessage::GetSourceForFrame: {
-            uint64_t frameID;
-            uint64_t callbackID;
-            if (!arguments->decode(CoreIPC::Out(frameID, callbackID)))
-                return;
-            getSourceForFrame(WebProcess::shared().webFrame(frameID), callbackID);
-            return;
-        }
-        case WebPageMessage::Close: {
-            close();
-            return;
-        }
-        case WebPageMessage::TryClose: {
-            tryClose();
-            return;
-        }
-        case WebPageMessage::SetCustomUserAgent: {
-            String customUserAgent;
-            if (!arguments->decode(CoreIPC::Out(customUserAgent)))
-                return;
-            setCustomUserAgent(customUserAgent);
-            return;
-        }
-        case WebPageMessage::UnapplyEditCommand: {
-            uint64_t commandID;
-            if (!arguments->decode(CoreIPC::Out(commandID)))
-                return;
-            unapplyEditCommand(commandID);
-            return;
-        }
-        case WebPageMessage::ReapplyEditCommand: {
-            uint64_t commandID;
-            if (!arguments->decode(CoreIPC::Out(commandID)))
-                return;
-            reapplyEditCommand(commandID);
-            return;
-        }
-        case WebPageMessage::DidRemoveEditCommand: {
-            uint64_t commandID;
-            if (!arguments->decode(CoreIPC::Out(commandID)))
-                return;
-            didRemoveEditCommand(commandID);
-            return;
-        }
-        case WebPageMessage::SetPageZoomFactor: {
-            double zoomFactor;
-            if (!arguments->decode(CoreIPC::Out(zoomFactor)))
-                return;
-            setPageZoomFactor(zoomFactor);
-            return;
-        }
-        case WebPageMessage::SetTextZoomFactor: {
-            double zoomFactor;
-            if (!arguments->decode(CoreIPC::Out(zoomFactor)))
-                return;
-            setTextZoomFactor(zoomFactor);
-            return;
-        }
-        case WebPageMessage::SetPageAndTextZoomFactors: {
-            double pageZoomFactor;
-            double textZoomFactor;
-            if (!arguments->decode(CoreIPC::Out(pageZoomFactor, textZoomFactor)))
-                return;
-            setPageAndTextZoomFactors(pageZoomFactor, textZoomFactor);
-            return;
-        }
-    }
-
-    ASSERT_NOT_REACHED();
+    didReceiveWebPageMessage(connection, messageID, arguments);
 }
 
 } // namespace WebKit
diff --git a/WebKit2/WebProcess/WebPage/WebPage.h b/WebKit2/WebProcess/WebPage/WebPage.h
index dd9308d..b8f09b8 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.h
+++ b/WebKit2/WebProcess/WebPage/WebPage.h
@@ -161,6 +161,9 @@ private:
     virtual Type type() const { return APIType; }
 
     void platformInitialize();
+
+    void didReceiveWebPageMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
+
     static const char* interpretKeyEvent(const WebCore::KeyboardEvent*);
     bool performDefaultBehaviorForKeyEvent(const WebKeyboardEvent&);
 
@@ -193,10 +196,10 @@ private:
 #endif
     void runJavaScriptInMainFrame(const String&, uint64_t callbackID);
     void getRenderTreeExternalRepresentation(uint64_t callbackID);
-    void getSourceForFrame(WebFrame*, uint64_t callbackID);
+    void getSourceForFrame(uint64_t frameID, uint64_t callbackID);
     void preferencesDidChange(const WebPreferencesStore&);
     void platformPreferencesDidChange(const WebPreferencesStore&);
-    void didReceivePolicyDecision(WebFrame*, uint64_t listenerID, WebCore::PolicyAction policyAction);
+    void didReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, uint32_t policyAction);
     void setCustomUserAgent(const String&);
 
 #if PLATFORM(MAC)
diff --git a/WebKit2/WebProcess/WebPage/WebPage.messages.in b/WebKit2/WebProcess/WebPage/WebPage.messages.in
new file mode 100644
index 0000000..c3b88a7
--- /dev/null
+++ b/WebKit2/WebProcess/WebPage/WebPage.messages.in
@@ -0,0 +1,77 @@
+# Copyright (C) 2010 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1.  Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+# 2.  Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in the
+#     documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+messages -> WebPage {
+    SetActive(bool active)
+    SetFocused(bool focused)
+    SetIsInWindow(bool isInWindow)
+
+    KeyEvent(WebKit::WebKeyboardEvent event)
+    MouseEvent(WebKit::WebMouseEvent event)
+#if ENABLE(TOUCH_EVENTS)
+    TouchEvent(WebKit::WebTouchEvent event)
+#endif
+    WheelEvent(WebKit::WebWheelEvent event)
+
+    GoBack(uint64_t backForwardItemID)
+    GoForward(uint64_t backForwardItemID)
+    GoToBackForwardItem(uint64_t backForwardItemID)
+    LoadHTMLString(WTF::String htmlString, WTF::String url)
+    LoadPlainTextString(WTF::String string)
+    LoadURL(WTF::String url)
+    LoadURLRequest(WebCore::ResourceRequest request)
+    Reload(bool reloadFromOrigin)
+    StopLoading()
+
+    DidReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, uint32_t policyAction)
+
+    GetRenderTreeExternalRepresentation(uint64_t callbackID)
+
+    GetSourceForFrame(uint64_t frameID, uint64_t callbackID)
+
+    PreferencesDidChange(WebKit::WebPreferencesStore store)
+
+    RunJavaScriptInMainFrame(WTF::String script, uint64_t callbackID)
+
+    SetCustomUserAgent(WTF::String customUserAgent)
+
+    Close()
+    TryClose()
+
+    Copy()
+    Cut()
+    Paste()
+    SelectAll()
+
+    DidRemoveEditCommand(uint64_t commandID)
+    ReapplyEditCommand(uint64_t commandID)
+    UnapplyEditCommand(uint64_t commandID)
+
+    SetPageAndTextZoomFactors(double pageZoomFactor, double textZoomFactor)
+    SetPageZoomFactor(double zoomFactor)
+    SetTextZoomFactor(double zoomFactor)
+
+#if PLATFORM(MAC)
+    SetWindowIsVisible(bool windowIsVisible)
+    SetWindowFrame(WebCore::IntRect windowFrame)
+#endif
+}
diff --git a/WebKit2/win/WebKit2.make b/WebKit2/win/WebKit2.make
index 8b45f47..2f5cbb7 100755
--- a/WebKit2/win/WebKit2.make
+++ b/WebKit2/win/WebKit2.make
@@ -15,3 +15,5 @@ install:
 	xcopy "$(OBJROOT)\include\*" "$(DSTROOT)\AppleInternal\include\" /e/v/i/h/y	
 	xcopy "$(OBJROOT)\lib\*" "$(DSTROOT)\AppleInternal\lib\" /e/v/i/h/y
 	-xcopy "$(OBJROOT)\bin\WebKit2.resources\*" "$(DSTROOT)\AppleInternal\bin\WebKit2.resources" /e/v/i/h/y
+	-mkdir "$(DSTROOT)\AppleInternal\Sources\WebKit2"
+	xcopy "$(OBJROOT)\obj\WebKit\DerivedSources\*" "$(DSTROOT)\AppleInternal\Sources\WebKit2" /e/v/i/h/y
diff --git a/WebKit2/win/WebKit2.vcproj b/WebKit2/win/WebKit2.vcproj
index b00e00b..4c1e689 100755
--- a/WebKit2/win/WebKit2.vcproj
+++ b/WebKit2/win/WebKit2.vcproj
@@ -457,11 +457,11 @@
 				>
 			</File>
 			<File
-				RelativePath="..\Shared\WebCoreTypeArgumentMarshalling.h"
+				RelativePath="..\Shared\WebCertificateInfo.h"
 				>
 			</File>
 			<File
-				RelativePath="..\Shared\WebCertificateInfo.h"
+				RelativePath="..\Shared\WebCoreTypeArgumentMarshalling.h"
 				>
 			</File>
 			<File
@@ -536,10 +536,6 @@
 					>
 				</File>
 				<File
-					RelativePath="..\Shared\CoreIPCSupport\WebPageMessageKinds.h"
-					>
-				</File>
-				<File
 					RelativePath="..\Shared\CoreIPCSupport\WebPageProxyMessageKinds.h"
 					>
 				</File>
@@ -560,6 +556,10 @@
 					>
 				</File>
 				<File
+					RelativePath="..\Shared\win\PlatformCertificateInfo.h"
+					>
+				</File>
+				<File
 					RelativePath="..\Shared\win\UpdateChunk.cpp"
 					>
 				</File>
@@ -580,10 +580,6 @@
 					>
 				</File>
 				<File
-					RelativePath="..\Shared\win\PlatformCertificateInfo.h"
-					>
-				</File>
-				<File
 					RelativePath="..\Shared\win\WebURLRequestWin.cpp"
 					>
 					<FileConfiguration
@@ -1812,6 +1808,10 @@
 					>
 				</File>
 				<File
+					RelativePath="..\Platform\CoreIPC\HandleMessage.h"
+					>
+				</File>
+				<File
 					RelativePath="..\Platform\CoreIPC\MessageID.h"
 					>
 				</File>
@@ -1937,6 +1937,46 @@
 				>
 			</File>
 		</Filter>
+		<Filter
+			Name="Derived Sources"
+			>
+			<File
+				RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\WebPageMessageReceiver.cpp"
+				>
+			</File>
+			<File
+				RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\WebPageMessages.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Scripts"
+			>
+			<File
+				RelativePath="..\Scripts\generate-message-receiver.py"
+				>
+			</File>
+			<File
+				RelativePath="..\Scripts\generate-messages-header.py"
+				>
+			</File>
+			<Filter
+				Name="webkit2"
+				>
+				<File
+					RelativePath="..\Scripts\webkit2\__init__.py"
+					>
+				</File>
+				<File
+					RelativePath="..\Scripts\webkit2\messages.py"
+					>
+				</File>
+				<File
+					RelativePath="..\Scripts\webkit2\messages_unittest.py"
+					>
+				</File>
+			</Filter>
+		</Filter>
 		<File
 			RelativePath="..\WebKit2Prefix.cpp"
 			>
diff --git a/WebKit2/win/WebKit2Common.vsprops b/WebKit2/win/WebKit2Common.vsprops
index 2f60732..91600c2 100755
--- a/WebKit2/win/WebKit2Common.vsprops
+++ b/WebKit2/win/WebKit2Common.vsprops
@@ -6,7 +6,7 @@
 	>
 	<Tool
 		Name="VCCLCompilerTool"
-		AdditionalIncludeDirectories="&quot;$(ProjectDir)\..\Platform&quot;;&quot;$(ProjectDir)\..\Platform\CoreIPC&quot;;&quot;$(ProjectDir)\..\Shared&quot;;&quot;$(ProjectDir)\..\Shared\win&quot;;&quot;$(ProjectDir)\..\Shared\CoreIPCSupport&quot;;&quot;$(ProjectDir)\..\UIProcess&quot;;&quot;$(ProjectDir)\..\UIProcess\API\C&quot;;&quot;$(ProjectDir)\..\UIProcess\API\cpp&quot;;&quot;$(ProjectDir)\..\UIProcess\API\win&quot;;&quot;$(ProjectDir)\..\UIProcess\Launcher&quot;;&quot;$(ProjectDir)\..\UIProcess\Plugins&quot;;&quot;$(ProjectDir)\..\UIProcess\win&quot;;&quot;$(ProjectDir)\..\WebProcess&quot;;&quot;$(ProjectDir)\..\WebProcess\WebCoreSupport&quot;;&quot;$(ProjectDir)\..\WebProcess\WebCoreSupport\win&quot;;&quot;$(ProjectDir)\..\WebProcess\WebPage&quot;;&quot;$(ProjectDir)\..\WebProcess\WebPage\win&quot;;&quot;$(ProjectDir)\..\WebProcess\InjectedBundle&quot;;&quot;$(ProjectDir)\..\WebProcess\InjectedBundle\API\c&quot;;&quot;$(ProjectDir)\..\WebProcess\InjectedBundle\DOM&quot;;&quot;$(ProjectDir)\..\WebProcess\InjectedBundle\win&quot;;&quot;$(ProjectDir)\..\WebProcess\Plugins&quot;;&quot;$(ProjectDir)\..\WebProcess\Plugins\Netscape&quot;;&quot;$(ProjectDir)\..\WebProcess\win&quot;;&quot;$(WebKitOutputDir)\Include&quot;;&quot;$(WebKitOutputDir)\Include\private&quot;;&quot;$(WebKitLibrariesDir)\Include&quot;;&quot;$(WebKitLibrariesDir)\Include\private&quot;;&quot;$(WebKitLibrariesDir)\Include\pthreads&quot;;&quot;$(WebKitOutputDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\Include\private\JavaScriptCore&quot;;&quot;$(WebKitLibrariesDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitLibrariesDir)\Include\private\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders&quot;;&quot;$(WebKitLibrariesDir)\Include\WebCore\ForwardingHeaders&quot;"
+		AdditionalIncludeDirectories="&quot;$(ProjectDir)\..\Platform&quot;;&quot;$(ProjectDir)\..\Platform\CoreIPC&quot;;&quot;$(ProjectDir)\..\Shared&quot;;&quot;$(ProjectDir)\..\Shared\win&quot;;&quot;$(ProjectDir)\..\Shared\CoreIPCSupport&quot;;&quot;$(ProjectDir)\..\UIProcess&quot;;&quot;$(ProjectDir)\..\UIProcess\API\C&quot;;&quot;$(ProjectDir)\..\UIProcess\API\cpp&quot;;&quot;$(ProjectDir)\..\UIProcess\API\win&quot;;&quot;$(ProjectDir)\..\UIProcess\Launcher&quot;;&quot;$(ProjectDir)\..\UIProcess\Plugins&quot;;&quot;$(ProjectDir)\..\UIProcess\win&quot;;&quot;$(ProjectDir)\..\WebProcess&quot;;&quot;$(ProjectDir)\..\WebProcess\WebCoreSupport&quot;;&quot;$(ProjectDir)\..\WebProcess\WebCoreSupport\win&quot;;&quot;$(ProjectDir)\..\WebProcess\WebPage&quot;;&quot;$(ProjectDir)\..\WebProcess\WebPage\win&quot;;&quot;$(ProjectDir)\..\WebProcess\InjectedBundle&quot;;&quot;$(ProjectDir)\..\WebProcess\InjectedBundle\API\c&quot;;&quot;$(ProjectDir)\..\WebProcess\InjectedBundle\DOM&quot;;&quot;$(ProjectDir)\..\WebProcess\InjectedBundle\win&quot;;&quot;$(ProjectDir)\..\WebProcess\Plugins&quot;;&quot;$(ProjectDir)\..\WebProcess\Plugins\Netscape&quot;;&quot;$(ProjectDir)\..\WebProcess\win&quot;;&quot;$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources&quot;;&quot;$(WebKitOutputDir)\Include&quot;;&quot;$(WebKitOutputDir)\Include\private&quot;;&quot;$(WebKitLibrariesDir)\Include&quot;;&quot;$(WebKitLibrariesDir)\Include\private&quot;;&quot;$(WebKitLibrariesDir)\Include\pthreads&quot;;&quot;$(WebKitOutputDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\Include\private\JavaScriptCore&quot;;&quot;$(WebKitLibrariesDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitLibrariesDir)\Include\private\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders&quot;;&quot;$(WebKitLibrariesDir)\Include\WebCore\ForwardingHeaders&quot;"
 		PreprocessorDefinitions="_USRDLL;WEBKIT_EXPORTS;FRAMEWORK_NAME=WebKit;BUILDING_WEBKIT"
 		UsePrecompiledHeader="2"
 		PrecompiledHeaderThrough="WebKit2Prefix.h"
diff --git a/WebKit2/win/WebKit2Generated.make b/WebKit2/win/WebKit2Generated.make
index 5d07f99..b47faf2 100644
--- a/WebKit2/win/WebKit2Generated.make
+++ b/WebKit2/win/WebKit2Generated.make
@@ -47,6 +47,7 @@ all:
     xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundlePrivate.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
     xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundleRangeHandle.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
     xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundleScriptWorld.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
+    bash build-generated-files.sh "$(WEBKITOUTPUTDIR)"
     -del "$(WEBKITOUTPUTDIR)\buildfailed"
 
 clean:
diff --git a/WebKit2/win/WebKit2Generated.vcproj b/WebKit2/win/WebKit2Generated.vcproj
index f74bca3..3136e3b 100755
--- a/WebKit2/win/WebKit2Generated.vcproj
+++ b/WebKit2/win/WebKit2Generated.vcproj
@@ -40,6 +40,10 @@
 	</References>
 	<Files>
 		<File
+			RelativePath=".\build-generated-files.sh"
+			>
+		</File>
+		<File
 			RelativePath=".\WebKit2Generated.make"
 			>
 		</File>
diff --git a/WebKit2/win/build-generated-files.sh b/WebKit2/win/build-generated-files.sh
new file mode 100644
index 0000000..fd8b59e
--- /dev/null
+++ b/WebKit2/win/build-generated-files.sh
@@ -0,0 +1,34 @@
+# Copyright (C) 2010 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1.  Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+# 2.  Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in the
+#     documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# Calls to `cygpath -ms` below are needed to remove spaces from paths, which
+# confuse GNU make. See <http://webkit.org/b/8173>.
+
+WebKitOutputDir=$(cygpath -u "$(cygpath -ms "${1}")")
+DerivedSources="${WebKitOutputDir}/obj/WebKit/DerivedSources"
+
+export WebKit2=$(cygpath -u "$(cygpath -ms "$(realpath ..)")")
+
+mkdir -p "${DerivedSources}"
+cd "${DerivedSources}"
+
+make -f "${WebKit2}/DerivedSources.make"

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list