Add performance logging for slow cache retrieves
[WebKit-https.git] / Source / WebKit / NetworkProcess / cache / NetworkCache.h
index a6fa2f6..cf5b7bb 100644 (file)
@@ -102,7 +102,17 @@ public:
     void setCapacity(size_t);
 
     // Completion handler may get called back synchronously on failure.
-    void retrieve(const WebCore::ResourceRequest&, const GlobalFrameID&, Function<void (std::unique_ptr<Entry>)>&&);
+    struct RetrieveInfo {
+        MonotonicTime startTime;
+        MonotonicTime completionTime;
+        unsigned priority;
+        Storage::Timings storageTimings;
+        bool wasSpeculativeLoad { false };
+
+        WTF_MAKE_FAST_ALLOCATED;
+    };
+    using RetrieveCompletionHandler = Function<void (std::unique_ptr<Entry>, const RetrieveInfo&)>;
+    void retrieve(const WebCore::ResourceRequest&, const GlobalFrameID&, RetrieveCompletionHandler&&);
     std::unique_ptr<Entry> store(const WebCore::ResourceRequest&, const WebCore::ResourceResponse&, RefPtr<WebCore::SharedBuffer>&&, Function<void (MappedBody&)>&&);
     std::unique_ptr<Entry> storeRedirect(const WebCore::ResourceRequest&, const WebCore::ResourceResponse&, const WebCore::ResourceRequest& redirectRequest);
     std::unique_ptr<Entry> update(const WebCore::ResourceRequest&, const GlobalFrameID&, const Entry&, const WebCore::ResourceResponse& validatingResponse);
@@ -140,6 +150,8 @@ private:
 
     Key makeCacheKey(const WebCore::ResourceRequest&);
 
+    static void completeRetrieve(RetrieveCompletionHandler&&, std::unique_ptr<Entry>, RetrieveInfo&);
+
     String dumpFilePath() const;
     void deleteDumpFile();