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

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

Issue 1304063016: Refactor the API for setting dynamic resource load priorities (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/fetch/ResourceClient.h ('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 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
149 void updateAllImageResourcePriorities();
150
150 private: 151 private:
151 friend class ResourceCacheValidationSuppressor; 152 friend class ResourceCacheValidationSuppressor;
152 153
153 explicit ResourceFetcher(FetchContext*); 154 explicit ResourceFetcher(FetchContext*);
154 155
155 ResourcePtr<Resource> createResourceForRevalidation(const FetchRequest&, Res ource*, const ResourceFactory&); 156 ResourcePtr<Resource> createResourceForRevalidation(const FetchRequest&, Res ource*, const ResourceFactory&);
156 ResourcePtr<Resource> createResourceForLoading(FetchRequest&, const String& charset, const ResourceFactory&); 157 ResourcePtr<Resource> createResourceForLoading(FetchRequest&, const String& charset, const ResourceFactory&);
157 void storeResourceTimingInitiatorInformation(Resource*); 158 void storeResourceTimingInitiatorInformation(Resource*);
158 bool scheduleArchiveLoad(Resource*, const ResourceRequest&); 159 bool scheduleArchiveLoad(Resource*, const ResourceRequest&);
159 void preCacheData(const FetchRequest&, const ResourceFactory&, const Substit uteData&); 160 void preCacheData(const FetchRequest&, const ResourceFactory&, const Substit uteData&);
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 m_loader->m_allowStaleResources = m_previousState; 243 m_loader->m_allowStaleResources = m_previousState;
243 } 244 }
244 private: 245 private:
245 Member<ResourceFetcher> m_loader; 246 Member<ResourceFetcher> m_loader;
246 bool m_previousState; 247 bool m_previousState;
247 }; 248 };
248 249
249 } // namespace blink 250 } // namespace blink
250 251
251 #endif // ResourceFetcher_h 252 #endif // ResourceFetcher_h
OLDNEW
« no previous file with comments | « Source/core/fetch/ResourceClient.h ('k') | Source/core/fetch/ResourceFetcher.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698