Changeset 259847 in webkit
- Timestamp:
- Apr 9, 2020, 10:48:35 PM (6 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 12 edited
-
ChangeLog (modified) (1 diff)
-
Platform/IPC/ArgumentCoder.h (modified) (2 diffs)
-
Platform/IPC/ArgumentCoders.cpp (modified) (10 diffs)
-
Platform/IPC/ArgumentCoders.h (modified) (31 diffs)
-
Platform/IPC/Attachment.h (modified) (1 diff)
-
Platform/IPC/DataReference.h (modified) (1 diff)
-
Platform/IPC/Decoder.h (modified) (4 diffs)
-
Platform/IPC/FormDataReference.h (modified) (1 diff)
-
Platform/IPC/ImageDataReference.h (modified) (1 diff)
-
Platform/IPC/SharedBufferDataReference.h (modified) (1 diff)
-
Platform/IPC/StringReference.h (modified) (1 diff)
-
Platform/IPC/cocoa/MachPort.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r259845 r259847 1 2020-04-09 David Kilzer <ddkilzer@apple.com> 2 3 Add WARN_UNUSED_RETURN to decode methods in Source/WebKit/Platform/IPC 4 <https://webkit.org/b/210316> 5 6 Reviewed by Alex Christensen. 7 8 * Platform/IPC/ArgumentCoder.h: 9 * Platform/IPC/ArgumentCoders.cpp: 10 (IPC::ArgumentCoder<WallTime>::decode): 11 (IPC::ArgumentCoder<AtomString>::decode): 12 (IPC::ArgumentCoder<CString>::decode): 13 (IPC::ArgumentCoder<String>::decode): 14 (IPC::ArgumentCoder<SHA1::Digest>::decode): 15 (IPC::ArgumentCoder<audit_token_t>::decode): 16 (IPC::ArgumentCoder<Monostate>::decode): 17 * Platform/IPC/ArgumentCoders.h: 18 (IPC::SimpleArgumentCoder::decode): 19 (IPC::ArgumentCoder<OptionSet<T>>::decode): 20 (IPC::ArgumentCoder<Optional<T>>::decode): 21 (IPC::ArgumentCoder<Box<T>>::decode): 22 (IPC::TupleDecoderImpl::decode): 23 (IPC::TupleDecoderImpl<Type>::decode): 24 (IPC::TupleDecoder::decode): 25 (IPC::TupleDecoder<0>::decode): 26 (IPC::VariantCoder::decode): 27 * Platform/IPC/Attachment.h: 28 * Platform/IPC/DataReference.h: 29 * Platform/IPC/Decoder.h: 30 (IPC::Decoder::decodeEnum): 31 * Platform/IPC/FormDataReference.h: 32 (IPC::FormDataReference::decode): 33 * Platform/IPC/ImageDataReference.h: 34 (IPC::ImageDataReference::decode): 35 * Platform/IPC/SharedBufferDataReference.h: 36 (IPC::SharedBufferDataReference::decode): 37 * Platform/IPC/StringReference.h: 38 * Platform/IPC/cocoa/MachPort.h: 39 (IPC::MachPort::decode): 40 1 41 2020-04-09 Alex Christensen <achristensen@webkit.org> 2 42 -
trunk/Source/WebKit/Platform/IPC/ArgumentCoder.h
r243460 r259847 100 100 } 101 101 102 template<typename U = T, std::enable_if_t<UsesLegacyDecoder<U>::argumentCoderValue>* = nullptr> 102 template<typename U = T, std::enable_if_t<UsesLegacyDecoder<U>::argumentCoderValue>* = nullptr> WARN_UNUSED_RETURN 103 103 static bool decode(Decoder& decoder, U& u) 104 104 { … … 106 106 } 107 107 108 template<typename U = T, std::enable_if_t<UsesModernDecoder<U>::argumentCoderValue>* = nullptr> 108 template<typename U = T, std::enable_if_t<UsesModernDecoder<U>::argumentCoderValue>* = nullptr> WARN_UNUSED_RETURN 109 109 static Optional<U> decode(Decoder& decoder) 110 110 { -
trunk/Source/WebKit/Platform/IPC/ArgumentCoders.cpp
r258118 r259847 38 38 } 39 39 40 bool ArgumentCoder<WallTime>::decode(Decoder& decoder, WallTime& time)40 WARN_UNUSED_RETURN bool ArgumentCoder<WallTime>::decode(Decoder& decoder, WallTime& time) 41 41 { 42 42 double value; … … 48 48 } 49 49 50 Optional<WallTime> ArgumentCoder<WallTime>::decode(Decoder& decoder)50 WARN_UNUSED_RETURN Optional<WallTime> ArgumentCoder<WallTime>::decode(Decoder& decoder) 51 51 { 52 52 Optional<double> time; … … 62 62 } 63 63 64 bool ArgumentCoder<AtomString>::decode(Decoder& decoder, AtomString& atomString)64 WARN_UNUSED_RETURN bool ArgumentCoder<AtomString>::decode(Decoder& decoder, AtomString& atomString) 65 65 { 66 66 String string; … … 85 85 } 86 86 87 bool ArgumentCoder<CString>::decode(Decoder& decoder, CString& result)87 WARN_UNUSED_RETURN bool ArgumentCoder<CString>::decode(Decoder& decoder, CString& result) 88 88 { 89 89 uint32_t length; … … 132 132 } 133 133 134 template <typename CharacterType> 134 template <typename CharacterType> WARN_UNUSED_RETURN 135 135 static inline Optional<String> decodeStringText(Decoder& decoder, uint32_t length) 136 136 { … … 149 149 } 150 150 151 Optional<String> ArgumentCoder<String>::decode(Decoder& decoder)151 WARN_UNUSED_RETURN Optional<String> ArgumentCoder<String>::decode(Decoder& decoder) 152 152 { 153 153 uint32_t length; … … 169 169 } 170 170 171 bool ArgumentCoder<String>::decode(Decoder& decoder, String& result)171 WARN_UNUSED_RETURN bool ArgumentCoder<String>::decode(Decoder& decoder, String& result) 172 172 { 173 173 Optional<String> string; … … 184 184 } 185 185 186 bool ArgumentCoder<SHA1::Digest>::decode(Decoder& decoder, SHA1::Digest& digest)186 WARN_UNUSED_RETURN bool ArgumentCoder<SHA1::Digest>::decode(Decoder& decoder, SHA1::Digest& digest) 187 187 { 188 188 return decoder.decodeFixedLengthData(digest.data(), sizeof(digest), 1); … … 196 196 } 197 197 198 bool ArgumentCoder<audit_token_t>::decode(Decoder& decoder, audit_token_t& auditToken)198 WARN_UNUSED_RETURN bool ArgumentCoder<audit_token_t>::decode(Decoder& decoder, audit_token_t& auditToken) 199 199 { 200 200 for (unsigned i = 0; i < WTF_ARRAY_LENGTH(auditToken.val); i++) { … … 210 210 } 211 211 212 Optional<Monostate> ArgumentCoder<Monostate>::decode(Decoder&)212 WARN_UNUSED_RETURN Optional<Monostate> ArgumentCoder<Monostate>::decode(Decoder&) 213 213 { 214 214 return Monostate { }; -
trunk/Source/WebKit/Platform/IPC/ArgumentCoders.h
r259833 r259847 47 47 } 48 48 49 static bool decode(Decoder& decoder, T& t)49 static WARN_UNUSED_RETURN bool decode(Decoder& decoder, T& t) 50 50 { 51 51 return decoder.decodeFixedLengthData(reinterpret_cast<uint8_t*>(&t), sizeof(T), alignof(T)); … … 59 59 } 60 60 61 static bool decode(Decoder& decoder, OptionSet<T>& optionSet)61 static WARN_UNUSED_RETURN bool decode(Decoder& decoder, OptionSet<T>& optionSet) 62 62 { 63 63 uint64_t value; … … 69 69 } 70 70 71 static Optional<OptionSet<T>> decode(Decoder& decoder)71 static WARN_UNUSED_RETURN Optional<OptionSet<T>> decode(Decoder& decoder) 72 72 { 73 73 Optional<uint64_t> value; … … 91 91 } 92 92 93 static bool decode(Decoder& decoder, Optional<T>& optional)93 static WARN_UNUSED_RETURN bool decode(Decoder& decoder, Optional<T>& optional) 94 94 { 95 95 bool isEngaged; … … 110 110 } 111 111 112 static Optional<Optional<T>> decode(Decoder& decoder)112 static WARN_UNUSED_RETURN Optional<Optional<T>> decode(Decoder& decoder) 113 113 { 114 114 Optional<bool> isEngaged; … … 139 139 } 140 140 141 static bool decode(Decoder& decoder, Box<T>& box)141 static WARN_UNUSED_RETURN bool decode(Decoder& decoder, Box<T>& box) 142 142 { 143 143 bool isEngaged; … … 158 158 } 159 159 160 static Optional<Box<T>> decode(Decoder& decoder)160 static WARN_UNUSED_RETURN Optional<Box<T>> decode(Decoder& decoder) 161 161 { 162 162 Optional<bool> isEngaged; … … 181 181 } 182 182 183 static bool decode(Decoder& decoder, std::pair<T, U>& pair)183 static WARN_UNUSED_RETURN bool decode(Decoder& decoder, std::pair<T, U>& pair) 184 184 { 185 185 T first; … … 196 196 } 197 197 198 static Optional<std::pair<T, U>> decode(Decoder& decoder)198 static WARN_UNUSED_RETURN Optional<std::pair<T, U>> decode(Decoder& decoder) 199 199 { 200 200 Optional<T> first; … … 242 242 template<typename Type, typename... Types> 243 243 struct TupleDecoderImpl { 244 static Optional<std::tuple<Type, Types...>> decode(Decoder& decoder)244 static WARN_UNUSED_RETURN Optional<std::tuple<Type, Types...>> decode(Decoder& decoder) 245 245 { 246 246 Optional<Type> optional; … … 259 259 template<typename Type> 260 260 struct TupleDecoderImpl<Type> { 261 static Optional<std::tuple<Type>> decode(Decoder& decoder)261 static WARN_UNUSED_RETURN Optional<std::tuple<Type>> decode(Decoder& decoder) 262 262 { 263 263 Optional<Type> optional; … … 271 271 template<size_t size, typename... Elements> 272 272 struct TupleDecoder { 273 static Optional<std::tuple<Elements...>> decode(Decoder& decoder)273 static WARN_UNUSED_RETURN Optional<std::tuple<Elements...>> decode(Decoder& decoder) 274 274 { 275 275 return TupleDecoderImpl<Elements...>::decode(decoder); … … 279 279 template<> 280 280 struct TupleDecoder<0> { 281 static Optional<std::tuple<>> decode(Decoder&)281 static WARN_UNUSED_RETURN Optional<std::tuple<>> decode(Decoder&) 282 282 { 283 283 return std::make_tuple(); … … 291 291 } 292 292 293 static Optional<std::tuple<Elements...>> decode(Decoder& decoder)293 static WARN_UNUSED_RETURN Optional<std::tuple<Elements...>> decode(Decoder& decoder) 294 294 { 295 295 return TupleDecoder<sizeof...(Elements), Elements...>::decode(decoder); … … 303 303 } 304 304 305 static bool decode(Decoder& decoder, WTF::KeyValuePair<KeyType, ValueType>& pair)305 static WARN_UNUSED_RETURN bool decode(Decoder& decoder, WTF::KeyValuePair<KeyType, ValueType>& pair) 306 306 { 307 307 KeyType key; … … 329 329 } 330 330 331 static bool decode(Decoder& decoder, Vector<T, inlineCapacity, OverflowHandler, minCapacity>& vector)331 static WARN_UNUSED_RETURN bool decode(Decoder& decoder, Vector<T, inlineCapacity, OverflowHandler, minCapacity>& vector) 332 332 { 333 333 Optional<Vector<T, inlineCapacity, OverflowHandler, minCapacity>> optional; … … 339 339 } 340 340 341 static Optional<Vector<T, inlineCapacity, OverflowHandler, minCapacity>> decode(Decoder& decoder)341 static WARN_UNUSED_RETURN Optional<Vector<T, inlineCapacity, OverflowHandler, minCapacity>> decode(Decoder& decoder) 342 342 { 343 343 uint64_t size; … … 365 365 } 366 366 367 static bool decode(Decoder& decoder, Vector<T, inlineCapacity, OverflowHandler, minCapacity>& vector)367 static WARN_UNUSED_RETURN bool decode(Decoder& decoder, Vector<T, inlineCapacity, OverflowHandler, minCapacity>& vector) 368 368 { 369 369 uint64_t decodedSize; … … 400 400 } 401 401 402 static Optional<Vector<T, inlineCapacity, OverflowHandler, minCapacity>> decode(Decoder& decoder)402 static WARN_UNUSED_RETURN Optional<Vector<T, inlineCapacity, OverflowHandler, minCapacity>> decode(Decoder& decoder) 403 403 { 404 404 uint64_t decodedSize; … … 447 447 } 448 448 449 static Optional<HashMapType> decode(Decoder& decoder)449 static WARN_UNUSED_RETURN Optional<HashMapType> decode(Decoder& decoder) 450 450 { 451 451 uint32_t hashMapSize; … … 480 480 } 481 481 482 static bool decode(Decoder& decoder, HashMapType& hashMap)482 static WARN_UNUSED_RETURN bool decode(Decoder& decoder, HashMapType& hashMap) 483 483 { 484 484 Optional<HashMapType> tempHashMap; … … 501 501 } 502 502 503 static bool decode(Decoder& decoder, HashSetType& hashSet)503 static WARN_UNUSED_RETURN bool decode(Decoder& decoder, HashSetType& hashSet) 504 504 { 505 505 Optional<HashSetType> tempHashSet; … … 512 512 } 513 513 514 static Optional<HashSetType> decode(Decoder& decoder)514 static WARN_UNUSED_RETURN Optional<HashSetType> decode(Decoder& decoder) 515 515 { 516 516 uint64_t hashSetSize; … … 554 554 } 555 555 556 static bool decode(Decoder& decoder, HashCountedSetType& hashCountedSet)556 static WARN_UNUSED_RETURN bool decode(Decoder& decoder, HashCountedSetType& hashCountedSet) 557 557 { 558 558 uint64_t hashCountedSetSize; … … 599 599 } 600 600 601 static Optional<Expected<ValueType, ErrorType>> decode(Decoder& decoder)601 static WARN_UNUSED_RETURN Optional<Expected<ValueType, ErrorType>> decode(Decoder& decoder) 602 602 { 603 603 Optional<bool> hasValue; … … 634 634 } 635 635 636 static Optional<WTF::Variant<Types...>> decode(Decoder& decoder, unsigned i)636 static WARN_UNUSED_RETURN Optional<WTF::Variant<Types...>> decode(Decoder& decoder, unsigned i) 637 637 { 638 638 if (i == index) { … … 655 655 } 656 656 657 static Optional<WTF::Variant<Types...>> decode(Decoder& decoder, unsigned i)657 static WARN_UNUSED_RETURN Optional<WTF::Variant<Types...>> decode(Decoder& decoder, unsigned i) 658 658 { 659 659 ASSERT_UNUSED(i, !i); … … 674 674 } 675 675 676 static Optional<WTF::Variant<Types...>> decode(Decoder& decoder)676 static WARN_UNUSED_RETURN Optional<WTF::Variant<Types...>> decode(Decoder& decoder) 677 677 { 678 678 Optional<unsigned> i; … … 686 686 template<> struct ArgumentCoder<WallTime> { 687 687 static void encode(Encoder&, const WallTime&); 688 static bool decode(Decoder&, WallTime&) ;689 static Optional<WallTime> decode(Decoder&) ;688 static bool decode(Decoder&, WallTime&) WARN_UNUSED_RETURN; 689 static Optional<WallTime> decode(Decoder&) WARN_UNUSED_RETURN; 690 690 }; 691 691 692 692 template<> struct ArgumentCoder<AtomString> { 693 693 static void encode(Encoder&, const AtomString&); 694 static bool decode(Decoder&, AtomString&) ;694 static bool decode(Decoder&, AtomString&) WARN_UNUSED_RETURN; 695 695 }; 696 696 697 697 template<> struct ArgumentCoder<CString> { 698 698 static void encode(Encoder&, const CString&); 699 static bool decode(Decoder&, CString&) ;699 static bool decode(Decoder&, CString&) WARN_UNUSED_RETURN; 700 700 }; 701 701 702 702 template<> struct ArgumentCoder<String> { 703 703 static void encode(Encoder&, const String&); 704 static bool decode(Decoder&, String&) ;705 static Optional<String> decode(Decoder&) ;704 static bool decode(Decoder&, String&) WARN_UNUSED_RETURN; 705 static Optional<String> decode(Decoder&) WARN_UNUSED_RETURN; 706 706 }; 707 707 708 708 template<> struct ArgumentCoder<SHA1::Digest> { 709 709 static void encode(Encoder&, const SHA1::Digest&); 710 static bool decode(Decoder&, SHA1::Digest&) ;710 static bool decode(Decoder&, SHA1::Digest&) WARN_UNUSED_RETURN; 711 711 }; 712 712 … … 714 714 template<> struct ArgumentCoder<audit_token_t> { 715 715 static void encode(Encoder&, const audit_token_t&); 716 static bool decode(Decoder&, audit_token_t&) ;716 static bool decode(Decoder&, audit_token_t&) WARN_UNUSED_RETURN; 717 717 }; 718 718 #endif … … 720 720 template<> struct ArgumentCoder<Monostate> { 721 721 static void encode(Encoder&, const Monostate&); 722 static Optional<Monostate> decode(Decoder&) ;722 static Optional<Monostate> decode(Decoder&) WARN_UNUSED_RETURN; 723 723 }; 724 724 -
trunk/Source/WebKit/Platform/IPC/Attachment.h
r254836 r259847 87 87 88 88 void encode(Encoder&) const; 89 static bool decode(Decoder&, Attachment&) ;89 static bool decode(Decoder&, Attachment&) WARN_UNUSED_RETURN; 90 90 91 91 private: -
trunk/Source/WebKit/Platform/IPC/DataReference.h
r235951 r259847 69 69 70 70 void encode(Encoder&) const; 71 static bool decode(Decoder&, DataReference&) ;71 static bool decode(Decoder&, DataReference&) WARN_UNUSED_RETURN; 72 72 73 73 private: -
trunk/Source/WebKit/Platform/IPC/Decoder.h
r259845 r259847 82 82 83 83 // The data in the data reference here will only be valid for the lifetime of the ArgumentDecoder object. 84 bool decodeVariableLengthByteArray(DataReference&) ;85 86 bool decode(bool&) ;84 bool decodeVariableLengthByteArray(DataReference&) WARN_UNUSED_RETURN; 85 86 bool decode(bool&) WARN_UNUSED_RETURN; 87 87 Decoder& operator>>(Optional<bool>&); 88 bool decode(uint8_t&) ;88 bool decode(uint8_t&) WARN_UNUSED_RETURN; 89 89 Decoder& operator>>(Optional<uint8_t>&); 90 bool decode(uint16_t&) ;90 bool decode(uint16_t&) WARN_UNUSED_RETURN; 91 91 Decoder& operator>>(Optional<uint16_t>&); 92 bool decode(uint32_t&) ;92 bool decode(uint32_t&) WARN_UNUSED_RETURN; 93 93 Decoder& operator>>(Optional<uint32_t>&); 94 bool decode(uint64_t&) ;94 bool decode(uint64_t&) WARN_UNUSED_RETURN; 95 95 Decoder& operator>>(Optional<uint64_t>&); 96 bool decode(int16_t&) ;96 bool decode(int16_t&) WARN_UNUSED_RETURN; 97 97 Decoder& operator>>(Optional<int16_t>&); 98 bool decode(int32_t&) ;98 bool decode(int32_t&) WARN_UNUSED_RETURN; 99 99 Decoder& operator>>(Optional<int32_t>&); 100 bool decode(int64_t&) ;100 bool decode(int64_t&) WARN_UNUSED_RETURN; 101 101 Decoder& operator>>(Optional<int64_t>&); 102 bool decode(float&) ;102 bool decode(float&) WARN_UNUSED_RETURN; 103 103 Decoder& operator>>(Optional<float>&); 104 bool decode(double&) ;104 bool decode(double&) WARN_UNUSED_RETURN; 105 105 Decoder& operator>>(Optional<double>&); 106 106 107 template<typename E, typename = std::enable_if_t<std::is_enum<E>::value>> 107 template<typename E, typename = std::enable_if_t<std::is_enum<E>::value>> WARN_UNUSED_RETURN 108 108 bool decode(E& e) 109 109 { … … 128 128 } 129 129 130 template<typename T> bool decodeEnum(T& result) 130 template<typename T> WARN_UNUSED_RETURN 131 bool decodeEnum(T& result) 131 132 { 132 133 typename std::underlying_type<T>::type value; … … 149 150 } 150 151 151 template<typename T, std::enable_if_t<!std::is_enum<T>::value && UsesLegacyDecoder<T>::value>* = nullptr> 152 template<typename T, std::enable_if_t<!std::is_enum<T>::value && UsesLegacyDecoder<T>::value>* = nullptr> WARN_UNUSED_RETURN 152 153 bool decode(T& t) 153 154 { … … 155 156 } 156 157 157 template<typename T, std::enable_if_t<!std::is_enum<T>::value && !UsesLegacyDecoder<T>::value>* = nullptr> 158 template<typename T, std::enable_if_t<!std::is_enum<T>::value && !UsesLegacyDecoder<T>::value>* = nullptr> WARN_UNUSED_RETURN 158 159 bool decode(T& t) 159 160 { -
trunk/Source/WebKit/Platform/IPC/FormDataReference.h
r248139 r259847 68 68 } 69 69 70 static Optional<FormDataReference> decode(Decoder& decoder)70 static WARN_UNUSED_RETURN Optional<FormDataReference> decode(Decoder& decoder) 71 71 { 72 72 Optional<bool> hasFormData; -
trunk/Source/WebKit/Platform/IPC/ImageDataReference.h
r258069 r259847 47 47 } 48 48 49 static Optional<ImageDataReference> decode(Decoder& decoder)49 static WARN_UNUSED_RETURN Optional<ImageDataReference> decode(Decoder& decoder) 50 50 { 51 51 Optional<RefPtr<WebCore::ImageData>> imageData; -
trunk/Source/WebKit/Platform/IPC/SharedBufferDataReference.h
r257667 r259847 54 54 } 55 55 56 static Optional<SharedBufferDataReference> decode(Decoder& decoder)56 static WARN_UNUSED_RETURN Optional<SharedBufferDataReference> decode(Decoder& decoder) 57 57 { 58 58 Optional<RefPtr<WebCore::SharedBuffer>> buffer; -
trunk/Source/WebKit/Platform/IPC/StringReference.h
r254924 r259847 65 65 66 66 void encode(Encoder&) const; 67 static bool decode(Decoder&, StringReference&) ;67 static bool decode(Decoder&, StringReference&) WARN_UNUSED_RETURN; 68 68 69 69 struct Hash { -
trunk/Source/WebKit/Platform/IPC/cocoa/MachPort.h
r245021 r259847 51 51 } 52 52 53 static bool decode(Decoder& decoder, MachPort& p)53 static WARN_UNUSED_RETURN bool decode(Decoder& decoder, MachPort& p) 54 54 { 55 55 Attachment attachment;
Note:
See TracChangeset
for help on using the changeset viewer.