Changeset 68445 in webkit
- Timestamp:
- Sep 27, 2010 4:38:21 PM (14 years ago)
- Location:
- trunk/WebKit2
- Files:
-
- 1 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit2/ChangeLog
r68435 r68445 50 50 * WebProcess/mac/WebProcessMainMac.mm: 51 51 (WebKit::WebProcessMain): 52 53 2010-09-27 Anders Carlsson <andersca@apple.com> 54 55 Reviewed by Adam Roben. 56 57 Add WebProcessConnection CreatePlugin message 58 https://bugs.webkit.org/show_bug.cgi?id=46668 59 60 * DerivedSources.make: 61 Add WebProcessConnection. 62 63 * Platform/CoreIPC/HandleMessage.h: 64 Add handleMessage overload for a sync message with two input parameters 65 and one output parameter. 66 67 (CoreIPC::handleMessage): 68 * Platform/CoreIPC/MessageID.h: 69 Add MessageClassWebProcessConnection. 70 71 * PluginProcess/WebProcessConnection.cpp: 72 (WebKit::WebProcessConnection::createPlugin): 73 Add stub. 74 75 * PluginProcess/WebProcessConnection.messages.in: Added. 76 * Scripts/webkit2/messages.py: 77 Include headers directly for types that we believe are nested structs. 78 79 * Scripts/webkit2/messages_unittest.py: 80 Update expected results. 81 82 * WebKit2.xcodeproj/project.pbxproj: 83 Add new files. 52 84 53 85 2010-09-27 Anders Carlsson <andersca@apple.com> -
trunk/WebKit2/DerivedSources.make
r68309 r68445 9 9 PluginProcessProxy \ 10 10 WebPage \ 11 WebProcessConnection \ 11 12 # 12 13 -
trunk/WebKit2/Platform/CoreIPC/HandleMessage.h
r68079 r68445 49 49 } 50 50 51 template<typename T, typename C, typename P1, typename P2, typename R1> 52 void handleMessage(ArgumentDecoder* arguments, ArgumentEncoder* reply, C* object, void (C::*function)(P1, P2, R1&)) 53 { 54 typename RemoveReference<typename T::FirstArgumentType>::Type firstArgument; 55 if (!arguments->decode(firstArgument)) 56 return; 57 58 typename RemoveReference<typename T::SecondArgumentType>::Type secondArgument; 59 if (!arguments->decode(secondArgument)) 60 return; 61 62 typename RemoveReference<typename T::Reply::FirstArgumentType>::Type firstReplyArgument; 63 (object->*function)(firstArgument, secondArgument, firstReplyArgument); 64 reply->encode(firstReplyArgument); 65 } 66 51 67 } // namespace CoreIPC 52 68 -
trunk/WebKit2/Platform/CoreIPC/MessageID.h
r68309 r68445 52 52 // Messages sent by the plug-in process to the UI process. 53 53 MessageClassPluginProcessProxy, 54 55 // Messages sent by the web process to the plug-in process. 56 MessageClassWebProcessConnection, 54 57 }; 55 58 -
trunk/WebKit2/PluginProcess/WebProcessConnection.cpp
r68350 r68445 68 68 } 69 69 70 void WebProcessConnection::createPlugin(uint64_t pluginInstanceID, const Plugin::Parameters&, bool& result) 71 { 72 } 70 73 71 74 } // namespace WebKit -
trunk/WebKit2/PluginProcess/WebProcessConnection.h
r68267 r68445 30 30 31 31 #include "Connection.h" 32 #include "Plugin.h" 32 33 #include <wtf/RefCounted.h> 33 34 … … 52 53 virtual void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::MessageID); 53 54 55 // Message handlers. 56 CoreIPC::SyncReplyMode didReceiveSyncWebProcessConnectionMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*); 57 void createPlugin(uint64_t pluginInstanceID, const Plugin::Parameters&, bool& result); 58 54 59 RefPtr<CoreIPC::Connection> m_connection; 55 60 }; -
trunk/WebKit2/Scripts/webkit2/messages.py
r68428 r68445 207 207 208 208 209 def forward_declarations (receiver):209 def forward_declarations_and_headers(receiver): 210 210 types_by_namespace = collections.defaultdict(set) 211 for parameter in receiver.iterparameters():212 type = parameter.type213 split = type.split('::')214 if len(split) != 2:215 continue216 namespace = split[0]217 inner_type = split[1]218 types_by_namespace[namespace].add(inner_type)219 return '\n'.join([forward_declarations_for_namespace(namespace, types) for (namespace, types) in sorted(types_by_namespace.iteritems())])220 221 222 def generate_messages_header(file):223 receiver = MessageReceiver.parse(file)224 header_guard = messages_header_filename(receiver).replace('.', '_')225 211 226 212 headers = set([ … … 229 215 ]) 230 216 217 for parameter in receiver.iterparameters(): 218 type = parameter.type 219 split = type.split('::') 220 221 if len(split) == 2: 222 namespace = split[0] 223 inner_type = split[1] 224 types_by_namespace[namespace].add(inner_type) 225 elif len(split) > 2: 226 # We probably have a nested struct, which means we can't forward declare it. 227 # Include its header instead. 228 headers.update(headers_for_type(type)) 229 230 forward_declarations = '\n'.join([forward_declarations_for_namespace(namespace, types) for (namespace, types) in sorted(types_by_namespace.iteritems())]) 231 headers = ['#include %s\n' % header for header in sorted(headers)] 232 233 return (forward_declarations, headers) 234 235 def generate_messages_header(file): 236 receiver = MessageReceiver.parse(file) 237 header_guard = messages_header_filename(receiver).replace('.', '_') 238 231 239 result = [] 232 240 … … 240 248 result.append('#if %s\n\n' % receiver.condition) 241 249 242 result += ['#include %s\n' % header for header in sorted(headers)] 243 result.append('\n') 244 245 result.append(forward_declarations(receiver)) 250 forward_declarations, headers = forward_declarations_and_headers(receiver) 251 252 result += headers 253 result.append('\n') 254 255 result.append(forward_declarations) 246 256 result.append('\n') 247 257 … … 300 310 def headers_for_type(type): 301 311 special_cases = { 302 'CoreIPC::MachPort': '"MachPort.h"',303 312 'WTF::String': '<wtf/text/WTFString.h>', 304 313 'WebKit::WebKeyboardEvent': '"WebEvent.h"', … … 313 322 # resolution operator (::). 314 323 split = type.split('::') 315 if len(split) !=2:324 if len(split) < 2: 316 325 return [] 317 if split[0] == 'WebKit' :326 if split[0] == 'WebKit' or split[0] == 'CoreIPC': 318 327 return ['"%s.h"' % split[1]] 319 328 return ['<%s/%s.h>' % tuple(split)] -
trunk/WebKit2/Scripts/webkit2/messages_unittest.py
r68428 r68445 61 61 SendInts(Vector<uint64_t> ints) 62 62 63 CreatePlugin(uint64_t pluginInstanceID, WebKit::Plugin::Parameters parameters) -> (bool result) 63 64 RunJavaScriptAlert(uint64_t frameID, WTF::String message) -> () 64 65 GetPlugins(bool refresh) -> (Vector<WebCore::PluginInfo> plugins) … … 123 124 'condition': None, 124 125 'base_class': 'CoreIPC::Arguments1<const Vector<uint64_t>&>', 126 }, 127 { 128 'name': 'CreatePlugin', 129 'parameters': ( 130 ('uint64_t', 'pluginInstanceID'), 131 ('WebKit::Plugin::Parameters', 'parameters') 132 ), 133 'reply_parameters': ( 134 ('bool', 'result'), 135 ), 136 'condition': None, 137 'base_class': 'CoreIPC::Arguments2<uint64_t, const WebKit::Plugin::Parameters&>', 138 'reply_base_class': 'CoreIPC::Arguments1<bool>', 125 139 }, 126 140 { … … 231 245 #include "Arguments.h" 232 246 #include "MessageID.h" 247 #include "Plugin.h" 233 248 234 249 namespace CoreIPC { … … 257 272 SendDoubleAndFloatID, 258 273 SendIntsID, 274 CreatePluginID, 259 275 RunJavaScriptAlertID, 260 276 GetPluginsID, … … 305 321 explicit SendInts(const Vector<uint64_t>& ints) 306 322 : CoreIPC::Arguments1<const Vector<uint64_t>&>(ints) 323 { 324 } 325 }; 326 327 struct CreatePlugin : CoreIPC::Arguments2<uint64_t, const WebKit::Plugin::Parameters&> { 328 static const Kind messageID = CreatePluginID; 329 typedef CoreIPC::Arguments1<bool&> Reply; 330 CreatePlugin(uint64_t pluginInstanceID, const WebKit::Plugin::Parameters& parameters) 331 : CoreIPC::Arguments2<uint64_t, const WebKit::Plugin::Parameters&>(pluginInstanceID, parameters) 307 332 { 308 333 } … … 392 417 #include "HandleMessage.h" 393 418 #include "MachPort.h" 419 #include "Plugin.h" 394 420 #include "WebCoreArgumentCoders.h" 395 421 #include "WebEvent.h" … … 434 460 { 435 461 switch (messageID.get<Messages::WebPage::Kind>()) { 462 case Messages::WebPage::CreatePluginID: 463 CoreIPC::handleMessage<Messages::WebPage::CreatePlugin>(arguments, reply, this, &WebPage::createPlugin); 464 return CoreIPC::AutomaticReply; 436 465 case Messages::WebPage::RunJavaScriptAlertID: 437 466 CoreIPC::handleMessage<Messages::WebPage::RunJavaScriptAlert>(arguments, reply, this, &WebPage::runJavaScriptAlert); -
trunk/WebKit2/WebKit2.xcodeproj/project.pbxproj
r68413 r68445 57 57 1A043DC1124FF87500FFBFB5 /* PluginProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A043DBF124FF87500FFBFB5 /* PluginProxy.h */; }; 58 58 1A043DC2124FF87500FFBFB5 /* PluginProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A043DC0124FF87500FFBFB5 /* PluginProxy.cpp */; }; 59 1A043F5A12514CF300FFBFB5 /* WebProcessConnection.messages.in in Resources */ = {isa = PBXBuildFile; fileRef = 1A043F5912514CF300FFBFB5 /* WebProcessConnection.messages.in */; }; 60 1A043F6912514D8B00FFBFB5 /* WebProcessConnectionMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A043F6712514D8B00FFBFB5 /* WebProcessConnectionMessageReceiver.cpp */; }; 61 1A043F6A12514D8B00FFBFB5 /* WebProcessConnectionMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A043F6812514D8B00FFBFB5 /* WebProcessConnectionMessages.h */; }; 59 62 1A0EC603124A9F2C007EF4A5 /* PluginProcessManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A0EC601124A9F2C007EF4A5 /* PluginProcessManager.h */; }; 60 63 1A0EC604124A9F2C007EF4A5 /* PluginProcessManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A0EC602124A9F2C007EF4A5 /* PluginProcessManager.cpp */; }; … … 476 479 1A043DBF124FF87500FFBFB5 /* PluginProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginProxy.h; sourceTree = "<group>"; }; 477 480 1A043DC0124FF87500FFBFB5 /* PluginProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginProxy.cpp; sourceTree = "<group>"; }; 481 1A043F5912514CF300FFBFB5 /* WebProcessConnection.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebProcessConnection.messages.in; sourceTree = "<group>"; }; 482 1A043F6712514D8B00FFBFB5 /* WebProcessConnectionMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebProcessConnectionMessageReceiver.cpp; path = /Users/andersca/Build/Debug/DerivedSources/WebKit2/WebProcessConnectionMessageReceiver.cpp; sourceTree = "<absolute>"; }; 483 1A043F6812514D8B00FFBFB5 /* WebProcessConnectionMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebProcessConnectionMessages.h; path = /Users/andersca/Build/Debug/DerivedSources/WebKit2/WebProcessConnectionMessages.h; sourceTree = "<absolute>"; }; 478 484 1A0EC601124A9F2C007EF4A5 /* PluginProcessManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginProcessManager.h; sourceTree = "<group>"; }; 479 485 1A0EC602124A9F2C007EF4A5 /* PluginProcessManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginProcessManager.cpp; sourceTree = "<group>"; }; … … 953 959 1A043A08124D11A900FFBFB5 /* WebProcessConnection.cpp */, 954 960 1A043A07124D11A900FFBFB5 /* WebProcessConnection.h */, 961 1A043F5912514CF300FFBFB5 /* WebProcessConnection.messages.in */, 955 962 ); 956 963 path = PluginProcess; … … 1640 1647 C0CE729E1247E71D00BC0EC4 /* WebPageMessageReceiver.cpp */, 1641 1648 C0CE729F1247E71D00BC0EC4 /* WebPageMessages.h */, 1649 1A043F6712514D8B00FFBFB5 /* WebProcessConnectionMessageReceiver.cpp */, 1650 1A043F6812514D8B00FFBFB5 /* WebProcessConnectionMessages.h */, 1642 1651 ); 1643 1652 name = "Derived Sources"; … … 1862 1871 BC40783D1250FADD0068F20A /* WKEvent.h in Headers */, 1863 1872 1A043DC1124FF87500FFBFB5 /* PluginProxy.h in Headers */, 1873 1A043F6A12514D8B00FFBFB5 /* WebProcessConnectionMessages.h in Headers */, 1864 1874 ); 1865 1875 runOnlyForDeploymentPostprocessing = 0; … … 1911 1921 buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "WebKit2" */; 1912 1922 compatibilityVersion = "Xcode 3.1"; 1923 developmentRegion = English; 1913 1924 hasScannedForEncodings = 1; 1914 1925 knownRegions = ( … … 1946 1957 8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */, 1947 1958 1A043B4D124D5E3600FFBFB5 /* PluginProcessProxy.messages.in in Resources */, 1959 1A043F5A12514CF300FFBFB5 /* WebProcessConnection.messages.in in Resources */, 1948 1960 ); 1949 1961 runOnlyForDeploymentPostprocessing = 0; … … 2147 2159 1A043D92124FF02B00FFBFB5 /* BackingStoreMac.mm in Sources */, 2148 2160 1A043DC2124FF87500FFBFB5 /* PluginProxy.cpp in Sources */, 2161 1A043F6912514D8B00FFBFB5 /* WebProcessConnectionMessageReceiver.cpp in Sources */, 2149 2162 ); 2150 2163 runOnlyForDeploymentPostprocessing = 0;
Note: See TracChangeset
for help on using the changeset viewer.