Changeset 142763 in webkit
- Timestamp:
- Feb 13, 2013 11:18:43 AM (11 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r142762 r142763 1 2013-02-13 Anders Carlsson <andersca@apple.com> 2 3 Make SecItemShimProxy be a WorkQueueMessageReceiver 4 https://bugs.webkit.org/show_bug.cgi?id=109719 5 6 Reviewed by Sam Weinig. 7 8 This adds a WantsConnection message attribute to be used for messages whose handlers 9 should take the connection the message was delivered to. 10 11 * Platform/CoreIPC/HandleMessage.h: 12 (CoreIPC::handleMessage): 13 Add new handleMessage overload. 14 15 * Scripts/webkit2/messages.py: 16 (async_message_statement): 17 (generate_message_handler): 18 Handle the WantsMessage attribute. 19 20 * UIProcess/mac/SecItemShimProxy.cpp: 21 (WebKit::SecItemShimProxy::shared): 22 Use dispatch_once and adoptRef. 23 24 (WebKit::SecItemShimProxy::SecItemShimProxy): 25 Initialize the queue. 26 27 (WebKit::SecItemShimProxy::initializeConnection): 28 Add the proxy as a work queue message receiver. 29 30 (WebKit::SecItemShimProxy::secItemRequest): 31 This no longer needs to call out to a dispatch queue, it's already on a queue. 32 33 * UIProcess/mac/SecItemShimProxy.messages.in: 34 This doesn't need to be a legacy receiver. Also, add the WantsConnection message. 35 1 36 2013-02-13 Sheriff Bot <webkit.review.bot@gmail.com> 2 37 -
trunk/Source/WebKit2/Platform/CoreIPC/HandleMessage.h
r141648 r142763 342 342 343 343 template<typename T, typename C, typename MF> 344 void handleMessage(Connection* connection, MessageDecoder& decoder, C* object, MF function) 345 { 346 typename T::DecodeType::ValueType arguments; 347 if (!decoder.decode(arguments)) 348 return; 349 callMemberFunction(connection, arguments, object, function); 350 } 351 352 template<typename T, typename C, typename MF> 344 353 void handleMessageOnConnectionQueue(Connection* connection, MessageDecoder& decoder, C* object, MF function) 345 354 { -
trunk/Source/WebKit2/Scripts/webkit2/messages.py
r142690 r142763 25 25 from webkit2 import parser 26 26 27 WANTS_CONNECTION_ATTRIBUTE = 'WantsConnection' 27 28 LEGACY_RECEIVER_ATTRIBUTE = 'LegacyReceiver' 28 29 DELAYED_ATTRIBUTE = 'Delayed' … … 316 317 def async_message_statement(receiver, message): 317 318 dispatch_function_args = ['decoder', 'this', '&%s' % handler_function(receiver, message)] 319 318 320 dispatch_function = 'handleMessage' 319 321 if message.has_attribute(VARIADIC_ATTRIBUTE): 320 322 dispatch_function += 'Variadic' 323 324 if message.has_attribute(WANTS_CONNECTION_ATTRIBUTE): 325 dispatch_function_args.insert(0, 'connection') 321 326 322 327 result = [] … … 553 558 result.append('void %s::didReceive%sMessage(CoreIPC::Connection*, CoreIPC::MessageDecoder& decoder)\n' % (receiver.name, receiver.name)) 554 559 else: 555 result.append('void %s::didReceiveMessage(CoreIPC::Connection* , CoreIPC::MessageDecoder& decoder)\n' % (receiver.name))560 result.append('void %s::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageDecoder& decoder)\n' % (receiver.name)) 556 561 557 562 result.append('{\n') -
trunk/Source/WebKit2/UIProcess/mac/SecItemShimProxy.cpp
r142656 r142763 39 39 SecItemShimProxy& SecItemShimProxy::shared() 40 40 { 41 AtomicallyInitializedStatic(SecItemShimProxy*, proxy = new SecItemShimProxy); 41 static SecItemShimProxy* proxy; 42 static dispatch_once_t once; 43 dispatch_once(&once, ^{ 44 proxy = adoptRef(new SecItemShimProxy).leakRef(); 45 }); 42 46 return *proxy; 43 47 } 44 48 45 49 SecItemShimProxy::SecItemShimProxy() 50 : m_queue(WorkQueue::create("com.apple.WebKit.SecItemShimProxy")) 46 51 { 47 52 } … … 49 54 void SecItemShimProxy::initializeConnection(CoreIPC::Connection* connection) 50 55 { 51 connection->add QueueClient(this);56 connection->addWorkQueueMessageReceiver(Messages::SecItemShimProxy::messageReceiverName(), m_queue.get(), this); 52 57 } 53 58 54 static void handleSecItemRequest(CoreIPC::Connection* connection, uint64_t requestID, const SecItemRequestData& request)59 void SecItemShimProxy::secItemRequest(CoreIPC::Connection* connection, uint64_t requestID, const SecItemRequestData& request) 55 60 { 56 61 SecItemResponseData response; … … 91 96 } 92 97 93 static void dispatchFunctionOnQueue(dispatch_queue_t queue, const Function<void ()>& function)94 {95 #if COMPILER(CLANG)96 dispatch_async(queue, function);97 #else98 Function<void ()>* functionPtr = new Function<void ()>(function);99 dispatch_async(queue, ^{100 (*functionPtr)();101 delete functionPtr;102 });103 #endif104 }105 106 void SecItemShimProxy::secItemRequest(CoreIPC::Connection* connection, uint64_t requestID, const SecItemRequestData& request)107 {108 // Since we don't want the connection work queue to be held up, we do all109 // keychain interaction work on a global dispatch queue.110 dispatch_queue_t keychainWorkQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);111 dispatchFunctionOnQueue(keychainWorkQueue, bind(handleSecItemRequest, RefPtr<CoreIPC::Connection>(connection), requestID, request));112 }113 114 void SecItemShimProxy::didReceiveMessageOnConnectionWorkQueue(CoreIPC::Connection* connection, OwnPtr<CoreIPC::MessageDecoder>& decoder)115 {116 if (decoder->messageReceiverName() == Messages::SecItemShimProxy::messageReceiverName()) {117 didReceiveSecItemShimProxyMessageOnConnectionWorkQueue(connection, decoder);118 return;119 }120 }121 122 void SecItemShimProxy::didCloseOnConnectionWorkQueue(CoreIPC::Connection*)123 {124 }125 126 98 } // namespace WebKit 127 99 -
trunk/Source/WebKit2/UIProcess/mac/SecItemShimProxy.h
r142656 r142763 35 35 class SecItemRequestData; 36 36 37 class SecItemShimProxy : p rivate CoreIPC::Connection::QueueClient{37 class SecItemShimProxy : public CoreIPC::Connection::WorkQueueMessageReceiver { 38 38 WTF_MAKE_NONCOPYABLE(SecItemShimProxy); 39 39 public: … … 45 45 SecItemShimProxy(); 46 46 47 // CoreIPC::Connection::QueueClient 48 virtual void didReceiveMessageOnConnectionWorkQueue(CoreIPC::Connection*, OwnPtr<CoreIPC::MessageDecoder>&) OVERRIDE; 49 virtual void didCloseOnConnectionWorkQueue(CoreIPC::Connection*) OVERRIDE; 50 51 // Implemented in generated SecItemShimProxyMessageReceiver.cpp. 52 void didReceiveSecItemShimProxyMessageOnConnectionWorkQueue(CoreIPC::Connection*, OwnPtr<CoreIPC::MessageDecoder>&); 47 // CoreIPC::Connection::WorkQueueMessageReceiver 48 virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageDecoder&) OVERRIDE; 53 49 54 50 void secItemRequest(CoreIPC::Connection*, uint64_t requestID, const SecItemRequestData&); 51 52 RefPtr<WorkQueue> m_queue; 55 53 }; 56 54 -
trunk/Source/WebKit2/UIProcess/mac/SecItemShimProxy.messages.in
r140605 r142763 21 21 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22 22 23 messages -> SecItemShimProxy LegacyReceiver{23 messages -> SecItemShimProxy { 24 24 25 25 #if USE(SECURITY_FRAMEWORK) 26 SecItemRequest(uint64_t requestID, WebKit::SecItemRequestData request) DispatchOnConnectionQueue26 SecItemRequest(uint64_t requestID, WebKit::SecItemRequestData request) WantsConnection 27 27 #endif 28 28
Note: See TracChangeset
for help on using the changeset viewer.