Title: [228165] branches/safari-605-branch/Source/WebKit
Revision
228165
Author
jmarc...@apple.com
Date
2018-02-06 07:16:31 -0800 (Tue, 06 Feb 2018)

Log Message

Cherry-pick r228116. rdar://problem/37264514

Modified Paths

Diff

Modified: branches/safari-605-branch/Source/WebKit/ChangeLog (228164 => 228165)


--- branches/safari-605-branch/Source/WebKit/ChangeLog	2018-02-06 15:16:29 UTC (rev 228164)
+++ branches/safari-605-branch/Source/WebKit/ChangeLog	2018-02-06 15:16:31 UTC (rev 228165)
@@ -1,5 +1,27 @@
 2018-02-06  Jason Marcell  <jmarc...@apple.com>
 
+        Cherry-pick r228116. rdar://problem/37264514
+
+    2018-02-05  Youenn Fablet  <you...@apple.com>
+
+            Add logging to CacheStorageEngineConnection
+            https://bugs.webkit.org/show_bug.cgi?id=182456
+
+            Reviewed by Chris Dumez.
+
+            * NetworkProcess/cache/CacheStorageEngineConnection.cpp:
+            (WebKit::CacheStorageEngineConnection::open):
+            (WebKit::CacheStorageEngineConnection::remove):
+            (WebKit::CacheStorageEngineConnection::caches):
+            (WebKit::CacheStorageEngineConnection::retrieveRecords):
+            (WebKit::CacheStorageEngineConnection::deleteMatchingRecords):
+            (WebKit::CacheStorageEngineConnection::putRecords):
+            (WebKit::CacheStorageEngineConnection::reference):
+            (WebKit::CacheStorageEngineConnection::dereference):
+            * Platform/Logging.h:
+
+2018-02-06  Jason Marcell  <jmarc...@apple.com>
+
         Cherry-pick r228114. rdar://problem/37264445
 
     2018-02-05  Daniel Bates  <daba...@apple.com>

Modified: branches/safari-605-branch/Source/WebKit/NetworkProcess/cache/CacheStorageEngineConnection.cpp (228164 => 228165)


--- branches/safari-605-branch/Source/WebKit/NetworkProcess/cache/CacheStorageEngineConnection.cpp	2018-02-06 15:16:29 UTC (rev 228164)
+++ branches/safari-605-branch/Source/WebKit/NetworkProcess/cache/CacheStorageEngineConnection.cpp	2018-02-06 15:16:31 UTC (rev 228165)
@@ -27,6 +27,7 @@
 #include "config.h"
 #include "CacheStorageEngineConnection.h"
 
+#include "Logging.h"
 #include "NetworkConnectionToWebProcess.h"
 #include "WebCacheStorageConnectionMessages.h"
 #include "WebCoreArgumentCoders.h"
