Title: [255136] trunk/Source/WebCore
- Revision
- 255136
- Author
- [email protected]
- Date
- 2020-01-26 22:27:38 -0800 (Sun, 26 Jan 2020)
Log Message
Move DOMCacheEngine::errorToException back out of header and into .cpp file
https://bugs.webkit.org/show_bug.cgi?id=206815
Reviewed by Mark Lam.
This is a follow-up to a recent build fix that moved a function, errorToException,
out of a .cpp file and into a header file. This reverses that since we don't need
this function to be inlined.
* Modules/cache/DOMCacheEngine.cpp:
(WebCore::DOMCacheEngine::convertToException): Moved this function from the header
and renamed it from errorToException to match the other function more closely. Also
use the pattern where the switch statement has no default, so we get a warning if
we don't cover all the enum values.
(WebCore::DOMCacheEngine::convertToExceptionAndLog): Updated for new function name.
* Modules/cache/DOMCacheEngine.h: Removed the definition of errorToException and
replaced it with the declaration of it under its new name, convertToException.
* Modules/cache/DOMCacheStorage.cpp:
(WebCore::DOMCacheStorage::retrieveCaches): Updated for new function name.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (255135 => 255136)
--- trunk/Source/WebCore/ChangeLog 2020-01-27 04:38:51 UTC (rev 255135)
+++ trunk/Source/WebCore/ChangeLog 2020-01-27 06:27:38 UTC (rev 255136)
@@ -1,3 +1,27 @@
+2020-01-26 Darin Adler <[email protected]>
+
+ Move DOMCacheEngine::errorToException back out of header and into .cpp file
+ https://bugs.webkit.org/show_bug.cgi?id=206815
+
+ Reviewed by Mark Lam.
+
+ This is a follow-up to a recent build fix that moved a function, errorToException,
+ out of a .cpp file and into a header file. This reverses that since we don't need
+ this function to be inlined.
+
+ * Modules/cache/DOMCacheEngine.cpp:
+ (WebCore::DOMCacheEngine::convertToException): Moved this function from the header
+ and renamed it from errorToException to match the other function more closely. Also
+ use the pattern where the switch statement has no default, so we get a warning if
+ we don't cover all the enum values.
+ (WebCore::DOMCacheEngine::convertToExceptionAndLog): Updated for new function name.
+
+ * Modules/cache/DOMCacheEngine.h: Removed the definition of errorToException and
+ replaced it with the declaration of it under its new name, convertToException.
+
+ * Modules/cache/DOMCacheStorage.cpp:
+ (WebCore::DOMCacheStorage::retrieveCaches): Updated for new function name.
+
2020-01-26 youenn fablet <[email protected]>
Use ObjectIdentifier for remote RealtimeMediaSource
Modified: trunk/Source/WebCore/Modules/cache/DOMCacheEngine.cpp (255135 => 255136)
--- trunk/Source/WebCore/Modules/cache/DOMCacheEngine.cpp 2020-01-27 04:38:51 UTC (rev 255135)
+++ trunk/Source/WebCore/Modules/cache/DOMCacheEngine.cpp 2020-01-27 06:27:38 UTC (rev 255136)
@@ -35,9 +35,29 @@
namespace DOMCacheEngine {
+Exception convertToException(Error error)
+{
+ switch (error) {
+ case Error::NotImplemented:
+ return Exception { NotSupportedError, "Not implemented"_s };
+ case Error::ReadDisk:
+ return Exception { TypeError, "Failed reading data from the file system"_s };
+ case Error::WriteDisk:
+ return Exception { TypeError, "Failed writing data to the file system"_s };
+ case Error::QuotaExceeded:
+ return Exception { QuotaExceededError, "Quota exceeded"_s };
+ case Error::Internal:
+ return Exception { TypeError, "Internal error"_s };
+ case Error::Stopped:
+ return Exception { TypeError, "Context is stopped"_s };
+ }
+ ASSERT_NOT_REACHED();
+ return Exception { TypeError, "Connection stopped"_s };
+}
+
Exception convertToExceptionAndLog(ScriptExecutionContext* context, Error error)
{
- auto exception = errorToException(error);
+ auto exception = convertToException(error);
if (context)
context->addConsoleMessage(MessageSource::JS, MessageLevel::Error, makeString("Cache API operation failed: ", exception.message()));
return exception;
Modified: trunk/Source/WebCore/Modules/cache/DOMCacheEngine.h (255135 => 255136)
--- trunk/Source/WebCore/Modules/cache/DOMCacheEngine.h 2020-01-27 04:38:51 UTC (rev 255135)
+++ trunk/Source/WebCore/Modules/cache/DOMCacheEngine.h 2020-01-27 06:27:38 UTC (rev 255136)
@@ -30,12 +30,13 @@
#include "FetchOptions.h"
#include "ResourceRequest.h"
#include "ResourceResponse.h"
-#include "ScriptExecutionContext.h"
#include "SharedBuffer.h"
#include <wtf/CompletionHandler.h>
namespace WebCore {
+class ScriptExecutionContext;
+
struct CacheQueryOptions;
namespace DOMCacheEngine {
@@ -49,27 +50,7 @@
Stopped
};
-static inline Exception errorToException(Error error)
-{
- switch (error) {
- case Error::NotImplemented:
- return Exception { NotSupportedError, "Not implemented"_s };
- case Error::ReadDisk:
- return Exception { TypeError, "Failed reading data from the file system"_s };
- case Error::WriteDisk:
- return Exception { TypeError, "Failed writing data to the file system"_s };
- case Error::QuotaExceeded:
- return Exception { QuotaExceededError, "Quota exceeded"_s };
- case Error::Internal:
- return Exception { TypeError, "Internal error"_s };
- case Error::Stopped:
- return Exception { TypeError, "Context is stopped"_s };
- default:
- ASSERT_NOT_REACHED();
- return Exception { TypeError, "Connection stopped"_s };
- }
-}
-
+Exception convertToException(Error);
Exception convertToExceptionAndLog(ScriptExecutionContext*, Error);
WEBCORE_EXPORT bool queryCacheMatch(const ResourceRequest& request, const ResourceRequest& cachedRequest, const ResourceResponse&, const CacheQueryOptions&);
Modified: trunk/Source/WebCore/Modules/cache/DOMCacheStorage.cpp (255135 => 255136)
--- trunk/Source/WebCore/Modules/cache/DOMCacheStorage.cpp 2020-01-27 04:38:51 UTC (rev 255135)
+++ trunk/Source/WebCore/Modules/cache/DOMCacheStorage.cpp 2020-01-27 06:27:38 UTC (rev 255136)
@@ -151,7 +151,7 @@
m_connection->retrieveCaches(*origin, m_updateCounter, [this, callback = WTFMove(callback), pendingActivity = makePendingActivity(*this)](CacheInfosOrError&& result) mutable {
if (m_isStopped) {
- callback(DOMCacheEngine::errorToException(DOMCacheEngine::Error::Stopped));
+ callback(DOMCacheEngine::convertToException(DOMCacheEngine::Error::Stopped));
return;
}
if (!result.has_value()) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes