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

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

Issue 2487763003: [ImageLoader 2d] Set DecodeError by calling ResourceLoader::cancel()
Patch Set: Rebase Created 4 years, 1 month 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) 2005, 2006, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2006, 2011 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 12 matching lines...) Expand all
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28 28
29 #ifndef ResourceLoader_h 29 #ifndef ResourceLoader_h
30 #define ResourceLoader_h 30 #define ResourceLoader_h
31 31
32 #include "core/CoreExport.h" 32 #include "core/CoreExport.h"
33 #include "core/fetch/Resource.h"
33 #include "core/fetch/ResourceLoaderOptions.h" 34 #include "core/fetch/ResourceLoaderOptions.h"
34 #include "platform/network/ResourceRequest.h" 35 #include "platform/network/ResourceRequest.h"
35 #include "public/platform/WebURLLoader.h" 36 #include "public/platform/WebURLLoader.h"
36 #include "public/platform/WebURLLoaderClient.h" 37 #include "public/platform/WebURLLoaderClient.h"
37 #include "wtf/Forward.h" 38 #include "wtf/Forward.h"
38 #include <memory> 39 #include <memory>
39 40
40 namespace blink { 41 namespace blink {
41 42
42 class Resource; 43 class Resource;
(...skipping 12 matching lines...) Expand all
55 WebTaskRunner* loadingTaskRunner, 56 WebTaskRunner* loadingTaskRunner,
56 bool defersLoading); 57 bool defersLoading);
57 58
58 // This method is currently only used for service worker fallback request and 59 // This method is currently only used for service worker fallback request and
59 // cache-aware loading, other users should be careful not to break 60 // cache-aware loading, other users should be careful not to break
60 // ResourceLoader state. 61 // ResourceLoader state.
61 void restart(const ResourceRequest&, 62 void restart(const ResourceRequest&,
62 WebTaskRunner* loadingTaskRunner, 63 WebTaskRunner* loadingTaskRunner,
63 bool defersLoading); 64 bool defersLoading);
64 65
65 void cancel(); 66 void cancel(Resource::Status errorStatus = Resource::LoadError);
66 67
67 void setDefersLoading(bool); 68 void setDefersLoading(bool);
68 69
69 void didChangePriority(ResourceLoadPriority, int intraPriorityValue); 70 void didChangePriority(ResourceLoadPriority, int intraPriorityValue);
70 71
71 // Called before start() to activate cache-aware loading if enabled in 72 // Called before start() to activate cache-aware loading if enabled in
72 // |m_resource->options()| and applicable. 73 // |m_resource->options()| and applicable.
73 void activateCacheAwareLoadingIfNeeded(const ResourceRequest&); 74 void activateCacheAwareLoadingIfNeeded(const ResourceRequest&);
74 75
75 bool isCacheAwareLoadingActivated() const { 76 bool isCacheAwareLoadingActivated() const {
(...skipping 30 matching lines...) Expand all
106 int, 107 int,
107 int encodedDataLength, 108 int encodedDataLength,
108 int encodedBodyLength) override; 109 int encodedBodyLength) override;
109 void didDownloadData(WebURLLoader*, int, int) override; 110 void didDownloadData(WebURLLoader*, int, int) override;
110 void didFinishLoading(WebURLLoader*, 111 void didFinishLoading(WebURLLoader*,
111 double finishTime, 112 double finishTime,
112 int64_t encodedDataLength) override; 113 int64_t encodedDataLength) override;
113 void didFail(WebURLLoader*, const WebURLError&) override; 114 void didFail(WebURLLoader*, const WebURLError&) override;
114 115
115 void didFinishLoadingFirstPartInMultipart(); 116 void didFinishLoadingFirstPartInMultipart();
116 void didFail(const ResourceError&); 117 void didFail(const ResourceError&, Resource::Status errorStatus);
117 118
118 private: 119 private:
119 // Assumes ResourceFetcher and Resource are non-null. 120 // Assumes ResourceFetcher and Resource are non-null.
120 ResourceLoader(ResourceFetcher*, Resource*); 121 ResourceLoader(ResourceFetcher*, Resource*);
121 122
122 void cancelForRedirectAccessCheckError(const KURL&); 123 void cancelForRedirectAccessCheckError(const KURL&);
123 void requestSynchronously(const ResourceRequest&); 124 void requestSynchronously(const ResourceRequest&);
124 125
125 std::unique_ptr<WebURLLoader> m_loader; 126 std::unique_ptr<WebURLLoader> m_loader;
126 Member<ResourceFetcher> m_fetcher; 127 Member<ResourceFetcher> m_fetcher;
127 Member<Resource> m_resource; 128 Member<Resource> m_resource;
128 bool m_isCacheAwareLoadingActivated; 129 bool m_isCacheAwareLoadingActivated;
129 }; 130 };
130 131
131 } // namespace blink 132 } // namespace blink
132 133
133 #endif 134 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp ('k') | third_party/WebKit/Source/core/fetch/ResourceLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698