OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. |
3 * Copyright (C) 2013, Intel Corporation | 3 * Copyright (C) 2013, Intel Corporation |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 class Document; | 50 class Document; |
51 class KURL; | 51 class KURL; |
52 class ResourceRequest; | 52 class ResourceRequest; |
53 class SecurityOrigin; | 53 class SecurityOrigin; |
54 class ThreadableLoaderClient; | 54 class ThreadableLoaderClient; |
55 | 55 |
56 class CORE_EXPORT DocumentThreadableLoader final : public ThreadableLoader, priv
ate RawResourceClient { | 56 class CORE_EXPORT DocumentThreadableLoader final : public ThreadableLoader, priv
ate RawResourceClient { |
57 USING_FAST_MALLOC(DocumentThreadableLoader); | 57 USING_FAST_MALLOC(DocumentThreadableLoader); |
58 public: | 58 public: |
59 static void loadResourceSynchronously(Document&, const ResourceRequest&,
ThreadableLoaderClient&, const ThreadableLoaderOptions&, const ResourceLoaderOp
tions&); | 59 static void loadResourceSynchronously(Document&, const ResourceRequest&,
ThreadableLoaderClient&, const ThreadableLoaderOptions&, const ResourceLoaderOp
tions&); |
60 static PassRefPtr<DocumentThreadableLoader> create(Document&, Threadable
LoaderClient*, const ResourceRequest&, const ThreadableLoaderOptions&, const Res
ourceLoaderOptions&); | 60 static PassRefPtr<DocumentThreadableLoader> create(Document&, Threadable
LoaderClient*, const ThreadableLoaderOptions&, const ResourceLoaderOptions&); |
61 ~DocumentThreadableLoader() override; | 61 ~DocumentThreadableLoader() override; |
62 | 62 |
| 63 void start(const ResourceRequest&) override; |
| 64 |
63 void overrideTimeout(unsigned long timeout) override; | 65 void overrideTimeout(unsigned long timeout) override; |
64 | 66 |
65 // |this| may be dead after calling this method in async mode. | 67 // |this| may be dead after calling this method in async mode. |
66 void cancel() override; | 68 void cancel() override; |
67 void setDefersLoading(bool); | 69 void setDefersLoading(bool); |
68 | 70 |
69 private: | 71 private: |
70 enum BlockingBehavior { | 72 enum BlockingBehavior { |
71 LoadSynchronously, | 73 LoadSynchronously, |
72 LoadAsynchronously | 74 LoadAsynchronously |
73 }; | 75 }; |
74 | 76 |
75 DocumentThreadableLoader(Document&, ThreadableLoaderClient*, BlockingBeh
avior, const ResourceRequest&, const ThreadableLoaderOptions&, const ResourceLoa
derOptions&); | 77 DocumentThreadableLoader(Document&, ThreadableLoaderClient*, BlockingBeh
avior, const ThreadableLoaderOptions&, const ResourceLoaderOptions&); |
76 | 78 |
77 void clear(); | 79 void clear(); |
78 | 80 |
79 // ResourceClient | 81 // ResourceClient |
80 // | 82 // |
81 // |this| may be dead after calling this method. | 83 // |this| may be dead after calling this method. |
82 void notifyFinished(Resource*) override; | 84 void notifyFinished(Resource*) override; |
83 | 85 |
84 String debugName() const override { return "DocumentThreadableLoader"; } | 86 String debugName() const override { return "DocumentThreadableLoader"; } |
85 | 87 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 // Set to true if the current request is cross-origin and not simple. | 195 // Set to true if the current request is cross-origin and not simple. |
194 bool m_crossOriginNonSimpleRequest; | 196 bool m_crossOriginNonSimpleRequest; |
195 | 197 |
196 // Set to true when the response data is given to a data consumer | 198 // Set to true when the response data is given to a data consumer |
197 // handle. | 199 // handle. |
198 bool m_isUsingDataConsumerHandle; | 200 bool m_isUsingDataConsumerHandle; |
199 | 201 |
200 const bool m_async; | 202 const bool m_async; |
201 | 203 |
202 // Holds the original request context (used for sanity checks). | 204 // Holds the original request context (used for sanity checks). |
203 const WebURLRequest::RequestContext m_requestContext; | 205 WebURLRequest::RequestContext m_requestContext; |
204 | 206 |
205 // Holds the original request for fallback in case the Service Worker | 207 // Holds the original request for fallback in case the Service Worker |
206 // does not respond. | 208 // does not respond. |
207 ResourceRequest m_fallbackRequestForServiceWorker; | 209 ResourceRequest m_fallbackRequestForServiceWorker; |
208 | 210 |
209 // Holds the original request and options for it during preflight | 211 // Holds the original request and options for it during preflight |
210 // request handling phase. | 212 // request handling phase. |
211 ResourceRequest m_actualRequest; | 213 ResourceRequest m_actualRequest; |
212 ResourceLoaderOptions m_actualOptions; | 214 ResourceLoaderOptions m_actualOptions; |
213 | 215 |
214 HTTPHeaderMap m_simpleRequestHeaders; // stores simple request headers i
n case of a cross-origin redirect. | 216 HTTPHeaderMap m_simpleRequestHeaders; // stores simple request headers i
n case of a cross-origin redirect. |
215 Timer<DocumentThreadableLoader> m_timeoutTimer; | 217 Timer<DocumentThreadableLoader> m_timeoutTimer; |
216 double m_requestStartedSeconds; // Time an asynchronous fetch request is
started | 218 double m_requestStartedSeconds; // Time an asynchronous fetch request is
started |
217 | 219 |
218 // Max number of times that this DocumentThreadableLoader can follow | 220 // Max number of times that this DocumentThreadableLoader can follow |
219 // cross-origin redirects. | 221 // cross-origin redirects. |
220 // This is used to limit the number of redirects. | 222 // This is used to limit the number of redirects. |
221 // But this value is not the max number of total redirects allowed, | 223 // But this value is not the max number of total redirects allowed, |
222 // because same-origin redirects are not counted here. | 224 // because same-origin redirects are not counted here. |
223 int m_corsRedirectLimit; | 225 int m_corsRedirectLimit; |
224 | 226 |
225 const WebURLRequest::FetchRedirectMode m_redirectMode; | 227 WebURLRequest::FetchRedirectMode m_redirectMode; |
226 }; | 228 }; |
227 | 229 |
228 } // namespace blink | 230 } // namespace blink |
229 | 231 |
230 #endif // DocumentThreadableLoader_h | 232 #endif // DocumentThreadableLoader_h |
OLD | NEW |