Changeset 249105 in webkit
- Timestamp:
- Aug 26, 2019, 10:51:18 AM (7 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
Modules/cache/CacheStorageConnection.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r249094 r249105 1 2019-08-26 Youenn Fablet <youenn@apple.com> 2 3 CacheStorageConnection::computeRealBodySize is not thread-safe 4 https://bugs.webkit.org/show_bug.cgi?id=201074 5 6 Reviewed by Chris Dumez. 7 8 In case of a form data, the size computation might require sync IPC to the network process which is not thread-safe 9 In that case, hop to the main thread to compute the size of the body. 10 Covered by existing service worker tests in Debug mode. 11 12 * Modules/cache/CacheStorageConnection.cpp: 13 (WebCore::formDataSize): 14 (WebCore::CacheStorageConnection::computeRealBodySize): 15 1 16 2019-08-26 Youenn Fablet <youenn@apple.com> 2 17 -
trunk/Source/WebCore/Modules/cache/CacheStorageConnection.cpp
r248670 r249105 34 34 using namespace WebCore::DOMCacheEngine; 35 35 36 static inline uint64_t formDataSize(const FormData& formData, PAL::SessionID sessionID) 37 { 38 if (isMainThread()) 39 return formData.lengthInBytes(sessionID); 40 41 uint64_t resultSize; 42 callOnMainThreadAndWait([sessionID, formData = formData.isolatedCopy(), &resultSize] { 43 resultSize = formData->lengthInBytes(sessionID); 44 }); 45 return resultSize; 46 } 47 36 48 uint64_t CacheStorageConnection::computeRealBodySize(const DOMCacheEngine::ResponseBody& body) 37 49 { 38 50 uint64_t result = 0; 39 WTF::switchOn(body, [&] (const Ref< WebCore::FormData>& formData) {40 result = formData ->lengthInBytes(sessionID());41 }, [&] (const Ref< WebCore::SharedBuffer>& buffer) {51 WTF::switchOn(body, [&] (const Ref<FormData>& formData) { 52 result = formDataSize(formData, sessionID()); 53 }, [&] (const Ref<SharedBuffer>& buffer) { 42 54 result = buffer->size(); 43 55 }, [] (const std::nullptr_t&) {
Note:
See TracChangeset
for help on using the changeset viewer.