Changeset 136762 in webkit
- Timestamp:
- Dec 5, 2012, 2:16:44 PM (13 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r136760 r136762 1 2012-12-05 Anders Carlsson <andersca@apple.com> 2 3 Connection::waitForMessage shouldn't use the message ID 4 https://bugs.webkit.org/show_bug.cgi?id=104157 5 6 Reviewed by Andreas Kling. 7 8 Pass the message receiver name and message name to waitForMessage and use them for lookups instead of 9 the message ID. 10 11 * Platform/CoreIPC/Connection.cpp: 12 (CoreIPC::Connection::createSyncMessageEncoder): 13 (CoreIPC::Connection::waitForMessage): 14 (CoreIPC::Connection::processIncomingMessage): 15 * Platform/CoreIPC/Connection.h: 16 (CoreIPC::Connection::waitForAndDispatchImmediately): 17 1 18 2012-12-05 Jae Hyun Park <jae.park@company100.net> 2 19 -
trunk/Source/WebKit2/Platform/CoreIPC/Connection.cpp
r133045 r136762 284 284 } 285 285 286 PassOwnPtr<MessageEncoder> Connection::createSyncMessageEncoder( const StringReference messageReceiverName, constStringReference messageName, uint64_t destinationID, uint64_t& syncRequestID)286 PassOwnPtr<MessageEncoder> Connection::createSyncMessageEncoder(StringReference messageReceiverName, StringReference messageName, uint64_t destinationID, uint64_t& syncRequestID) 287 287 { 288 288 OwnPtr<MessageEncoder> encoder = MessageEncoder::create(messageReceiverName, messageName, destinationID); … … 320 320 } 321 321 322 PassOwnPtr<MessageDecoder> Connection::waitForMessage( MessageID messageID, uint64_t destinationID, double timeout)322 PassOwnPtr<MessageDecoder> Connection::waitForMessage(StringReference messageReceiverName, StringReference messageName, uint64_t destinationID, double timeout) 323 323 { 324 324 // First, check if this message is already in the incoming messages queue. … … 329 329 IncomingMessage& message = *it; 330 330 331 if (message. messageID() == messageID&& message.arguments()->destinationID() == destinationID) {331 if (message.arguments()->messageReceiverName() == messageReceiverName && message.arguments()->messageName() == messageName && message.arguments()->destinationID() == destinationID) { 332 332 OwnPtr<MessageDecoder> decoder = message.releaseArguments(); 333 333 … … 337 337 } 338 338 } 339 339 340 340 double absoluteTime = currentTime() + timeout; 341 341 342 std::pair< unsigned, uint64_t> messageAndDestination(std::make_pair(messageID.toInt(), destinationID));342 std::pair<std::pair<StringReference, StringReference>, uint64_t> messageAndDestination(std::make_pair(std::make_pair(messageReceiverName, messageName), destinationID)); 343 343 344 344 { … … 349 349 350 350 // Insert our pending wait. 351 m_waitForMessageMap.set(messageAndDestination, 0);351 m_waitForMessageMap.set(messageAndDestination, nullptr); 352 352 } 353 353 … … 356 356 MutexLocker locker(m_waitForMessageMutex); 357 357 358 HashMap<std::pair< unsigned, uint64_t>, MessageDecoder*>::iterator it = m_waitForMessageMap.find(messageAndDestination);358 HashMap<std::pair<std::pair<StringReference, StringReference>, uint64_t>, OwnPtr<MessageDecoder> >::iterator it = m_waitForMessageMap.find(messageAndDestination); 359 359 if (it->value) { 360 // FIXME: m_waitForMessageMap should really hold OwnPtrs to 361 // ArgumentDecoders, but HashMap doesn't currently support OwnPtrs. 362 OwnPtr<MessageDecoder> decoder = adoptPtr(it->value); 360 OwnPtr<MessageDecoder> decoder = it->value.release(); 363 361 m_waitForMessageMap.remove(it); 364 362 365 363 return decoder.release(); 366 364 } … … 374 372 } 375 373 } 376 374 377 375 return nullptr; 378 376 } … … 524 522 { 525 523 MutexLocker locker(m_waitForMessageMutex); 526 527 HashMap<std::pair< unsigned, uint64_t>, MessageDecoder*>::iterator it = m_waitForMessageMap.find(std::make_pair(messageID.toInt(), incomingMessage.destinationID()));524 525 HashMap<std::pair<std::pair<StringReference, StringReference>, uint64_t>, OwnPtr<MessageDecoder> >::iterator it = m_waitForMessageMap.find(std::make_pair(std::make_pair(incomingMessage.arguments()->messageReceiverName(), incomingMessage.arguments()->messageName()), incomingMessage.destinationID())); 528 526 if (it != m_waitForMessageMap.end()) { 529 it->value = incomingMessage.releaseArguments() .leakPtr();527 it->value = incomingMessage.releaseArguments(); 530 528 ASSERT(it->value); 531 529 -
trunk/Source/WebKit2/Platform/CoreIPC/Connection.h
r133045 r136762 243 243 bool isValid() const { return m_client; } 244 244 245 PassOwnPtr<MessageDecoder> waitForMessage( MessageID, uint64_t destinationID, double timeout);245 PassOwnPtr<MessageDecoder> waitForMessage(StringReference messageReceiverName, StringReference messageName, uint64_t destinationID, double timeout); 246 246 247 247 PassOwnPtr<MessageDecoder> waitForSyncReply(uint64_t syncRequestID, double timeout, unsigned syncSendFlags); … … 301 301 ThreadCondition m_waitForMessageCondition; 302 302 Mutex m_waitForMessageMutex; 303 HashMap<std::pair< unsigned, uint64_t>, MessageDecoder*> m_waitForMessageMap;303 HashMap<std::pair<std::pair<StringReference, StringReference>, uint64_t>, OwnPtr<MessageDecoder> > m_waitForMessageMap; 304 304 305 305 // Represents a sync request for which we're waiting on a reply. … … 427 427 template<typename T> bool Connection::waitForAndDispatchImmediately(uint64_t destinationID, double timeout) 428 428 { 429 OwnPtr<MessageDecoder> decoder = waitForMessage( MessageID(T::messageID), destinationID, timeout);429 OwnPtr<MessageDecoder> decoder = waitForMessage(T::receiverName(), T::name(), destinationID, timeout); 430 430 if (!decoder) 431 431 return false;
Note:
See TracChangeset
for help on using the changeset viewer.