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

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

Issue 1378743002: Refactor the API for setting dynamic resource load priorities (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Better names / cleanup Created 5 years, 2 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
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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 void addAllArchiveResources(MHTMLArchive*); 103 void addAllArchiveResources(MHTMLArchive*);
104 ArchiveResourceCollection* archiveResourceCollection() const { return m_arch iveResourceCollection.get(); } 104 ArchiveResourceCollection* archiveResourceCollection() const { return m_arch iveResourceCollection.get(); }
105 105
106 void setDefersLoading(bool); 106 void setDefersLoading(bool);
107 void stopFetching(); 107 void stopFetching();
108 bool isFetching() const; 108 bool isFetching() const;
109 109
110 void didLoadResource(); 110 void didLoadResource();
111 void redirectReceived(Resource*, const ResourceResponse&); 111 void redirectReceived(Resource*, const ResourceResponse&);
112 void didFinishLoading(Resource*, double finishTime, int64_t encodedDataLengt h); 112 void didFinishLoading(Resource*, double finishTime, int64_t encodedDataLengt h);
113 void didChangeLoadingPriority(const Resource*, ResourceLoadPriority, int int raPriorityValue);
114 void didFailLoading(const Resource*, const ResourceError&); 113 void didFailLoading(const Resource*, const ResourceError&);
115 void willSendRequest(unsigned long identifier, ResourceRequest&, const Resou rceResponse& redirectResponse, const FetchInitiatorInfo&); 114 void willSendRequest(unsigned long identifier, ResourceRequest&, const Resou rceResponse& redirectResponse, const FetchInitiatorInfo&);
116 void didReceiveResponse(const Resource*, const ResourceResponse&); 115 void didReceiveResponse(const Resource*, const ResourceResponse&);
117 void didReceiveData(const Resource*, const char* data, int dataLength, int e ncodedDataLength); 116 void didReceiveData(const Resource*, const char* data, int dataLength, int e ncodedDataLength);
118 void didDownloadData(const Resource*, int dataLength, int encodedDataLength) ; 117 void didDownloadData(const Resource*, int dataLength, int encodedDataLength) ;
119 void subresourceLoaderFinishedLoadingOnePart(ResourceLoader*); 118 void subresourceLoaderFinishedLoadingOnePart(ResourceLoader*);
120 void didInitializeResourceLoader(ResourceLoader*); 119 void didInitializeResourceLoader(ResourceLoader*);
121 void willStartLoadingResource(Resource*, ResourceRequest&); 120 void willStartLoadingResource(Resource*, ResourceRequest&);
122 bool defersLoading() const; 121 bool defersLoading() const;
123 bool isLoadedBy(ResourceFetcher*) const; 122 bool isLoadedBy(ResourceFetcher*) const;
124 123
125 enum AccessControlLoggingDecision { 124 enum AccessControlLoggingDecision {
126 ShouldLogAccessControlErrors, 125 ShouldLogAccessControlErrors,
127 ShouldNotLogAccessControlErrors 126 ShouldNotLogAccessControlErrors
128 }; 127 };
129 bool canAccessRedirect(Resource*, ResourceRequest&, const ResourceResponse&, ResourceLoaderOptions&); 128 bool canAccessRedirect(Resource*, ResourceRequest&, const ResourceResponse&, ResourceLoaderOptions&);
130 bool canAccessResource(Resource*, SecurityOrigin*, const KURL&, AccessContro lLoggingDecision) const; 129 bool canAccessResource(Resource*, SecurityOrigin*, const KURL&, AccessContro lLoggingDecision) const;
131 bool isControlledByServiceWorker() const; 130 bool isControlledByServiceWorker() const;
132 131
133 void acceptDataFromThreadedReceiver(unsigned long identifier, const char* da ta, int dataLength, int encodedDataLength); 132 void acceptDataFromThreadedReceiver(unsigned long identifier, const char* da ta, int dataLength, int encodedDataLength);
134 133
135 ResourceLoadPriority loadPriority(Resource::Type, const FetchRequest&); 134 ResourceLoadPriority loadPriority(Resource::Type, const FetchRequest&, Resou rcePriority::VisibilityStatus = ResourcePriority::NotVisible);
136 135
137 enum ResourceLoadStartType { 136 enum ResourceLoadStartType {
138 ResourceLoadingFromNetwork, 137 ResourceLoadingFromNetwork,
139 ResourceLoadingFromCache 138 ResourceLoadingFromCache
140 }; 139 };
141 void requestLoadStarted(Resource*, const FetchRequest&, ResourceLoadStartTyp e, bool isStaticData = false); 140 void requestLoadStarted(Resource*, const FetchRequest&, ResourceLoadStartTyp e, bool isStaticData = false);
142 static const ResourceLoaderOptions& defaultResourceOptions(); 141 static const ResourceLoaderOptions& defaultResourceOptions();
143 142
144 String getCacheIdentifier() const; 143 String getCacheIdentifier() const;
145 144
146 void scheduleDocumentResourcesGC(); 145 void scheduleDocumentResourcesGC();
147 bool clientDefersImage(const KURL&) const; 146 bool clientDefersImage(const KURL&) const;
148 void determineRequestContext(ResourceRequest&, Resource::Type); 147 void determineRequestContext(ResourceRequest&, Resource::Type);
149 148
150 WebTaskRunner* loadingTaskRunner(); 149 WebTaskRunner* loadingTaskRunner();
151 150
151 void updateAllImageResourcePriorities();
152
152 private: 153 private:
153 friend class ResourceCacheValidationSuppressor; 154 friend class ResourceCacheValidationSuppressor;
154 155
155 explicit ResourceFetcher(FetchContext*); 156 explicit ResourceFetcher(FetchContext*);
156 157
157 ResourcePtr<Resource> createResourceForRevalidation(const FetchRequest&, Res ource*, const ResourceFactory&); 158 ResourcePtr<Resource> createResourceForRevalidation(const FetchRequest&, Res ource*, const ResourceFactory&);
158 ResourcePtr<Resource> createResourceForLoading(FetchRequest&, const String& charset, const ResourceFactory&); 159 ResourcePtr<Resource> createResourceForLoading(FetchRequest&, const String& charset, const ResourceFactory&);
159 void storeResourceTimingInitiatorInformation(Resource*); 160 void storeResourceTimingInitiatorInformation(Resource*);
160 bool scheduleArchiveLoad(Resource*, const ResourceRequest&); 161 bool scheduleArchiveLoad(Resource*, const ResourceRequest&);
161 void preCacheData(const FetchRequest&, const ResourceFactory&, const Substit uteData&); 162 void preCacheData(const FetchRequest&, const ResourceFactory&, const Substit uteData&);
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 m_loader->m_allowStaleResources = m_previousState; 245 m_loader->m_allowStaleResources = m_previousState;
245 } 246 }
246 private: 247 private:
247 Member<ResourceFetcher> m_loader; 248 Member<ResourceFetcher> m_loader;
248 bool m_previousState; 249 bool m_previousState;
249 }; 250 };
250 251
251 } // namespace blink 252 } // namespace blink
252 253
253 #endif // ResourceFetcher_h 254 #endif // ResourceFetcher_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/fetch/ResourceClient.h ('k') | third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698