Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1328)

Unified Diff: third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.h

Issue 2834733003: Separate preaload matching from MemoryCache (Closed)
Patch Set: fix Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.h
diff --git a/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.h b/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.h
index dafdd00eadfa1bea751d824e6f8f12054869a9a6..c35ab02fb7a2fa1ef78649a74a446897e2bcc87e 100644
--- a/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.h
+++ b/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.h
@@ -33,6 +33,7 @@
#include "platform/loader/fetch/FetchContext.h"
#include "platform/loader/fetch/FetchInitiatorInfo.h"
#include "platform/loader/fetch/FetchParameters.h"
+#include "platform/loader/fetch/PreloadKey.h"
#include "platform/loader/fetch/Resource.h"
#include "platform/loader/fetch/ResourceError.h"
#include "platform/loader/fetch/ResourceLoadPriority.h"
@@ -106,7 +107,6 @@ class PLATFORM_EXPORT ResourceFetcher
int CountPreloads() const { return preloads_.size(); }
void ClearPreloads(ClearPreloadsPolicy = kClearAllPreloads);
- void PreloadStarted(Resource*);
void LogPreloadStats(ClearPreloadsPolicy);
void WarnUnusedPreloads();
@@ -142,9 +142,10 @@ class PLATFORM_EXPORT ResourceFetcher
// Calling this method before main document resource is fetched is invalid.
ResourceTimingInfo* GetNavigationTimingInfo();
- bool ContainsAsPreloadForTesting(Resource* resource) const {
- return preloads_.Contains(resource);
- }
+ // Returns whether the given resource is contained as a preloaded resource.
+ bool ContainsAsPreload(Resource*) const;
+
+ void RemovePreload(Resource*);
// Workaround for https://crbug.com/666214.
// TODO(hiroshige): Remove this hack.
@@ -187,6 +188,14 @@ class PLATFORM_EXPORT ResourceFetcher
const ResourceFactory&,
ResourceRequestBlockedReason);
+ Resource* MatchPreload(const FetchParameters& params, Resource::Type);
+ void InsertAsPreloadIfNecessary(Resource*,
+ const FetchParameters& params,
+ Resource::Type);
+
+ bool IsReusableForPreloading(const FetchParameters&,
+ Resource*,
+ bool is_static_data) const;
// RevalidationPolicy enum values are used in UMAs https://crbug.com/579496.
enum RevalidationPolicy { kUse, kRevalidate, kReload, kLoad };
RevalidationPolicy DetermineRevalidationPolicy(Resource::Type,
@@ -230,7 +239,7 @@ class PLATFORM_EXPORT ResourceFetcher
HashSet<String> validated_urls_;
mutable DocumentResourceMap document_resources_;
- HeapListHashSet<Member<Resource>> preloads_;
+ HeapHashMap<PreloadKey, Member<Resource>> preloads_;
Member<MHTMLArchive> archive_;
TaskRunnerTimer<ResourceFetcher> resource_timing_report_timer_;

Powered by Google App Engine
This is Rietveld 408576698