Changeset 255136 in webkit
- Timestamp:
- Jan 26, 2020 10:27:38 PM (4 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r255133 r255136 1 2020-01-26 Darin Adler <darin@apple.com> 2 3 Move DOMCacheEngine::errorToException back out of header and into .cpp file 4 https://bugs.webkit.org/show_bug.cgi?id=206815 5 6 Reviewed by Mark Lam. 7 8 This is a follow-up to a recent build fix that moved a function, errorToException, 9 out of a .cpp file and into a header file. This reverses that since we don't need 10 this function to be inlined. 11 12 * Modules/cache/DOMCacheEngine.cpp: 13 (WebCore::DOMCacheEngine::convertToException): Moved this function from the header 14 and renamed it from errorToException to match the other function more closely. Also 15 use the pattern where the switch statement has no default, so we get a warning if 16 we don't cover all the enum values. 17 (WebCore::DOMCacheEngine::convertToExceptionAndLog): Updated for new function name. 18 19 * Modules/cache/DOMCacheEngine.h: Removed the definition of errorToException and 20 replaced it with the declaration of it under its new name, convertToException. 21 22 * Modules/cache/DOMCacheStorage.cpp: 23 (WebCore::DOMCacheStorage::retrieveCaches): Updated for new function name. 24 1 25 2020-01-26 youenn fablet <youenn@apple.com> 2 26 -
trunk/Source/WebCore/Modules/cache/DOMCacheEngine.cpp
r255070 r255136 36 36 namespace DOMCacheEngine { 37 37 38 Exception convertToException(Error error) 39 { 40 switch (error) { 41 case Error::NotImplemented: 42 return Exception { NotSupportedError, "Not implemented"_s }; 43 case Error::ReadDisk: 44 return Exception { TypeError, "Failed reading data from the file system"_s }; 45 case Error::WriteDisk: 46 return Exception { TypeError, "Failed writing data to the file system"_s }; 47 case Error::QuotaExceeded: 48 return Exception { QuotaExceededError, "Quota exceeded"_s }; 49 case Error::Internal: 50 return Exception { TypeError, "Internal error"_s }; 51 case Error::Stopped: 52 return Exception { TypeError, "Context is stopped"_s }; 53 } 54 ASSERT_NOT_REACHED(); 55 return Exception { TypeError, "Connection stopped"_s }; 56 } 57 38 58 Exception convertToExceptionAndLog(ScriptExecutionContext* context, Error error) 39 59 { 40 auto exception = errorToException(error);60 auto exception = convertToException(error); 41 61 if (context) 42 62 context->addConsoleMessage(MessageSource::JS, MessageLevel::Error, makeString("Cache API operation failed: ", exception.message())); -
trunk/Source/WebCore/Modules/cache/DOMCacheEngine.h
r255070 r255136 31 31 #include "ResourceRequest.h" 32 32 #include "ResourceResponse.h" 33 #include "ScriptExecutionContext.h"34 33 #include "SharedBuffer.h" 35 34 #include <wtf/CompletionHandler.h> 36 35 37 36 namespace WebCore { 37 38 class ScriptExecutionContext; 38 39 39 40 struct CacheQueryOptions; … … 50 51 }; 51 52 52 static inline Exception errorToException(Error error) 53 { 54 switch (error) { 55 case Error::NotImplemented: 56 return Exception { NotSupportedError, "Not implemented"_s }; 57 case Error::ReadDisk: 58 return Exception { TypeError, "Failed reading data from the file system"_s }; 59 case Error::WriteDisk: 60 return Exception { TypeError, "Failed writing data to the file system"_s }; 61 case Error::QuotaExceeded: 62 return Exception { QuotaExceededError, "Quota exceeded"_s }; 63 case Error::Internal: 64 return Exception { TypeError, "Internal error"_s }; 65 case Error::Stopped: 66 return Exception { TypeError, "Context is stopped"_s }; 67 default: 68 ASSERT_NOT_REACHED(); 69 return Exception { TypeError, "Connection stopped"_s }; 70 } 71 } 72 53 Exception convertToException(Error); 73 54 Exception convertToExceptionAndLog(ScriptExecutionContext*, Error); 74 55 -
trunk/Source/WebCore/Modules/cache/DOMCacheStorage.cpp
r255070 r255136 152 152 m_connection->retrieveCaches(*origin, m_updateCounter, [this, callback = WTFMove(callback), pendingActivity = makePendingActivity(*this)](CacheInfosOrError&& result) mutable { 153 153 if (m_isStopped) { 154 callback(DOMCacheEngine:: errorToException(DOMCacheEngine::Error::Stopped));154 callback(DOMCacheEngine::convertToException(DOMCacheEngine::Error::Stopped)); 155 155 return; 156 156 }
Note: See TracChangeset
for help on using the changeset viewer.