Changeset 85503 in webkit
- Timestamp:
- May 2, 2011 12:41:26 PM (13 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r85502 r85503 1 2011-05-02 Anders Carlsson <andersca@apple.com> 2 3 Reviewed by Adam Roben. 4 5 Need a way to handle CoreIPC messages on the connection work queue 6 https://bugs.webkit.org/show_bug.cgi?id=59954 7 8 Add a Connection::QueueClient abstract class. This class has a single pure virtual 9 member function, willProcessMessageOnClientRunLoop which should return true if the message 10 should be forwarded to the next Connection::QueueClient in the list or Connection::Client's 11 run loop for processing and false otherwise. Users of Connection can use addQueueClient to 12 add clients and all messages will be dispatched to the queue clients first. 13 14 * Platform/CoreIPC/Connection.cpp: 15 (CoreIPC::Connection::addQueueClient): 16 (CoreIPC::Connection::removeQueueClient): 17 (CoreIPC::Connection::processIncomingMessage): 18 * Platform/CoreIPC/Connection.h: 19 (CoreIPC::Connection::QueueClient::~QueueClient): 20 1 21 2011-05-02 Jeff Miller <jeffm@apple.com> 2 22 -
trunk/Source/WebKit2/Platform/CoreIPC/Connection.cpp
r85088 r85503 236 236 } 237 237 238 void Connection::addQueueClient(QueueClient* queueClient) 239 { 240 MutexLocker locker(m_connectionQueueClientsMutex); 241 ASSERT(!m_connectionQueueClients.contains(queueClient)); 242 243 m_connectionQueueClients.append(queueClient); 244 } 245 246 void Connection::removeQueueClient(QueueClient* queueClient) 247 { 248 MutexLocker locker(m_connectionQueueClientsMutex); 249 size_t index = m_connectionQueueClients.find(queueClient); 250 251 ASSERT(index != notFound); 252 m_connectionQueueClients.remove(index); 253 } 254 238 255 void Connection::setDidCloseOnConnectionWorkQueueCallback(DidCloseOnConnectionWorkQueueCallback callback) 239 256 { … … 518 535 } 519 536 537 // Hand off the message to the connection queue clients. 538 { 539 MutexLocker locker(m_connectionQueueClientsMutex); 540 541 for (size_t i = 0; i < m_connectionQueueClients.size(); ++i) { 542 if (!m_connectionQueueClients[i]->willProcessMessageOnClientRunLoop(this, incomingMessage.messageID(), incomingMessage.arguments())) { 543 // A connection queue client handled the message, our work here is done. 544 incomingMessage.releaseArguments(); 545 return; 546 } 547 } 548 } 549 520 550 enqueueIncomingMessage(incomingMessage); 521 551 } -
trunk/Source/WebKit2/Platform/CoreIPC/Connection.h
r84293 r85503 79 79 public: 80 80 class MessageReceiver { 81 protected:82 virtual ~MessageReceiver() { }83 84 81 public: 85 82 virtual void didReceiveMessage(Connection*, MessageID, ArgumentDecoder*) = 0; 86 83 virtual SyncReplyMode didReceiveSyncMessage(Connection*, MessageID, ArgumentDecoder*, ArgumentEncoder*) { ASSERT_NOT_REACHED(); return AutomaticReply; } 84 85 protected: 86 virtual ~MessageReceiver() { } 87 87 }; 88 88 89 89 class Client : public MessageReceiver { 90 protected:91 virtual ~Client() { }92 93 90 public: 94 91 virtual void didClose(Connection*) = 0; … … 99 96 virtual Vector<HWND> windowsToReceiveSentMessagesWhileWaitingForSyncReply() = 0; 100 97 #endif 98 99 protected: 100 virtual ~Client() { } 101 }; 102 103 class QueueClient { 104 public: 105 virtual bool willProcessMessageOnClientRunLoop(Connection*, MessageID, ArgumentDecoder*) = 0; 106 107 protected: 108 virtual ~QueueClient() { } 101 109 }; 102 110 … … 130 138 typedef void (*DidCloseOnConnectionWorkQueueCallback)(WorkQueue&, Connection*); 131 139 void setDidCloseOnConnectionWorkQueueCallback(DidCloseOnConnectionWorkQueueCallback callback); 132 140 141 void addQueueClient(QueueClient*); 142 void removeQueueClient(QueueClient*); 143 133 144 bool open(); 134 145 void invalidate(); … … 234 245 WorkQueue m_connectionQueue; 235 246 RunLoop* m_clientRunLoop; 247 248 Mutex m_connectionQueueClientsMutex; 249 Vector<QueueClient*> m_connectionQueueClients; 236 250 237 251 unsigned m_inDispatchMessageCount;
Note: See TracChangeset
for help on using the changeset viewer.