Changeset 260704 in webkit
- Timestamp:
- Apr 25, 2020 8:46:47 AM (4 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r260696 r260704 1 2020-04-25 David Kilzer <ddkilzer@apple.com> 2 3 IPC::Decoder::isInvalid() should be renamed to isValid() 4 <https://webkit.org/b/211000> 5 6 Reviewed by Darin Adler. 7 8 Negative logic is more difficult to reason about than positive 9 logic. 10 11 * Platform/IPC/Connection.cpp: 12 (IPC::Connection::dispatchMessage): 13 (IPC::Connection::dispatchWorkQueueMessageReceiverMessage): 14 (IPC::Connection::dispatchThreadMessageReceiverMessage): 15 (IPC::Connection::dispatchSyncMessage): 16 * Platform/IPC/Connection.h: 17 (IPC::Connection::sendWithAsyncReply): 18 * Platform/IPC/Decoder.cpp: 19 (IPC::Decoder::create): 20 * Platform/IPC/Decoder.h: 21 (IPC::Decoder::isValid const): Rename from isInvalid() 22 and invert logic. 23 (IPC::Decoder::isInvalid const): Rename to isValid(). 24 * Platform/IPC/MessageSender.h: 25 * UIProcess/AuxiliaryProcessProxy.h: 26 (WebKit::AuxiliaryProcessProxy::sendWithAsyncReply): 27 - Change Decoder::isInvalid() to Decoder::isValid() and reverse 28 the Boolean logic. 29 1 30 2020-04-25 Diego Pino Garcia <dpino@igalia.com> 2 31 -
trunk/Source/WebKit/Platform/IPC/Connection.cpp
r257688 r260704 356 356 357 357 // FIXME: If the message was invalid, we should send back a SyncMessageError. 358 ASSERT( !decoder.isInvalid());358 ASSERT(decoder.isValid()); 359 359 360 360 if (replyEncoder) … … 400 400 401 401 // FIXME: If the message was invalid, we should send back a SyncMessageError. 402 ASSERT( !decoder.isInvalid());402 ASSERT(decoder.isValid()); 403 403 404 404 if (replyEncoder) … … 931 931 932 932 // FIXME: If the message was invalid, we should send back a SyncMessageError. 933 ASSERT( !decoder.isInvalid());933 ASSERT(decoder.isValid()); 934 934 935 935 if (replyEncoder) … … 1077 1077 dispatchMessage(*message); 1078 1078 1079 m_didReceiveInvalidMessage |= message->isInvalid();1079 m_didReceiveInvalidMessage |= !message->isValid(); 1080 1080 m_inDispatchMessageCount--; 1081 1081 -
trunk/Source/WebKit/Platform/IPC/Connection.h
r259047 r260704 484 484 sendMessage(WTFMove(encoder), sendOptions); 485 485 addAsyncReplyHandler(*this, listenerID, [completionHandler = WTFMove(completionHandler)] (Decoder* decoder) mutable { 486 if (decoder && !decoder->isInvalid())486 if (decoder && decoder->isValid()) 487 487 T::callReply(*decoder, WTFMove(completionHandler)); 488 488 else -
trunk/Source/WebKit/Platform/IPC/Decoder.cpp
r260666 r260704 49 49 { 50 50 auto decoder = makeUnique<Decoder>(buffer, bufferSize, bufferDeallocator, WTFMove(attachments)); 51 return decoder->is Invalid() ? nullptr : WTFMove(decoder);51 return decoder->isValid() ? WTFMove(decoder) : nullptr; 52 52 } 53 53 -
trunk/Source/WebKit/Platform/IPC/Decoder.h
r260666 r260704 72 72 size_t length() const { return m_bufferEnd - m_buffer; } 73 73 74 bool is Invalid() const74 bool isValid() const 75 75 { 76 76 // (m_bufferPos == m_bufferEnd) is a valid state for decoding if the last parameter 77 77 // is a variable length byte array and its size == 0. 78 return m_bufferPos < m_buffer || m_bufferPos >m_bufferEnd;78 return m_bufferPos >= m_buffer && m_bufferPos <= m_bufferEnd; 79 79 } 80 80 void markInvalid() { m_bufferPos = nullptr; } -
trunk/Source/WebKit/Platform/IPC/MessageSender.h
r258069 r260704 94 94 encoder->encode(message.arguments()); 95 95 sendMessage(WTFMove(encoder), sendOptions, {{ [completionHandler = WTFMove(completionHandler)] (IPC::Decoder* decoder) mutable { 96 if (decoder && !decoder->isInvalid())96 if (decoder && decoder->isValid()) 97 97 T::callReply(*decoder, WTFMove(completionHandler)); 98 98 else -
trunk/Source/WebKit/UIProcess/AuxiliaryProcessProxy.h
r254569 r260704 180 180 encoder->encode(message.arguments()); 181 181 sendMessage(WTFMove(encoder), sendOptions, {{ [completionHandler = WTFMove(completionHandler)] (IPC::Decoder* decoder) mutable { 182 if (decoder && !decoder->isInvalid())182 if (decoder && decoder->isValid()) 183 183 T::callReply(*decoder, WTFMove(completionHandler)); 184 184 else
Note: See TracChangeset
for help on using the changeset viewer.