@@ -37,6 +38,15 @@
 
 namespace WebKit {
 
+#define RELEASE_LOG_IF_ALLOWED(fmt, ...) RELEASE_LOG_IF(sessionID.isAlwaysOnLoggingAllowed(), CacheStorage, "%p - CacheStorageEngineConnection::" fmt, &m_connection.connection(), ##__VA_ARGS__)
+#define RELEASE_LOG_FUNCTION_IF_ALLOWED_IN_CALLBACK(functionName, fmt, resultGetter) \
+    if (!result.has_value())\
+        RELEASE_LOG_ERROR_IF(sessionID.isAlwaysOnLoggingAllowed(), CacheStorage, "%p - CacheStorageEngineConnection::%s (%llu) - failed - error %d", connection.ptr(), functionName, requestIdentifier, (int)result.error()); \
+    else {\
+        auto value = resultGetter(result.value()); \
+        UNUSED_PARAM(value); \
+        RELEASE_LOG_IF(sessionID.isAlwaysOnLoggingAllowed(), CacheStorage, "%p - CacheStorageEngineConnection::%s (%llu) - succeeded - " fmt, connection.ptr(), functionName, requestIdentifier, value); \
+    }
 CacheStorageEngineConnection::CacheStorageEngineConnection(NetworkConnectionToWebProcess& connection)
     : m_connection(connection)
 {
@@ -55,7 +65,9 @@
 
 void CacheStorageEngineConnection::open(PAL::SessionID sessionID, uint64_t requestIdentifier, const WebCore::ClientOrigin& origin, const String& cacheName)
 {
+    RELEASE_LOG_IF_ALLOWED("open (%llu)", requestIdentifier);
     Engine::from(sessionID).open(origin, cacheName, [connection = makeRef(m_connection.connection()), sessionID, requestIdentifier](const CacheIdentifierOrError& result) {
+        RELEASE_LOG_FUNCTION_IF_ALLOWED_IN_CALLBACK("open", "cache identifier is %llu", [](const auto& value) { return value.identifier; });
         connection->send(Messages::WebCacheStorageConnection::OpenCompleted(requestIdentifier, result), sessionID.sessionID());
     });
 }
@@ -62,7 +74,9 @@
 
 void CacheStorageEngineConnection::remove(PAL::SessionID sessionID, uint64_t requestIdentifier, uint64_t cacheIdentifier)
 {
+    RELEASE_LOG_IF_ALLOWED("remove (%llu) cache %llu", requestIdentifier, cacheIdentifier);
     Engine::from(sessionID).remove(cacheIdentifier, [connection = makeRef(m_connection.connection()), sessionID, requestIdentifier](const CacheIdentifierOrError& result) {
+        RELEASE_LOG_FUNCTION_IF_ALLOWED_IN_CALLBACK("remove", "removed cache %llu", [](const auto& value) { return value.identifier; });
         connection->send(Messages::WebCacheStorageConnection::RemoveCompleted(requestIdentifier, result), sessionID.sessionID());
     });
 }
@@ -69,7 +83,9 @@
 
 void CacheStorageEngineConnection::caches(PAL::SessionID sessionID, uint64_t requestIdentifier, const WebCore::ClientOrigin& origin, uint64_t updateCounter)
 {
+    RELEASE_LOG_IF_ALLOWED("caches (%llu)", requestIdentifier);
     Engine::from(sessionID).retrieveCaches(origin, updateCounter, [connection = makeRef(m_connection.connection()), sessionID, origin, requestIdentifier](CacheInfosOrError&& result) {
+        RELEASE_LOG_FUNCTION_IF_ALLOWED_IN_CALLBACK("caches", "caches size is %lu", [](const auto& value) { return value.infos.size(); });
         connection->send(Messages::WebCacheStorageConnection::UpdateCaches(requestIdentifier, result), sessionID.sessionID());
     });
 }
@@ -76,7 +92,9 @@
 
 void CacheStorageEngineConnection::retrieveRecords(PAL::SessionID sessionID, uint64_t requestIdentifier, uint64_t cacheIdentifier, WebCore::URL&& url)
 {
+    RELEASE_LOG_IF_ALLOWED("retrieveRecords (%llu) in cache %llu", requestIdentifier, cacheIdentifier);
     Engine::from(sessionID).retrieveRecords(cacheIdentifier, WTFMove(url), [connection = makeRef(m_connection.connection()), sessionID, requestIdentifier](RecordsOrError&& result) {
+        RELEASE_LOG_FUNCTION_IF_ALLOWED_IN_CALLBACK("retrieveRecords", "records size is %lu", [](const auto& value) { return value.size(); });
         connection->send(Messages::WebCacheStorageConnection::UpdateRecords(requestIdentifier, result), sessionID.sessionID());
     });
 }
@@ -83,7 +101,9 @@
 
 void CacheStorageEngineConnection::deleteMatchingRecords(PAL::SessionID sessionID, uint64_t requestIdentifier, uint64_t cacheIdentifier, WebCore::ResourceRequest&& request, WebCore::CacheQueryOptions&& options)
 {
+    RELEASE_LOG_IF_ALLOWED("deleteMatchingRecords (%llu) in cache %llu", requestIdentifier, cacheIdentifier);
     Engine::from(sessionID).deleteMatchingRecords(cacheIdentifier, WTFMove(request), WTFMove(options), [connection = makeRef(m_connection.connection()), sessionID, requestIdentifier](RecordIdentifiersOrError&& result) {
+        RELEASE_LOG_FUNCTION_IF_ALLOWED_IN_CALLBACK("deleteMatchingRecords", "deleted %lu records",  [](const auto& value) { return value.size(); });
         connection->send(Messages::WebCacheStorageConnection::DeleteRecordsCompleted(requestIdentifier, result), sessionID.sessionID());
     });
 }
@@ -90,7 +110,9 @@
 
 void CacheStorageEngineConnection::putRecords(PAL::SessionID sessionID, uint64_t requestIdentifier, uint64_t cacheIdentifier, Vector<Record>&& records)
 {
+    RELEASE_LOG_IF_ALLOWED("putRecords (%llu) in cache %llu, %lu records", requestIdentifier, cacheIdentifier, records.size());
     Engine::from(sessionID).putRecords(cacheIdentifier, WTFMove(records), [connection = makeRef(m_connection.connection()), sessionID, requestIdentifier](RecordIdentifiersOrError&& result) {
+        RELEASE_LOG_FUNCTION_IF_ALLOWED_IN_CALLBACK("putRecords", "put %lu records",  [](const auto& value) { return value.size(); });
         connection->send(Messages::WebCacheStorageConnection::PutRecordsCompleted(requestIdentifier, result), sessionID.sessionID());
     });
 }
@@ -97,6 +119,7 @@
 
 void CacheStorageEngineConnection::reference(PAL::SessionID sessionID, uint64_t cacheIdentifier)
 {
+    RELEASE_LOG_IF_ALLOWED("reference cache %llu", cacheIdentifier);
     auto& references = m_cachesLocks.ensure(sessionID, []() {
         return HashMap<CacheIdentifier, LockCount> { };
     }).iterator->value;
@@ -109,6 +132,7 @@
 
 void CacheStorageEngineConnection::dereference(PAL::SessionID sessionID, uint64_t cacheIdentifier)
 {
+    RELEASE_LOG_IF_ALLOWED("dereference cache %llu", cacheIdentifier);
     ASSERT(m_cachesLocks.contains(sessionID));
     auto& references = m_cachesLocks.ensure(sessionID, []() {
         return HashMap<CacheIdentifier, LockCount> { };

Modified: branches/safari-605-branch/Source/WebKit/Platform/Logging.h (228164 => 228165)


--- branches/safari-605-branch/Source/WebKit/Platform/Logging.h	2018-02-06 15:16:29 UTC (rev 228164)
+++ branches/safari-605-branch/Source/WebKit/Platform/Logging.h	2018-02-06 15:16:31 UTC (rev 228165)
@@ -40,6 +40,7 @@
 #endif
 
 #define WEBKIT2_LOG_CHANNELS(M) \
+    M(CacheStorage) \
     M(ContextMenu) \
     M(DragAndDrop) \
     M(Fullscreen) \
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to