Changeset 70833 in webkit
- Timestamp:
- Oct 28, 2010 6:29:35 PM (13 years ago)
- Location:
- trunk/WebKit2
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit2/ChangeLog
r70828 r70833 1 2010-10-28 Anders Carlsson <andersca@apple.com> 2 3 Reviewed by Adam Roben. 4 5 Move code to dispatch a sync message out into a separate function 6 https://bugs.webkit.org/show_bug.cgi?id=48605 7 8 * Platform/CoreIPC/Connection.cpp: 9 (CoreIPC::Connection::dispatchSyncMessage): 10 Factor code out from dispatchMessage. Handle receiving a message with an invalid reply ID. 11 12 (CoreIPC::Connection::dispatchMessages): 13 Call dispatchSyncMessage. 14 15 * Platform/CoreIPC/Connection.h: 16 1 17 2010-10-28 Anders Carlsson <andersca@apple.com> 2 18 -
trunk/WebKit2/Platform/CoreIPC/Connection.cpp
r70085 r70833 313 313 } 314 314 315 void Connection::dispatchSyncMessage(MessageID messageID, ArgumentDecoder* arguments) 316 { 317 ASSERT(messageID.isSync()); 318 319 // Decode the sync request ID. 320 uint64_t syncRequestID = 0; 321 322 if (!arguments->decodeUInt64(syncRequestID) || !syncRequestID) { 323 // We received an invalid sync message. 324 arguments->markInvalid(); 325 return; 326 } 327 328 // Create our reply encoder. 329 ArgumentEncoder* replyEncoder = new ArgumentEncoder(syncRequestID); 330 331 // Hand off both the decoder and encoder to the client.. 332 SyncReplyMode syncReplyMode = m_client->didReceiveSyncMessage(this, messageID, arguments, replyEncoder); 333 334 // FIXME: If the message was invalid, we should send back a SyncMessageError. 335 ASSERT(!arguments->isInvalid()); 336 337 if (syncReplyMode == ManualReply) { 338 // The client will take ownership of the reply encoder and send it at some point in the future. 339 // We won't do anything here. 340 return; 341 } 342 343 // Send the reply. 344 sendSyncReply(replyEncoder); 345 } 346 315 347 void Connection::dispatchMessages() 316 348 { … … 331 363 OwnPtr<ArgumentDecoder> arguments = message.releaseArguments(); 332 364 333 if (message.messageID().isSync()) { 334 // Decode the sync request ID. 335 uint64_t syncRequestID = 0; 336 337 if (!arguments->decodeUInt64(syncRequestID)) { 338 // FIXME: Handle this case. 339 ASSERT_NOT_REACHED(); 340 } 341 342 // Create our reply encoder. 343 ArgumentEncoder* replyEncoder = new ArgumentEncoder(syncRequestID); 344 345 // Hand off both the decoder and encoder to the client.. 346 SyncReplyMode syncReplyMode = m_client->didReceiveSyncMessage(this, message.messageID(), arguments.get(), replyEncoder); 347 348 // FIXME: If the message was invalid, we should send back a SyncMessageError. 349 ASSERT(!arguments->isInvalid()); 350 351 if (syncReplyMode == AutomaticReply) { 352 // Send the reply. 353 sendSyncReply(replyEncoder); 354 } else { 355 // The client will take ownership of the reply encoder and send it at some point in the future. 356 // We won't do anything here. 357 } 358 } else 365 if (message.messageID().isSync()) 366 dispatchSyncMessage(message.messageID(), arguments.get()); 367 else 359 368 m_client->didReceiveMessage(this, message.messageID(), arguments.get()); 360 369 -
trunk/WebKit2/Platform/CoreIPC/Connection.h
r70085 r70833 169 169 void dispatchConnectionDidClose(); 170 170 void dispatchMessages(); 171 171 void dispatchSyncMessage(MessageID, ArgumentDecoder*); 172 172 173 Client* m_client; 173 174 bool m_isServer;
Note: See TracChangeset
for help on using the changeset viewer.