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

Side by Side Diff: Source/core/fetch/ResourceFetcher.h

Issue 951303003: Added basic client hints support. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Removed expected files Created 5 years, 10 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 unified diff | Download patch
« no previous file with comments | « Source/core/fetch/Resource.cpp ('k') | Source/core/fetch/ResourceFetcher.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
3 Copyright (C) 2001 Dirk Mueller <mueller@kde.org> 3 Copyright (C) 2001 Dirk Mueller <mueller@kde.org>
4 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 4 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
5 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ 5 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/
6 6
7 This library is free software; you can redistribute it and/or 7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public 8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either 9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version. 10 version 2 of the License, or (at your option) any later version.
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 void requestLoadStarted(Resource*, const FetchRequest&, ResourceLoadStartTyp e); 173 void requestLoadStarted(Resource*, const FetchRequest&, ResourceLoadStartTyp e);
174 static const ResourceLoaderOptions& defaultResourceOptions(); 174 static const ResourceLoaderOptions& defaultResourceOptions();
175 175
176 String getCacheIdentifier() const; 176 String getCacheIdentifier() const;
177 177
178 virtual ResourceLoaderHost::LoaderHostType objectType() const override { ret urn ResourceFetcherType; }; 178 virtual ResourceLoaderHost::LoaderHostType objectType() const override { ret urn ResourceFetcherType; };
179 179
180 static ResourceFetcher* toResourceFetcher(ResourceLoaderHost*); 180 static ResourceFetcher* toResourceFetcher(ResourceLoaderHost*);
181 181
182 private: 182 private:
183 friend class ResourceFetcherTest; 183 friend class ResourceFetcherUpgradeTest;
184 friend class ResourceFetcherHintsTest;
184 185
185 explicit ResourceFetcher(DocumentLoader*); 186 explicit ResourceFetcher(DocumentLoader*);
186 187
187 bool shouldLoadNewResource(Resource::Type) const; 188 bool shouldLoadNewResource(Resource::Type) const;
188 189
189 ResourcePtr<Resource> requestResource(Resource::Type, FetchRequest&); 190 ResourcePtr<Resource> requestResource(Resource::Type, FetchRequest&);
190 ResourcePtr<Resource> createResourceForRevalidation(const FetchRequest&, Res ource*); 191 ResourcePtr<Resource> createResourceForRevalidation(const FetchRequest&, Res ource*);
191 ResourcePtr<Resource> createResourceForLoading(Resource::Type, FetchRequest& , const String& charset); 192 ResourcePtr<Resource> createResourceForLoading(Resource::Type, FetchRequest& , const String& charset);
192 void preCacheDataURIImage(const FetchRequest&); 193 void preCacheDataURIImage(const FetchRequest&);
193 void preCacheSubstituteDataForMainResource(const FetchRequest&, const Substi tuteData&); 194 void preCacheSubstituteDataForMainResource(const FetchRequest&, const Substi tuteData&);
194 void storeResourceTimingInitiatorInformation(Resource*); 195 void storeResourceTimingInitiatorInformation(Resource*);
195 bool scheduleArchiveLoad(Resource*, const ResourceRequest&); 196 bool scheduleArchiveLoad(Resource*, const ResourceRequest&);
196 197
197 enum RevalidationPolicy { Use, Revalidate, Reload, Load }; 198 enum RevalidationPolicy { Use, Revalidate, Reload, Load };
198 RevalidationPolicy determineRevalidationPolicy(Resource::Type, const FetchRe quest&, Resource* existingResource) const; 199 RevalidationPolicy determineRevalidationPolicy(Resource::Type, const FetchRe quest&, Resource* existingResource) const;
199 200
200 void determineRequestContext(ResourceRequest&, Resource::Type); 201 void determineRequestContext(ResourceRequest&, Resource::Type);
201 ResourceRequestCachePolicy resourceRequestCachePolicy(const ResourceRequest& , Resource::Type); 202 ResourceRequestCachePolicy resourceRequestCachePolicy(const ResourceRequest& , Resource::Type);
202 void addAdditionalRequestHeaders(ResourceRequest&, Resource::Type); 203 void addAdditionalRequestHeaders(ResourceRequest&, Resource::Type);
203 void upgradeInsecureRequest(FetchRequest&); 204 void upgradeInsecureRequest(FetchRequest&);
205 void addClientHintsIfNeccessary(FetchRequest&);
204 206
205 bool canRequest(Resource::Type, const ResourceRequest&, const KURL&, const R esourceLoaderOptions&, bool forPreload, FetchRequest::OriginRestriction) const; 207 bool canRequest(Resource::Type, const ResourceRequest&, const KURL&, const R esourceLoaderOptions&, bool forPreload, FetchRequest::OriginRestriction) const;
206 208
207 static bool resourceNeedsLoad(Resource*, const FetchRequest&, RevalidationPo licy); 209 static bool resourceNeedsLoad(Resource*, const FetchRequest&, RevalidationPo licy);
208 210
209 void notifyLoadedFromMemoryCache(Resource*); 211 void notifyLoadedFromMemoryCache(Resource*);
210 212
211 void garbageCollectDocumentResourcesTimerFired(Timer<ResourceFetcher>*); 213 void garbageCollectDocumentResourcesTimerFired(Timer<ResourceFetcher>*);
212 void scheduleDocumentResourcesGC(); 214 void scheduleDocumentResourcesGC();
213 215
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 m_loader->m_allowStaleResources = m_previousState; 282 m_loader->m_allowStaleResources = m_previousState;
281 } 283 }
282 private: 284 private:
283 ResourceFetcher* m_loader; 285 ResourceFetcher* m_loader;
284 bool m_previousState; 286 bool m_previousState;
285 }; 287 };
286 288
287 } // namespace blink 289 } // namespace blink
288 290
289 #endif 291 #endif
OLDNEW
« no previous file with comments | « Source/core/fetch/Resource.cpp ('k') | Source/core/fetch/ResourceFetcher.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698