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

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

Issue 1975373002: Clean up response handling in ResourceLoader/ResourceFetcher (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 5 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 void stopFetching(); 107 void stopFetching();
108 bool isFetching() const; 108 bool isFetching() const;
109 109
110 bool willFollowRedirect(Resource*, ResourceRequest&, const ResourceResponse& , int64_t encodedDataLength); 110 bool willFollowRedirect(Resource*, ResourceRequest&, const ResourceResponse& , int64_t encodedDataLength);
111 enum DidFinishLoadingReason { 111 enum DidFinishLoadingReason {
112 DidFinishLoading, 112 DidFinishLoading,
113 DidFinishFirstPartInMultipart 113 DidFinishFirstPartInMultipart
114 }; 114 };
115 void didFinishLoading(Resource*, double finishTime, int64_t encodedDataLengt h, DidFinishLoadingReason); 115 void didFinishLoading(Resource*, double finishTime, int64_t encodedDataLengt h, DidFinishLoadingReason);
116 void didFailLoading(Resource*, const ResourceError&); 116 void didFailLoading(Resource*, const ResourceError&);
117 void didReceiveResponse(Resource*, const ResourceResponse&); 117 bool didReceiveResponse(Resource*, const ResourceResponse&);
hiroshige 2016/07/28 09:56:42 It is important to check the return value of this
Nate Chapin 2016/07/28 22:29:35 Refactored so that this returns void again.
118 void didReceiveData(const Resource*, const char* data, int dataLength, int e ncodedDataLength); 118 void didReceiveData(const Resource*, const char* data, int dataLength, int e ncodedDataLength);
119 void didDownloadData(const Resource*, int dataLength, int encodedDataLength) ; 119 void didDownloadData(const Resource*, int dataLength, int encodedDataLength) ;
120 bool defersLoading() const; 120 bool defersLoading() const;
121
122 enum AccessControlLoggingDecision {
123 ShouldLogAccessControlErrors,
124 ShouldNotLogAccessControlErrors
125 };
126 bool canAccessResource(Resource*, SecurityOrigin*, const KURL&, AccessContro lLoggingDecision) const;
127 bool isControlledByServiceWorker() const; 121 bool isControlledByServiceWorker() const;
128 122
129 void acceptDataFromThreadedReceiver(unsigned long identifier, const char* da ta, int dataLength, int encodedDataLength); 123 void acceptDataFromThreadedReceiver(unsigned long identifier, const char* da ta, int dataLength, int encodedDataLength);
130 124
131 ResourceLoadPriority loadPriority(Resource::Type, const FetchRequest&, Resou rcePriority::VisibilityStatus = ResourcePriority::NotVisible); 125 ResourceLoadPriority loadPriority(Resource::Type, const FetchRequest&, Resou rcePriority::VisibilityStatus = ResourcePriority::NotVisible);
132 126
133 enum ResourceLoadStartType { 127 enum ResourceLoadStartType {
134 ResourceLoadingFromNetwork, 128 ResourceLoadingFromNetwork,
135 ResourceLoadingFromCache 129 ResourceLoadingFromCache
136 }; 130 };
(...skipping 26 matching lines...) Expand all
163 // RevalidationPolicy enum values are used in UMAs https://crbug.com/579496. 157 // RevalidationPolicy enum values are used in UMAs https://crbug.com/579496.
164 enum RevalidationPolicy { Use, Revalidate, Reload, Load }; 158 enum RevalidationPolicy { Use, Revalidate, Reload, Load };
165 RevalidationPolicy determineRevalidationPolicy(Resource::Type, const FetchRe quest&, Resource* existingResource, bool isStaticData) const; 159 RevalidationPolicy determineRevalidationPolicy(Resource::Type, const FetchRe quest&, Resource* existingResource, bool isStaticData) const;
166 160
167 void moveCachedNonBlockingResourceToBlocking(Resource*, const FetchRequest&) ; 161 void moveCachedNonBlockingResourceToBlocking(Resource*, const FetchRequest&) ;
168 void moveResourceLoaderToNonBlocking(ResourceLoader*); 162 void moveResourceLoaderToNonBlocking(ResourceLoader*);
169 void removeResourceLoader(ResourceLoader*); 163 void removeResourceLoader(ResourceLoader*);
170 164
171 void initializeResourceRequest(ResourceRequest&, Resource::Type, FetchReques t::DeferOption); 165 void initializeResourceRequest(ResourceRequest&, Resource::Type, FetchReques t::DeferOption);
172 void willSendRequest(unsigned long identifier, ResourceRequest&, const Resou rceResponse&, const ResourceLoaderOptions&); 166 void willSendRequest(unsigned long identifier, ResourceRequest&, const Resou rceResponse&, const ResourceLoaderOptions&);
167 bool canAccessResponse(Resource*, const ResourceResponse&) const;
173 168
174 bool resourceNeedsLoad(Resource*, const FetchRequest&, RevalidationPolicy); 169 bool resourceNeedsLoad(Resource*, const FetchRequest&, RevalidationPolicy);
175 bool shouldDeferImageLoad(const KURL&) const; 170 bool shouldDeferImageLoad(const KURL&) const;
176 171
177 void resourceTimingReportTimerFired(Timer<ResourceFetcher>*); 172 void resourceTimingReportTimerFired(Timer<ResourceFetcher>*);
178 173
179 void reloadImagesIfNotDeferred(); 174 void reloadImagesIfNotDeferred();
180 175
181 void updateMemoryCacheStats(Resource*, RevalidationPolicy, const FetchReques t&, const ResourceFactory&, bool isStaticData) const; 176 void updateMemoryCacheStats(Resource*, RevalidationPolicy, const FetchReques t&, const ResourceFactory&, bool isStaticData) const;
182 177
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 m_loader->m_allowStaleResources = m_previousState; 235 m_loader->m_allowStaleResources = m_previousState;
241 } 236 }
242 private: 237 private:
243 Member<ResourceFetcher> m_loader; 238 Member<ResourceFetcher> m_loader;
244 bool m_previousState; 239 bool m_previousState;
245 }; 240 };
246 241
247 } // namespace blink 242 } // namespace blink
248 243
249 #endif // ResourceFetcher_h 244 #endif // ResourceFetcher_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698