Changeset 210502 in webkit
- Timestamp:
- Jan 9, 2017, 4:43:49 AM (8 years ago)
- Location:
- trunk/Source
- Files:
-
- 1 added
- 17 edited
- 2 copied
- 5 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r210496 r210502 1 2017-01-08 Antti Koivisto <antti@apple.com> 2 3 Move cache coders to WTF 4 https://bugs.webkit.org/show_bug.cgi?id=166825 5 6 Rubber-stamped by Sam Weinig. 7 8 Make it possible to use robust serialization of WTF types on the lower levels of the stack. 9 10 * WTF.xcodeproj/project.pbxproj: 11 * wtf/persistence: Added. 12 * wtf/persistence/Coder.h: Copied from Source/WebKit2/NetworkProcess/cache/NetworkCacheCoder.h. 13 (WebKit::NetworkCache::Coder::encode): Deleted. 14 (WebKit::NetworkCache::Coder::decode): Deleted. 15 * wtf/persistence/Coders.cpp: Copied from Source/WebKit2/NetworkProcess/cache/NetworkCacheCoders.cpp. 16 (WebKit::NetworkCache::Coder<AtomicString>::encode): Deleted. 17 (WebKit::NetworkCache::Coder<AtomicString>::decode): Deleted. 18 (WebKit::NetworkCache::Coder<CString>::encode): Deleted. 19 (WebKit::NetworkCache::Coder<CString>::decode): Deleted. 20 (WebKit::NetworkCache::Coder<String>::encode): Deleted. 21 (WebKit::NetworkCache::decodeStringText): Deleted. 22 (WebKit::NetworkCache::Coder<String>::decode): Deleted. 23 (WebKit::NetworkCache::Coder<SHA1::Digest>::encode): Deleted. 24 (WebKit::NetworkCache::Coder<SHA1::Digest>::decode): Deleted. 25 (WebKit::NetworkCache::Coder<WebCore::HTTPHeaderMap>::encode): Deleted. 26 (WebKit::NetworkCache::Coder<WebCore::HTTPHeaderMap>::decode): Deleted. 27 * wtf/persistence/Coders.h: Copied from Source/WebKit2/NetworkProcess/cache/NetworkCacheCoders.h. 28 (WebKit::NetworkCache::Coder<std::optional<T>>::encode): Deleted. 29 (WebKit::NetworkCache::Coder<std::optional<T>>::decode): Deleted. 30 * wtf/persistence/Decoder.cpp: Copied from Source/WebKit2/NetworkProcess/cache/NetworkCacheDecoder.cpp. 31 (WebKit::NetworkCache::Decoder::Decoder): Deleted. 32 (WebKit::NetworkCache::Decoder::~Decoder): Deleted. 33 (WebKit::NetworkCache::Decoder::bufferIsLargeEnoughToContain): Deleted. 34 (WebKit::NetworkCache::Decoder::decodeFixedLengthData): Deleted. 35 (WebKit::NetworkCache::Decoder::decodeNumber): Deleted. 36 (WebKit::NetworkCache::Decoder::decode): Deleted. 37 (WebKit::NetworkCache::Decoder::verifyChecksum): Deleted. 38 * wtf/persistence/Decoder.h: Copied from Source/WebKit2/NetworkProcess/cache/NetworkCacheDecoder.h. 39 (WebKit::NetworkCache::Decoder::length): Deleted. 40 (WebKit::NetworkCache::Decoder::currentOffset): Deleted. 41 (WebKit::NetworkCache::Decoder::decodeEnum): Deleted. 42 (WebKit::NetworkCache::Decoder::decode): Deleted. 43 (WebKit::NetworkCache::Decoder::bufferIsLargeEnoughToContain): Deleted. 44 * wtf/persistence/Encoder.cpp: Copied from Source/WebKit2/NetworkProcess/cache/NetworkCacheEncoder.cpp. 45 (WebKit::NetworkCache::Encoder::Encoder): Deleted. 46 (WebKit::NetworkCache::Encoder::~Encoder): Deleted. 47 (WebKit::NetworkCache::Encoder::grow): Deleted. 48 (WebKit::NetworkCache::Encoder::updateChecksumForData): Deleted. 49 (WebKit::NetworkCache::Encoder::encodeFixedLengthData): Deleted. 50 (WebKit::NetworkCache::Encoder::encodeNumber): Deleted. 51 (WebKit::NetworkCache::Encoder::encode): Deleted. 52 (WebKit::NetworkCache::Encoder::encodeChecksum): Deleted. 53 * wtf/persistence/Encoder.h: Copied from Source/WebKit2/NetworkProcess/cache/NetworkCacheEncoder.h. 54 (WebKit::NetworkCache::Encoder::encodeEnum): Deleted. 55 (WebKit::NetworkCache::Encoder::encode): Deleted. 56 (WebKit::NetworkCache::Encoder::operator<<): Deleted. 57 (WebKit::NetworkCache::Encoder::buffer): Deleted. 58 (WebKit::NetworkCache::Encoder::bufferSize): Deleted. 59 (WebKit::NetworkCache::Encoder::updateChecksumForNumber): Deleted. 60 1 61 2017-01-08 Konstantin Tokarev <annulen@yandex.ru> 2 62 -
trunk/Source/WTF/WTF.xcodeproj/project.pbxproj
r209896 r210502 354 354 E15556F518A0CC18006F48FB /* CryptographicUtilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E15556F318A0CC18006F48FB /* CryptographicUtilities.cpp */; }; 355 355 E15556F618A0CC18006F48FB /* CryptographicUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = E15556F418A0CC18006F48FB /* CryptographicUtilities.h */; }; 356 E43A46951E228B9100276B05 /* Decoder.h in Headers */ = {isa = PBXBuildFile; fileRef = E43A46901E228B9100276B05 /* Decoder.h */; }; 357 E43A46961E228B9100276B05 /* Encoder.h in Headers */ = {isa = PBXBuildFile; fileRef = E43A46911E228B9100276B05 /* Encoder.h */; }; 358 E43A46971E228B9100276B05 /* Decoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E43A46921E228B9100276B05 /* Decoder.cpp */; }; 359 E43A46981E228B9100276B05 /* Encoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E43A46931E228B9100276B05 /* Encoder.cpp */; }; 360 E43A46991E228B9100276B05 /* Coder.h in Headers */ = {isa = PBXBuildFile; fileRef = E43A46941E228B9100276B05 /* Coder.h */; }; 361 E43A469B1E228FB200276B05 /* Coders.h in Headers */ = {isa = PBXBuildFile; fileRef = E43A469A1E228FB200276B05 /* Coders.h */; }; 362 E43A469D1E228FD500276B05 /* Coders.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E43A469C1E228FD500276B05 /* Coders.cpp */; }; 356 363 E4A0AD391A96245500536DF6 /* WorkQueue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4A0AD371A96245500536DF6 /* WorkQueue.cpp */; }; 357 364 E4A0AD3A1A96245500536DF6 /* WorkQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = E4A0AD381A96245500536DF6 /* WorkQueue.h */; }; … … 726 733 E15556F318A0CC18006F48FB /* CryptographicUtilities.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CryptographicUtilities.cpp; sourceTree = "<group>"; }; 727 734 E15556F418A0CC18006F48FB /* CryptographicUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CryptographicUtilities.h; sourceTree = "<group>"; }; 735 E43A46901E228B9100276B05 /* Decoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Decoder.h; sourceTree = "<group>"; }; 736 E43A46911E228B9100276B05 /* Encoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Encoder.h; sourceTree = "<group>"; }; 737 E43A46921E228B9100276B05 /* Decoder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Decoder.cpp; sourceTree = "<group>"; }; 738 E43A46931E228B9100276B05 /* Encoder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Encoder.cpp; sourceTree = "<group>"; }; 739 E43A46941E228B9100276B05 /* Coder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Coder.h; sourceTree = "<group>"; }; 740 E43A469A1E228FB200276B05 /* Coders.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Coders.h; sourceTree = "<group>"; }; 741 E43A469C1E228FD500276B05 /* Coders.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Coders.cpp; sourceTree = "<group>"; }; 728 742 E4A0AD371A96245500536DF6 /* WorkQueue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WorkQueue.cpp; sourceTree = "<group>"; }; 729 743 E4A0AD381A96245500536DF6 /* WorkQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WorkQueue.h; sourceTree = "<group>"; }; … … 870 884 1FA47C87152502DA00568D1B /* ios */, 871 885 A8A472C4151A825A004123FF /* mac */, 886 E43A46851E228B5700276B05 /* persistence */, 872 887 CEF4820C19DA347600CC04B8 /* spi */, 873 888 A8A4731B151A825B004123FF /* text */, … … 1278 1293 sourceTree = "<group>"; 1279 1294 }; 1295 E43A46851E228B5700276B05 /* persistence */ = { 1296 isa = PBXGroup; 1297 children = ( 1298 E43A46941E228B9100276B05 /* Coder.h */, 1299 E43A469A1E228FB200276B05 /* Coders.h */, 1300 E43A469C1E228FD500276B05 /* Coders.cpp */, 1301 E43A46921E228B9100276B05 /* Decoder.cpp */, 1302 E43A46901E228B9100276B05 /* Decoder.h */, 1303 E43A46931E228B9100276B05 /* Encoder.cpp */, 1304 E43A46911E228B9100276B05 /* Encoder.h */, 1305 ); 1306 path = persistence; 1307 sourceTree = "<group>"; 1308 }; 1280 1309 E4A0AD3B1A96251900536DF6 /* cocoa */ = { 1281 1310 isa = PBXGroup; … … 1330 1359 EB95E1F0161A72410089A2F5 /* ByteOrder.h in Headers */, 1331 1360 A8A473AD151A825B004123FF /* cached-powers.h in Headers */, 1361 E43A469B1E228FB200276B05 /* Coders.h in Headers */, 1332 1362 DCEE21FB1CEA7538000C2396 /* CFBundleSPI.h in Headers */, 1333 1363 A8A4745E151A825B004123FF /* CharacterNames.h in Headers */, … … 1363 1393 A8A473A7151A825B004123FF /* DoublyLinkedList.h in Headers */, 1364 1394 A8A473BB151A825B004123FF /* dtoa.h in Headers */, 1395 E43A46961E228B9100276B05 /* Encoder.h in Headers */, 1365 1396 93DDE9321CDC052D00FD3491 /* dyldSPI.h in Headers */, 1366 1397 1AEA88E21D6BBCF400E5AD64 /* EnumTraits.h in Headers */, … … 1509 1540 A8A47455151A825B004123FF /* ThreadSpecific.h in Headers */, 1510 1541 0F66B2911DC97BAB004A1D3F /* TimeWithDynamicClockType.h in Headers */, 1542 E43A46951E228B9100276B05 /* Decoder.h in Headers */, 1511 1543 553071CA1C40427200384898 /* TinyLRUCache.h in Headers */, 1512 1544 0FED67B61B22D4D80066CE15 /* TinyPtrSet.h in Headers */, … … 1536 1568 A8A47487151A825B004123FF /* WTFThreadData.h in Headers */, 1537 1569 CE73E02519DCB7AB00580D5C /* XPCSPI.h in Headers */, 1570 E43A46991E228B9100276B05 /* Coder.h in Headers */, 1538 1571 ); 1539 1572 runOnlyForDeploymentPostprocessing = 0; … … 1694 1727 A8A4741A151A825B004123FF /* RefCountedLeakCounter.cpp in Sources */, 1695 1728 2CDED0F318115C85004DBA70 /* RunLoop.cpp in Sources */, 1729 E43A46981E228B9100276B05 /* Encoder.cpp in Sources */, 1696 1730 2CDED0EF18115C38004DBA70 /* RunLoopCF.cpp in Sources */, 1697 1731 1469419316EAAF6D0024E146 /* RunLoopTimerCF.cpp in Sources */, 1732 E43A469D1E228FD500276B05 /* Coders.cpp in Sources */, 1698 1733 1469419916EAB0410024E146 /* SchedulePairCF.cpp in Sources */, 1699 1734 1469419716EAAFF80024E146 /* SchedulePairMac.mm in Sources */, … … 1710 1745 A5BA15F51824348000A82E69 /* StringImplMac.mm in Sources */, 1711 1746 A5BA15F3182433A900A82E69 /* StringMac.mm in Sources */, 1747 E43A46971E228B9100276B05 /* Decoder.cpp in Sources */, 1712 1748 0FDDBFA71666DFA300C55FEF /* StringPrintStream.cpp in Sources */, 1713 1749 A8A47443151A825B004123FF /* StringStatics.cpp in Sources */, -
trunk/Source/WTF/wtf/CMakeLists.txt
r209808 r210502 241 241 dtoa/strtod.cc 242 242 243 persistence/Coders.cpp 244 persistence/Decoder.cpp 245 persistence/Encoder.cpp 246 243 247 text/AtomicString.cpp 244 248 text/AtomicStringImpl.cpp … … 269 273 "${WTF_DIR}/wtf" 270 274 "${WTF_DIR}/wtf/dtoa" 275 "${WTF_DIR}/wtf/persistence" 271 276 "${WTF_DIR}/wtf/text" 272 277 "${WTF_DIR}/wtf/text/icu" -
trunk/Source/WTF/wtf/persistence/Coder.h
r210330 r210502 24 24 */ 25 25 26 #ifndef NetworkCacheCoder_h 27 #define NetworkCacheCoder_h 26 #pragma once 28 27 29 #if ENABLE(NETWORK_CACHE) 30 31 namespace WebKit { 32 namespace NetworkCache { 28 namespace WTF { 29 namespace Persistence { 33 30 34 31 class Decoder; … … 49 46 } 50 47 } 51 52 #endif53 #endif -
trunk/Source/WTF/wtf/persistence/Coders.cpp
r210330 r210502 25 25 26 26 #include "config.h" 27 #include "NetworkCacheCoders.h" 28 29 #if ENABLE(NETWORK_CACHE) 27 #include "Coders.h" 30 28 31 29 #include <wtf/text/CString.h> 32 30 #include <wtf/text/WTFString.h> 33 31 34 namespace W ebKit{35 namespace NetworkCache {32 namespace WTF { 33 namespace Persistence { 36 34 37 35 void Coder<AtomicString>::encode(Encoder& encoder, const AtomicString& atomicString) … … 145 143 } 146 144 147 148 145 void Coder<SHA1::Digest>::encode(Encoder& encoder, const SHA1::Digest& digest) 149 146 { … … 156 153 } 157 154 158 // Store common HTTP headers as strings instead of using their value in the HTTPHeaderName enumeration159 // so that the headers stored in the cache stays valid even after HTTPHeaderName.in gets updated.160 void Coder<WebCore::HTTPHeaderMap>::encode(Encoder& encoder, const WebCore::HTTPHeaderMap& headers)161 {162 encoder << static_cast<uint64_t>(headers.size());163 for (auto& keyValue : headers) {164 encoder << keyValue.key;165 encoder << keyValue.value;166 }167 }168 169 bool Coder<WebCore::HTTPHeaderMap>::decode(Decoder& decoder, WebCore::HTTPHeaderMap& headers)170 {171 uint64_t headersSize;172 if (!decoder.decode(headersSize))173 return false;174 for (uint64_t i = 0; i < headersSize; ++i) {175 String name;176 if (!decoder.decode(name))177 return false;178 String value;179 if (!decoder.decode(value))180 return false;181 headers.add(name, value);182 }183 return true;184 }185 186 155 } 187 156 } 188 189 #endif -
trunk/Source/WTF/wtf/persistence/Coders.h
r210330 r210502 26 26 #pragma once 27 27 28 #if ENABLE(NETWORK_CACHE)29 30 #include "NetworkCacheDecoder.h"31 #include "NetworkCacheEncoder.h"32 #include <WebCore/CertificateInfo.h>33 #include <WebCore/HTTPHeaderMap.h>34 28 #include <utility> 35 29 #include <wtf/Forward.h> … … 38 32 #include <wtf/SHA1.h> 39 33 #include <wtf/Vector.h> 40 41 namespace WebKit { 42 namespace NetworkCache { 34 #include <wtf/persistence/Decoder.h> 35 #include <wtf/persistence/Encoder.h> 36 37 namespace WTF { 38 namespace Persistence { 43 39 44 40 template<typename T, typename U> struct Coder<std::pair<T, U>> { … … 267 263 268 264 template<> struct Coder<AtomicString> { 269 static void encode(Encoder&, const AtomicString&);270 static bool decode(Decoder&, AtomicString&);265 WTF_EXPORT_PRIVATE static void encode(Encoder&, const AtomicString&); 266 WTF_EXPORT_PRIVATE static bool decode(Decoder&, AtomicString&); 271 267 }; 272 268 273 269 template<> struct Coder<CString> { 274 static void encode(Encoder&, const CString&);275 static bool decode(Decoder&, CString&);270 WTF_EXPORT_PRIVATE static void encode(Encoder&, const CString&); 271 WTF_EXPORT_PRIVATE static bool decode(Decoder&, CString&); 276 272 }; 277 273 278 274 template<> struct Coder<String> { 279 static void encode(Encoder&, const String&); 280 static bool decode(Decoder&, String&); 281 }; 282 283 template<> struct Coder<WebCore::CertificateInfo> { 284 static void encode(Encoder&, const WebCore::CertificateInfo&); 285 static bool decode(Decoder&, WebCore::CertificateInfo&); 275 WTF_EXPORT_PRIVATE static void encode(Encoder&, const String&); 276 WTF_EXPORT_PRIVATE static bool decode(Decoder&, String&); 286 277 }; 287 278 288 279 template<> struct Coder<SHA1::Digest> { 289 static void encode(Encoder&, const SHA1::Digest&); 290 static bool decode(Decoder&, SHA1::Digest&); 291 }; 292 293 template<> struct Coder<WebCore::HTTPHeaderMap> { 294 static void encode(Encoder&, const WebCore::HTTPHeaderMap&); 295 static bool decode(Decoder&, WebCore::HTTPHeaderMap&); 280 WTF_EXPORT_PRIVATE static void encode(Encoder&, const SHA1::Digest&); 281 WTF_EXPORT_PRIVATE static bool decode(Decoder&, SHA1::Digest&); 296 282 }; 297 283 298 284 } 299 285 } 300 #endif -
trunk/Source/WTF/wtf/persistence/Decoder.cpp
r210330 r210502 25 25 26 26 #include "config.h" 27 #include " NetworkCacheDecoder.h"27 #include "Decoder.h" 28 28 29 #i f ENABLE(NETWORK_CACHE)29 #include <wtf/persistence/Encoder.h> 30 30 31 #include "NetworkCacheEncoder.h" 32 33 namespace WebKit { 34 namespace NetworkCache { 31 namespace WTF { 32 namespace Persistence { 35 33 36 34 Decoder::Decoder(const uint8_t* buffer, size_t bufferSize) … … 134 132 } 135 133 } 136 137 #endif -
trunk/Source/WTF/wtf/persistence/Decoder.h
r210330 r210502 24 24 */ 25 25 26 #ifndef NetworkCacheDecoder_h 27 #define NetworkCacheDecoder_h 26 #pragma once 28 27 29 #if ENABLE(NETWORK_CACHE) 28 #include <wtf/SHA1.h> 29 #include <wtf/persistence/Coder.h> 30 30 31 #include "NetworkCacheCoder.h" 32 #include <wtf/SHA1.h> 33 34 namespace WebKit { 35 namespace NetworkCache { 31 namespace WTF { 32 namespace Persistence { 36 33 37 34 class Decoder { 38 35 WTF_MAKE_FAST_ALLOCATED; 39 36 public: 40 Decoder(const uint8_t* buffer, size_t bufferSize);41 virtual~Decoder();37 WTF_EXPORT_PRIVATE Decoder(const uint8_t* buffer, size_t bufferSize); 38 WTF_EXPORT_PRIVATE ~Decoder(); 42 39 43 40 size_t length() const { return m_bufferEnd - m_buffer; } 44 41 size_t currentOffset() const { return m_bufferPosition - m_buffer; } 45 42 46 bool verifyChecksum();43 WTF_EXPORT_PRIVATE bool verifyChecksum(); 47 44 48 bool decodeFixedLengthData(uint8_t*, size_t);45 WTF_EXPORT_PRIVATE bool decodeFixedLengthData(uint8_t*, size_t); 49 46 50 bool decode(bool&);51 bool decode(uint8_t&);52 bool decode(uint16_t&);53 bool decode(uint32_t&);54 bool decode(uint64_t&);55 bool decode(int32_t&);56 bool decode(int64_t&);57 bool decode(float&);58 bool decode(double&);47 WTF_EXPORT_PRIVATE bool decode(bool&); 48 WTF_EXPORT_PRIVATE bool decode(uint8_t&); 49 WTF_EXPORT_PRIVATE bool decode(uint16_t&); 50 WTF_EXPORT_PRIVATE bool decode(uint32_t&); 51 WTF_EXPORT_PRIVATE bool decode(uint64_t&); 52 WTF_EXPORT_PRIVATE bool decode(int32_t&); 53 WTF_EXPORT_PRIVATE bool decode(int64_t&); 54 WTF_EXPORT_PRIVATE bool decode(float&); 55 WTF_EXPORT_PRIVATE bool decode(double&); 59 56 60 57 template<typename T> bool decodeEnum(T& result) … … 89 86 90 87 private: 91 bool bufferIsLargeEnoughToContain(size_t) const;88 WTF_EXPORT_PRIVATE bool bufferIsLargeEnoughToContain(size_t) const; 92 89 template<typename Type> bool decodeNumber(Type&); 93 90 … … 102 99 } 103 100 104 #endif105 #endif -
trunk/Source/WTF/wtf/persistence/Encoder.cpp
r210330 r210502 25 25 26 26 #include "config.h" 27 #include " NetworkCacheEncoder.h"27 #include "Encoder.h" 28 28 29 #i f ENABLE(NETWORK_CACHE)29 #include "SHA1.h" 30 30 31 namespace W ebKit{32 namespace NetworkCache {31 namespace WTF { 32 namespace Persistence { 33 33 34 34 Encoder::Encoder() … … 125 125 } 126 126 } 127 128 #endif -
trunk/Source/WTF/wtf/persistence/Encoder.h
r210330 r210502 24 24 */ 25 25 26 #ifndef NetworkCacheEncoder_h 27 #define NetworkCacheEncoder_h 26 #pragma once 28 27 29 #if ENABLE(NETWORK_CACHE)30 31 #include "NetworkCacheCoder.h"32 28 #include <wtf/SHA1.h> 33 29 #include <wtf/Vector.h> 30 #include <wtf/persistence/Coder.h> 34 31 35 namespace W ebKit{36 namespace NetworkCache {32 namespace WTF { 33 namespace Persistence { 37 34 38 35 class Encoder; … … 42 39 WTF_MAKE_FAST_ALLOCATED; 43 40 public: 44 Encoder();45 virtual~Encoder();41 WTF_EXPORT_PRIVATE Encoder(); 42 WTF_EXPORT_PRIVATE ~Encoder(); 46 43 47 void encodeChecksum();48 void encodeFixedLengthData(const uint8_t*, size_t);44 WTF_EXPORT_PRIVATE void encodeChecksum(); 45 WTF_EXPORT_PRIVATE void encodeFixedLengthData(const uint8_t*, size_t); 49 46 50 47 template<typename T> void encodeEnum(T t) … … 69 66 size_t bufferSize() const { return m_buffer.size(); } 70 67 71 static void updateChecksumForData(SHA1&, const uint8_t*, size_t);68 WTF_EXPORT_PRIVATE static void updateChecksumForData(SHA1&, const uint8_t*, size_t); 72 69 template <typename Type> static void updateChecksumForNumber(SHA1&, Type); 73 70 … … 75 72 76 73 private: 77 void encode(bool);78 void encode(uint8_t);79 void encode(uint16_t);80 void encode(uint32_t);81 void encode(uint64_t);82 void encode(int32_t);83 void encode(int64_t);84 void encode(float);85 void encode(double);74 WTF_EXPORT_PRIVATE void encode(bool); 75 WTF_EXPORT_PRIVATE void encode(uint8_t); 76 WTF_EXPORT_PRIVATE void encode(uint16_t); 77 WTF_EXPORT_PRIVATE void encode(uint32_t); 78 WTF_EXPORT_PRIVATE void encode(uint64_t); 79 WTF_EXPORT_PRIVATE void encode(int32_t); 80 WTF_EXPORT_PRIVATE void encode(int64_t); 81 WTF_EXPORT_PRIVATE void encode(float); 82 WTF_EXPORT_PRIVATE void encode(double); 86 83 87 84 template<typename Type> void encodeNumber(Type); … … 116 113 } 117 114 } 118 119 #endif120 #endif -
trunk/Source/WebKit2/CMakeLists.txt
r210374 r210502 111 111 NetworkProcess/cache/NetworkCacheCoders.cpp 112 112 NetworkProcess/cache/NetworkCacheData.cpp 113 NetworkProcess/cache/NetworkCacheDecoder.cpp114 NetworkProcess/cache/NetworkCacheEncoder.cpp115 113 NetworkProcess/cache/NetworkCacheEntry.cpp 116 114 NetworkProcess/cache/NetworkCacheFileSystem.cpp -
trunk/Source/WebKit2/ChangeLog
r210500 r210502 1 2017-01-08 Antti Koivisto <antti@apple.com> 2 3 Move cache coders to WTF 4 https://bugs.webkit.org/show_bug.cgi?id=166825 5 6 Rubber-stamped by Sam Weinig. 7 8 * NetworkProcess/cache/NetworkCache.h: 9 * NetworkProcess/cache/NetworkCacheCoder.h: Removed. 10 * NetworkProcess/cache/NetworkCacheCoders.cpp: 11 (WebKit::NetworkCache::Coder<AtomicString>::encode): Deleted. 12 (WebKit::NetworkCache::Coder<AtomicString>::decode): Deleted. 13 (WebKit::NetworkCache::Coder<CString>::encode): Deleted. 14 (WebKit::NetworkCache::Coder<CString>::decode): Deleted. 15 (WebKit::NetworkCache::Coder<String>::encode): Deleted. 16 (WebKit::NetworkCache::decodeStringText): Deleted. 17 (WebKit::NetworkCache::Coder<String>::decode): Deleted. 18 (WebKit::NetworkCache::Coder<SHA1::Digest>::encode): Deleted. 19 (WebKit::NetworkCache::Coder<SHA1::Digest>::decode): Deleted. 20 (WebKit::NetworkCache::Coder<WebCore::HTTPHeaderMap>::encode): Deleted. 21 (WebKit::NetworkCache::Coder<WebCore::HTTPHeaderMap>::decode): Deleted. 22 * NetworkProcess/cache/NetworkCacheCoders.h: 23 (): Deleted. 24 (WebKit::NetworkCache::Coder<std::optional<T>>::encode): Deleted. 25 (WebKit::NetworkCache::Coder<std::optional<T>>::decode): Deleted. 26 * NetworkProcess/cache/NetworkCacheCodersCocoa.cpp: 27 (WebKit::NetworkCache::encodeCFData): Deleted. 28 (WebKit::NetworkCache::decodeCFData): Deleted. 29 (WebKit::NetworkCache::encodeSecTrustRef): Deleted. 30 (WebKit::NetworkCache::decodeSecTrustRef): Deleted. 31 (WebKit::NetworkCache::encodeCertificateChain): Deleted. 32 (WebKit::NetworkCache::decodeCertificateChain): Deleted. 33 (WebKit::NetworkCache::Coder<WebCore::CertificateInfo>::encode): Deleted. 34 (WebKit::NetworkCache::Coder<WebCore::CertificateInfo>::decode): Deleted. 35 * NetworkProcess/cache/NetworkCacheDecoder.cpp: Removed. 36 * NetworkProcess/cache/NetworkCacheDecoder.h: Removed. 37 * NetworkProcess/cache/NetworkCacheEncoder.cpp: Removed. 38 * NetworkProcess/cache/NetworkCacheEncoder.h: Removed. 39 * NetworkProcess/cache/NetworkCacheEntry.cpp: 40 (WebKit::NetworkCache::Entry::encodeAsStorageRecord): 41 (WebKit::NetworkCache::Entry::decodeStorageRecord): 42 * NetworkProcess/cache/NetworkCacheKey.cpp: 43 (WebKit::NetworkCache::Key::encode): 44 (WebKit::NetworkCache::Key::decode): 45 * NetworkProcess/cache/NetworkCacheKey.h: 46 * NetworkProcess/cache/NetworkCacheStorage.cpp: 47 (WebKit::NetworkCache::decodeRecordMetaData): 48 (WebKit::NetworkCache::encodeRecordMetaData): 49 * NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp: 50 (WebKit::NetworkCache::SubresourceInfo::encode): 51 (WebKit::NetworkCache::SubresourceInfo::decode): 52 (WebKit::NetworkCache::SubresourcesEntry::encodeAsStorageRecord): 53 (WebKit::NetworkCache::SubresourcesEntry::decodeStorageRecord): 54 * NetworkProcess/cache/NetworkCacheSubresourcesEntry.h: 55 * UIProcess/API/APIUserContentExtensionStore.cpp: 56 (API::encodeContentExtensionMetaData): 57 (API::decodeContentExtensionMetaData): 58 * WebKit2.xcodeproj/project.pbxproj: 59 1 60 2017-01-09 Tomas Popela <tpopela@redhat.com> 2 61 -
trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheCoders.cpp
r203691 r210502 29 29 #if ENABLE(NETWORK_CACHE) 30 30 31 #include <wtf/text/CString.h> 32 #include <wtf/text/WTFString.h> 33 34 namespace WebKit { 35 namespace NetworkCache { 36 37 void Coder<AtomicString>::encode(Encoder& encoder, const AtomicString& atomicString) 38 { 39 encoder << atomicString.string(); 40 } 41 42 bool Coder<AtomicString>::decode(Decoder& decoder, AtomicString& atomicString) 43 { 44 String string; 45 if (!decoder.decode(string)) 46 return false; 47 48 atomicString = string; 49 return true; 50 } 51 52 void Coder<CString>::encode(Encoder& encoder, const CString& string) 53 { 54 // Special case the null string. 55 if (string.isNull()) { 56 encoder << std::numeric_limits<uint32_t>::max(); 57 return; 58 } 59 60 uint32_t length = string.length(); 61 encoder << length; 62 encoder.encodeFixedLengthData(reinterpret_cast<const uint8_t*>(string.data()), length); 63 } 64 65 bool Coder<CString>::decode(Decoder& decoder, CString& result) 66 { 67 uint32_t length; 68 if (!decoder.decode(length)) 69 return false; 70 71 if (length == std::numeric_limits<uint32_t>::max()) { 72 // This is the null string. 73 result = CString(); 74 return true; 75 } 76 77 // Before allocating the string, make sure that the decoder buffer is big enough. 78 if (!decoder.bufferIsLargeEnoughToContain<char>(length)) 79 return false; 80 81 char* buffer; 82 CString string = CString::newUninitialized(length, buffer); 83 if (!decoder.decodeFixedLengthData(reinterpret_cast<uint8_t*>(buffer), length)) 84 return false; 85 86 result = string; 87 return true; 88 } 89 90 91 void Coder<String>::encode(Encoder& encoder, const String& string) 92 { 93 // Special case the null string. 94 if (string.isNull()) { 95 encoder << std::numeric_limits<uint32_t>::max(); 96 return; 97 } 98 99 uint32_t length = string.length(); 100 bool is8Bit = string.is8Bit(); 101 102 encoder << length << is8Bit; 103 104 if (is8Bit) 105 encoder.encodeFixedLengthData(reinterpret_cast<const uint8_t*>(string.characters8()), length * sizeof(LChar)); 106 else 107 encoder.encodeFixedLengthData(reinterpret_cast<const uint8_t*>(string.characters16()), length * sizeof(UChar)); 108 } 109 110 template <typename CharacterType> 111 static inline bool decodeStringText(Decoder& decoder, uint32_t length, String& result) 112 { 113 // Before allocating the string, make sure that the decoder buffer is big enough. 114 if (!decoder.bufferIsLargeEnoughToContain<CharacterType>(length)) 115 return false; 116 117 CharacterType* buffer; 118 String string = String::createUninitialized(length, buffer); 119 if (!decoder.decodeFixedLengthData(reinterpret_cast<uint8_t*>(buffer), length * sizeof(CharacterType))) 120 return false; 121 122 result = string; 123 return true; 124 } 125 126 bool Coder<String>::decode(Decoder& decoder, String& result) 127 { 128 uint32_t length; 129 if (!decoder.decode(length)) 130 return false; 131 132 if (length == std::numeric_limits<uint32_t>::max()) { 133 // This is the null string. 134 result = String(); 135 return true; 136 } 137 138 bool is8Bit; 139 if (!decoder.decode(is8Bit)) 140 return false; 141 142 if (is8Bit) 143 return decodeStringText<LChar>(decoder, length, result); 144 return decodeStringText<UChar>(decoder, length, result); 145 } 146 147 148 void Coder<SHA1::Digest>::encode(Encoder& encoder, const SHA1::Digest& digest) 149 { 150 encoder.encodeFixedLengthData(digest.data(), sizeof(digest)); 151 } 152 153 bool Coder<SHA1::Digest>::decode(Decoder& decoder, SHA1::Digest& digest) 154 { 155 return decoder.decodeFixedLengthData(digest.data(), sizeof(digest)); 156 } 31 namespace WTF { 32 namespace Persistence { 157 33 158 34 // Store common HTTP headers as strings instead of using their value in the HTTPHeaderName enumeration -
trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheCoders.h
r208985 r210502 28 28 #if ENABLE(NETWORK_CACHE) 29 29 30 #include "NetworkCacheDecoder.h"31 #include "NetworkCacheEncoder.h"32 30 #include <WebCore/CertificateInfo.h> 33 31 #include <WebCore/HTTPHeaderMap.h> … … 38 36 #include <wtf/SHA1.h> 39 37 #include <wtf/Vector.h> 38 #include <wtf/persistence/Coders.h> 39 #include <wtf/persistence/Decoder.h> 40 #include <wtf/persistence/Encoder.h> 40 41 41 namespace WebKit { 42 namespace NetworkCache { 43 44 template<typename T, typename U> struct Coder<std::pair<T, U>> { 45 static void encode(Encoder& encoder, const std::pair<T, U>& pair) 46 { 47 encoder << pair.first << pair.second; 48 } 49 50 static bool decode(Decoder& decoder, std::pair<T, U>& pair) 51 { 52 T first; 53 if (!decoder.decode(first)) 54 return false; 55 56 U second; 57 if (!decoder.decode(second)) 58 return false; 59 60 pair.first = first; 61 pair.second = second; 62 return true; 63 } 64 }; 65 66 template<typename Rep, typename Period> struct Coder<std::chrono::duration<Rep, Period>> { 67 static void encode(Encoder& encoder, const std::chrono::duration<Rep, Period>& duration) 68 { 69 static_assert(std::is_integral<Rep>::value && std::is_signed<Rep>::value && sizeof(Rep) <= sizeof(int64_t), "Serialization of this Rep type is not supported yet. Only signed integer type which can be fit in an int64_t is currently supported."); 70 encoder << static_cast<int64_t>(duration.count()); 71 } 72 73 static bool decode(Decoder& decoder, std::chrono::duration<Rep, Period>& result) 74 { 75 int64_t count; 76 if (!decoder.decode(count)) 77 return false; 78 result = std::chrono::duration<Rep, Period>(static_cast<Rep>(count)); 79 return true; 80 } 81 }; 82 83 template<typename T> struct Coder<std::optional<T>> { 84 static void encode(Encoder& encoder, const std::optional<T>& optional) 85 { 86 if (!optional) { 87 encoder << false; 88 return; 89 } 90 91 encoder << true; 92 encoder << optional.value(); 93 } 94 95 static bool decode(Decoder& decoder, std::optional<T>& optional) 96 { 97 bool isEngaged; 98 if (!decoder.decode(isEngaged)) 99 return false; 100 101 if (!isEngaged) { 102 optional = std::nullopt; 103 return true; 104 } 105 106 T value; 107 if (!decoder.decode(value)) 108 return false; 109 110 optional = WTFMove(value); 111 return true; 112 } 113 }; 114 115 template<typename KeyType, typename ValueType> struct Coder<WTF::KeyValuePair<KeyType, ValueType>> { 116 static void encode(Encoder& encoder, const WTF::KeyValuePair<KeyType, ValueType>& pair) 117 { 118 encoder << pair.key << pair.value; 119 } 120 121 static bool decode(Decoder& decoder, WTF::KeyValuePair<KeyType, ValueType>& pair) 122 { 123 KeyType key; 124 if (!decoder.decode(key)) 125 return false; 126 127 ValueType value; 128 if (!decoder.decode(value)) 129 return false; 130 131 pair.key = key; 132 pair.value = value; 133 return true; 134 } 135 }; 136 137 template<bool fixedSizeElements, typename T, size_t inlineCapacity> struct VectorCoder; 138 139 template<typename T, size_t inlineCapacity> struct VectorCoder<false, T, inlineCapacity> { 140 static void encode(Encoder& encoder, const Vector<T, inlineCapacity>& vector) 141 { 142 encoder << static_cast<uint64_t>(vector.size()); 143 for (size_t i = 0; i < vector.size(); ++i) 144 encoder << vector[i]; 145 } 146 147 static bool decode(Decoder& decoder, Vector<T, inlineCapacity>& vector) 148 { 149 uint64_t size; 150 if (!decoder.decode(size)) 151 return false; 152 153 Vector<T, inlineCapacity> tmp; 154 for (size_t i = 0; i < size; ++i) { 155 T element; 156 if (!decoder.decode(element)) 157 return false; 158 159 tmp.append(WTFMove(element)); 160 } 161 162 tmp.shrinkToFit(); 163 vector.swap(tmp); 164 return true; 165 } 166 }; 167 168 template<typename T, size_t inlineCapacity> struct VectorCoder<true, T, inlineCapacity> { 169 static void encode(Encoder& encoder, const Vector<T, inlineCapacity>& vector) 170 { 171 encoder << static_cast<uint64_t>(vector.size()); 172 encoder.encodeFixedLengthData(reinterpret_cast<const uint8_t*>(vector.data()), vector.size() * sizeof(T), alignof(T)); 173 } 174 175 static bool decode(Decoder& decoder, Vector<T, inlineCapacity>& vector) 176 { 177 uint64_t size; 178 if (!decoder.decode(size)) 179 return false; 180 181 // Since we know the total size of the elements, we can allocate the vector in 182 // one fell swoop. Before allocating we must however make sure that the decoder buffer 183 // is big enough. 184 if (!decoder.bufferIsLargeEnoughToContain<T>(size)) 185 return false; 186 187 Vector<T, inlineCapacity> temp; 188 temp.resize(size); 189 190 decoder.decodeFixedLengthData(reinterpret_cast<uint8_t*>(temp.data()), size * sizeof(T)); 191 192 vector.swap(temp); 193 return true; 194 } 195 }; 196 197 template<typename T, size_t inlineCapacity> struct Coder<Vector<T, inlineCapacity>> : VectorCoder<std::is_arithmetic<T>::value, T, inlineCapacity> { }; 198 199 template<typename KeyArg, typename MappedArg, typename HashArg, typename KeyTraitsArg, typename MappedTraitsArg> struct Coder<HashMap<KeyArg, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg>> { 200 typedef HashMap<KeyArg, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg> HashMapType; 201 202 static void encode(Encoder& encoder, const HashMapType& hashMap) 203 { 204 encoder << static_cast<uint64_t>(hashMap.size()); 205 for (typename HashMapType::const_iterator it = hashMap.begin(), end = hashMap.end(); it != end; ++it) 206 encoder << *it; 207 } 208 209 static bool decode(Decoder& decoder, HashMapType& hashMap) 210 { 211 uint64_t hashMapSize; 212 if (!decoder.decode(hashMapSize)) 213 return false; 214 215 HashMapType tempHashMap; 216 for (uint64_t i = 0; i < hashMapSize; ++i) { 217 KeyArg key; 218 MappedArg value; 219 if (!decoder.decode(key)) 220 return false; 221 if (!decoder.decode(value)) 222 return false; 223 224 if (!tempHashMap.add(key, value).isNewEntry) { 225 // The hash map already has the specified key, bail. 226 return false; 227 } 228 } 229 230 hashMap.swap(tempHashMap); 231 return true; 232 } 233 }; 234 235 template<typename KeyArg, typename HashArg, typename KeyTraitsArg> struct Coder<HashSet<KeyArg, HashArg, KeyTraitsArg>> { 236 typedef HashSet<KeyArg, HashArg, KeyTraitsArg> HashSetType; 237 238 static void encode(Encoder& encoder, const HashSetType& hashSet) 239 { 240 encoder << static_cast<uint64_t>(hashSet.size()); 241 for (typename HashSetType::const_iterator it = hashSet.begin(), end = hashSet.end(); it != end; ++it) 242 encoder << *it; 243 } 244 245 static bool decode(Decoder& decoder, HashSetType& hashSet) 246 { 247 uint64_t hashSetSize; 248 if (!decoder.decode(hashSetSize)) 249 return false; 250 251 HashSetType tempHashSet; 252 for (uint64_t i = 0; i < hashSetSize; ++i) { 253 KeyArg key; 254 if (!decoder.decode(key)) 255 return false; 256 257 if (!tempHashSet.add(key).isNewEntry) { 258 // The hash map already has the specified key, bail. 259 return false; 260 } 261 } 262 263 hashSet.swap(tempHashSet); 264 return true; 265 } 266 }; 267 268 template<> struct Coder<AtomicString> { 269 static void encode(Encoder&, const AtomicString&); 270 static bool decode(Decoder&, AtomicString&); 271 }; 272 273 template<> struct Coder<CString> { 274 static void encode(Encoder&, const CString&); 275 static bool decode(Decoder&, CString&); 276 }; 277 278 template<> struct Coder<String> { 279 static void encode(Encoder&, const String&); 280 static bool decode(Decoder&, String&); 281 }; 42 namespace WTF { 43 namespace Persistence { 282 44 283 45 template<> struct Coder<WebCore::CertificateInfo> { 284 46 static void encode(Encoder&, const WebCore::CertificateInfo&); 285 47 static bool decode(Decoder&, WebCore::CertificateInfo&); 286 };287 288 template<> struct Coder<SHA1::Digest> {289 static void encode(Encoder&, const SHA1::Digest&);290 static bool decode(Decoder&, SHA1::Digest&);291 48 }; 292 49 -
trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheCodersCocoa.cpp
r203692 r210502 35 35 #endif 36 36 37 namespace W ebKit{38 namespace NetworkCache {37 namespace WTF { 38 namespace Persistence { 39 39 40 40 static void encodeCFData(Encoder& encoder, CFDataRef data) -
trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheCodersSoup.cpp
r203691 r210502 29 29 #if ENABLE(NETWORK_CACHE) 30 30 31 namespace W ebKit{32 namespace NetworkCache {31 namespace WTF { 32 namespace Persistence { 33 33 34 34 void Coder<WebCore::CertificateInfo>::encode(Encoder& encoder, const WebCore::CertificateInfo& certificateInfo) -
trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheEntry.cpp
r202357 r210502 29 29 #include "Logging.h" 30 30 #include "NetworkCacheCoders.h" 31 #include "NetworkCacheDecoder.h"32 #include "NetworkCacheEncoder.h"33 31 #include <WebCore/ResourceRequest.h> 34 32 #include <WebCore/SharedBuffer.h> … … 84 82 Storage::Record Entry::encodeAsStorageRecord() const 85 83 { 86 Encoder encoder;84 WTF::Persistence::Encoder encoder; 87 85 encoder << m_response; 88 86 … … 111 109 auto entry = std::make_unique<Entry>(storageEntry); 112 110 113 Decoder decoder(storageEntry.header.data(), storageEntry.header.size());111 WTF::Persistence::Decoder decoder(storageEntry.header.data(), storageEntry.header.size()); 114 112 if (!decoder.decode(entry->m_response)) 115 113 return nullptr; -
trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheKey.cpp
r209554 r210502 32 32 #include <wtf/ASCIICType.h> 33 33 #include <wtf/NeverDestroyed.h> 34 #include <wtf/persistence/Decoder.h> 35 #include <wtf/persistence/Encoder.h> 34 36 #include <wtf/text/CString.h> 35 37 #include <wtf/text/StringBuilder.h> … … 156 158 } 157 159 158 void Key::encode( Encoder& encoder) const160 void Key::encode(WTF::Persistence::Encoder& encoder) const 159 161 { 160 162 encoder << m_partition; … … 166 168 } 167 169 168 bool Key::decode( Decoder& decoder, Key& key)170 bool Key::decode(WTF::Persistence::Decoder& decoder, Key& key) 169 171 { 170 172 return decoder.decode(key.m_partition) && decoder.decode(key.m_type) && decoder.decode(key.m_identifier) && decoder.decode(key.m_range) && decoder.decode(key.m_hash) && decoder.decode(key.m_partitionHash); -
trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheKey.h
r209554 r210502 31 31 #include "NetworkCacheData.h" 32 32 #include <wtf/SHA1.h> 33 #include <wtf/persistence/Coder.h> 33 34 #include <wtf/text/WTFString.h> 34 35 35 36 namespace WebKit { 36 37 namespace NetworkCache { 37 38 class Encoder;39 class Decoder;40 38 41 39 class Key { … … 70 68 String partitionHashAsString() const { return hashAsString(m_partitionHash); } 71 69 72 void encode( Encoder&) const;73 static bool decode( Decoder&, Key&);70 void encode(WTF::Persistence::Encoder&) const; 71 static bool decode(WTF::Persistence::Decoder&, Key&); 74 72 75 73 bool operator==(const Key&) const; -
trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStorage.cpp
r210364 r210502 381 381 bool success = false; 382 382 fileData.apply([&metaData, &success](const uint8_t* data, size_t size) { 383 Decoder decoder(data, size);383 WTF::Persistence::Decoder decoder(data, size); 384 384 if (!decoder.decode(metaData.cacheStorageVersion)) 385 385 return false; … … 465 465 static Data encodeRecordMetaData(const RecordMetaData& metaData) 466 466 { 467 Encoder encoder;467 WTF::Persistence::Encoder encoder; 468 468 469 469 encoder << metaData.cacheStorageVersion; -
trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp
r202148 r210502 31 31 #include "Logging.h" 32 32 #include "NetworkCacheCoders.h" 33 #include "NetworkCacheDecoder.h"34 #include "NetworkCacheEncoder.h"35 33 36 34 namespace WebKit { 37 35 namespace NetworkCache { 38 36 39 void SubresourceInfo::encode( Encoder& encoder) const37 void SubresourceInfo::encode(WTF::Persistence::Encoder& encoder) const 40 38 { 41 39 encoder << m_isTransient; … … 49 47 } 50 48 51 bool SubresourceInfo::decode( Decoder& decoder, SubresourceInfo& info)49 bool SubresourceInfo::decode(WTF::Persistence::Decoder& decoder, SubresourceInfo& info) 52 50 { 53 51 if (!decoder.decode(info.m_isTransient)) … … 68 66 Storage::Record SubresourcesEntry::encodeAsStorageRecord() const 69 67 { 70 Encoder encoder;68 WTF::Persistence::Encoder encoder; 71 69 encoder << m_subresources; 72 70 … … 80 78 auto entry = std::make_unique<SubresourcesEntry>(storageEntry); 81 79 82 Decoder decoder(storageEntry.header.data(), storageEntry.header.size());80 WTF::Persistence::Decoder decoder(storageEntry.header.data(), storageEntry.header.size()); 83 81 if (!decoder.decode(entry->m_subresources)) 84 82 return nullptr; -
trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheSubresourcesEntry.h
r202148 r210502 29 29 #if ENABLE(NETWORK_CACHE_SPECULATIVE_REVALIDATION) 30 30 31 #include "NetworkCacheDecoder.h"32 #include "NetworkCacheEncoder.h"33 31 #include "NetworkCacheStorage.h" 34 32 #include <WebCore/ResourceRequest.h> … … 42 40 WTF_MAKE_FAST_ALLOCATED; 43 41 public: 44 void encode( Encoder&) const;45 static bool decode( Decoder&, SubresourceInfo&);42 void encode(WTF::Persistence::Encoder&) const; 43 static bool decode(WTF::Persistence::Decoder&, SubresourceInfo&); 46 44 47 45 SubresourceInfo() = default; -
trunk/Source/WebKit2/UIProcess/API/APIUserContentExtensionStore.cpp
r203303 r210502 31 31 #include "APIUserContentExtension.h" 32 32 #include "NetworkCacheData.h" 33 #include "NetworkCacheDecoder.h"34 #include "NetworkCacheEncoder.h"35 33 #include "NetworkCacheFileSystem.h" 36 34 #include "SharedMemory.h" … … 42 40 #include <wtf/RunLoop.h> 43 41 #include <wtf/WorkQueue.h> 42 #include <wtf/persistence/Decoder.h> 43 #include <wtf/persistence/Encoder.h> 44 44 45 45 using namespace WebKit::NetworkCache; … … 100 100 static Data encodeContentExtensionMetaData(const ContentExtensionMetaData& metaData) 101 101 { 102 W ebKit::NetworkCache::Encoder encoder;102 WTF::Persistence::Encoder encoder; 103 103 104 104 encoder << metaData.version; … … 121 121 return false; 122 122 123 W ebKit::NetworkCache::Decoder decoder(data, size);123 WTF::Persistence::Decoder decoder(data, size); 124 124 if (!decoder.decode(metaData.version)) 125 125 return false; -
trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
r210374 r210502 1894 1894 E4697CCD1B25EB8F001B0A6C /* NetworkCacheFileSystem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4697CCC1B25EB8F001B0A6C /* NetworkCacheFileSystem.cpp */; }; 1895 1895 E47D1E981B0649FB002676A8 /* NetworkCacheData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E47D1E961B062B66002676A8 /* NetworkCacheData.cpp */; }; 1896 E489D28A1A0A2DB80078C06A /* NetworkCacheCoder.h in Headers */ = {isa = PBXBuildFile; fileRef = E489D2831A0A2DB80078C06A /* NetworkCacheCoder.h */; };1897 1896 E489D28B1A0A2DB80078C06A /* NetworkCacheCoders.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E489D2841A0A2DB80078C06A /* NetworkCacheCoders.cpp */; }; 1898 1897 E489D28C1A0A2DB80078C06A /* NetworkCacheCoders.h in Headers */ = {isa = PBXBuildFile; fileRef = E489D2851A0A2DB80078C06A /* NetworkCacheCoders.h */; }; 1899 E489D28D1A0A2DB80078C06A /* NetworkCacheDecoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E489D2861A0A2DB80078C06A /* NetworkCacheDecoder.cpp */; };1900 E489D28E1A0A2DB80078C06A /* NetworkCacheDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = E489D2871A0A2DB80078C06A /* NetworkCacheDecoder.h */; };1901 E489D28F1A0A2DB80078C06A /* NetworkCacheEncoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E489D2881A0A2DB80078C06A /* NetworkCacheEncoder.cpp */; };1902 E489D2901A0A2DB80078C06A /* NetworkCacheEncoder.h in Headers */ = {isa = PBXBuildFile; fileRef = E489D2891A0A2DB80078C06A /* NetworkCacheEncoder.h */; };1903 1898 E49D40D71AD3FB170066B7B9 /* NetworkCacheBlobStorage.h in Headers */ = {isa = PBXBuildFile; fileRef = E49D40D61AD3FB170066B7B9 /* NetworkCacheBlobStorage.h */; }; 1904 1899 E49D40D91AD3FB210066B7B9 /* NetworkCacheBlobStorage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E49D40D81AD3FB210066B7B9 /* NetworkCacheBlobStorage.cpp */; }; … … 4101 4096 E4697CCC1B25EB8F001B0A6C /* NetworkCacheFileSystem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkCacheFileSystem.cpp; sourceTree = "<group>"; }; 4102 4097 E47D1E961B062B66002676A8 /* NetworkCacheData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkCacheData.cpp; sourceTree = "<group>"; }; 4103 E489D2831A0A2DB80078C06A /* NetworkCacheCoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkCacheCoder.h; sourceTree = "<group>"; };4104 4098 E489D2841A0A2DB80078C06A /* NetworkCacheCoders.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkCacheCoders.cpp; sourceTree = "<group>"; }; 4105 4099 E489D2851A0A2DB80078C06A /* NetworkCacheCoders.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkCacheCoders.h; sourceTree = "<group>"; }; 4106 E489D2861A0A2DB80078C06A /* NetworkCacheDecoder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkCacheDecoder.cpp; sourceTree = "<group>"; };4107 E489D2871A0A2DB80078C06A /* NetworkCacheDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkCacheDecoder.h; sourceTree = "<group>"; };4108 E489D2881A0A2DB80078C06A /* NetworkCacheEncoder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkCacheEncoder.cpp; sourceTree = "<group>"; };4109 E489D2891A0A2DB80078C06A /* NetworkCacheEncoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkCacheEncoder.h; sourceTree = "<group>"; };4110 4100 E49D40D61AD3FB170066B7B9 /* NetworkCacheBlobStorage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkCacheBlobStorage.h; sourceTree = "<group>"; }; 4111 4101 E49D40D81AD3FB210066B7B9 /* NetworkCacheBlobStorage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkCacheBlobStorage.cpp; sourceTree = "<group>"; }; … … 7570 7560 E49D40D81AD3FB210066B7B9 /* NetworkCacheBlobStorage.cpp */, 7571 7561 E49D40D61AD3FB170066B7B9 /* NetworkCacheBlobStorage.h */, 7572 E489D2831A0A2DB80078C06A /* NetworkCacheCoder.h */,7573 7562 E489D2841A0A2DB80078C06A /* NetworkCacheCoders.cpp */, 7574 7563 E489D2851A0A2DB80078C06A /* NetworkCacheCoders.h */, … … 7577 7566 E42E06111AA75ABD00B11699 /* NetworkCacheData.h */, 7578 7567 E42E06131AA75B7000B11699 /* NetworkCacheDataCocoa.mm */, 7579 E489D2861A0A2DB80078C06A /* NetworkCacheDecoder.cpp */,7580 E489D2871A0A2DB80078C06A /* NetworkCacheDecoder.h */,7581 E489D2881A0A2DB80078C06A /* NetworkCacheEncoder.cpp */,7582 E489D2891A0A2DB80078C06A /* NetworkCacheEncoder.h */,7583 7568 E413F59E1AC1AF9D00345360 /* NetworkCacheEntry.cpp */, 7584 7569 E413F59B1AC1ADB600345360 /* NetworkCacheEntry.h */, … … 7904 7889 E4436ECC1A0D040B00EAD204 /* NetworkCache.h in Headers */, 7905 7890 E49D40D71AD3FB170066B7B9 /* NetworkCacheBlobStorage.h in Headers */, 7906 E489D28A1A0A2DB80078C06A /* NetworkCacheCoder.h in Headers */,7907 7891 E489D28C1A0A2DB80078C06A /* NetworkCacheCoders.h in Headers */, 7908 7892 E42E06121AA75ABD00B11699 /* NetworkCacheData.h in Headers */, 7909 E489D28E1A0A2DB80078C06A /* NetworkCacheDecoder.h in Headers */,7910 E489D2901A0A2DB80078C06A /* NetworkCacheEncoder.h in Headers */,7911 7893 E413F59D1AC1ADC400345360 /* NetworkCacheEntry.h in Headers */, 7912 7894 834B250F1A831A8D00CFB150 /* NetworkCacheFileSystem.h in Headers */, … … 9408 9390 E47D1E981B0649FB002676A8 /* NetworkCacheData.cpp in Sources */, 9409 9391 E42E06141AA75B7000B11699 /* NetworkCacheDataCocoa.mm in Sources */, 9410 E489D28D1A0A2DB80078C06A /* NetworkCacheDecoder.cpp in Sources */,9411 E489D28F1A0A2DB80078C06A /* NetworkCacheEncoder.cpp in Sources */,9412 9392 E413F59F1AC1AF9D00345360 /* NetworkCacheEntry.cpp in Sources */, 9413 9393 E4697CCD1B25EB8F001B0A6C /* NetworkCacheFileSystem.cpp in Sources */,
Note:
See TracChangeset
for help on using the changeset viewer.