OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 18 matching lines...) Expand all Loading... |
29 */ | 29 */ |
30 | 30 |
31 #ifndef ThreadableLoader_h | 31 #ifndef ThreadableLoader_h |
32 #define ThreadableLoader_h | 32 #define ThreadableLoader_h |
33 | 33 |
34 #include "core/CoreExport.h" | 34 #include "core/CoreExport.h" |
35 #include "core/fetch/ResourceLoaderOptions.h" | 35 #include "core/fetch/ResourceLoaderOptions.h" |
36 #include "platform/CrossThreadCopier.h" | 36 #include "platform/CrossThreadCopier.h" |
37 #include "wtf/Allocator.h" | 37 #include "wtf/Allocator.h" |
38 #include "wtf/Noncopyable.h" | 38 #include "wtf/Noncopyable.h" |
39 #include "wtf/PassOwnPtr.h" | 39 #include <memory> |
40 | 40 |
41 namespace blink { | 41 namespace blink { |
42 | 42 |
43 class ResourceRequest; | 43 class ResourceRequest; |
44 class ExecutionContext; | 44 class ExecutionContext; |
45 class ThreadableLoaderClient; | 45 class ThreadableLoaderClient; |
46 | 46 |
47 enum CrossOriginRequestPolicy { | 47 enum CrossOriginRequestPolicy { |
48 DenyCrossOriginRequests, | 48 DenyCrossOriginRequests, |
49 UseAccessControl, | 49 UseAccessControl, |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 // When ThreadableLoader::cancel() is called, | 159 // When ThreadableLoader::cancel() is called, |
160 // ThreadableLoaderClient::didFail() is called with a ResourceError | 160 // ThreadableLoaderClient::didFail() is called with a ResourceError |
161 // with isCancellation() returning true, if any of didFinishLoading() | 161 // with isCancellation() returning true, if any of didFinishLoading() |
162 // or didFail.*() methods have not been called yet. (didFail() may be | 162 // or didFail.*() methods have not been called yet. (didFail() may be |
163 // called with a ResourceError with isCancellation() returning true | 163 // called with a ResourceError with isCancellation() returning true |
164 // also for cancellation happened inside the loader.) | 164 // also for cancellation happened inside the loader.) |
165 // | 165 // |
166 // ThreadableLoaderClient methods: | 166 // ThreadableLoaderClient methods: |
167 // - may call cancel() | 167 // - may call cancel() |
168 // - can destroy the ThreadableLoader instance in them (by clearing | 168 // - can destroy the ThreadableLoader instance in them (by clearing |
169 // OwnPtr<ThreadableLoader>). | 169 // std::unique_ptr<ThreadableLoader>). |
170 static PassOwnPtr<ThreadableLoader> create(ExecutionContext&, ThreadableLoad
erClient*, const ThreadableLoaderOptions&, const ResourceLoaderOptions&); | 170 static std::unique_ptr<ThreadableLoader> create(ExecutionContext&, Threadabl
eLoaderClient*, const ThreadableLoaderOptions&, const ResourceLoaderOptions&); |
171 | 171 |
172 // The methods on the ThreadableLoaderClient passed on create() call | 172 // The methods on the ThreadableLoaderClient passed on create() call |
173 // may be called synchronous to start() call. | 173 // may be called synchronous to start() call. |
174 virtual void start(const ResourceRequest&) = 0; | 174 virtual void start(const ResourceRequest&) = 0; |
175 | 175 |
176 // A ThreadableLoader may have a timeout specified. It is possible, in some
cases, for | 176 // A ThreadableLoader may have a timeout specified. It is possible, in some
cases, for |
177 // the timeout to be overridden after the request is sent (for example, XMLH
ttpRequests | 177 // the timeout to be overridden after the request is sent (for example, XMLH
ttpRequests |
178 // may override their timeout setting after sending). | 178 // may override their timeout setting after sending). |
179 // | 179 // |
180 // Set a new timeout relative to the time the request started, in millisecon
ds. | 180 // Set a new timeout relative to the time the request started, in millisecon
ds. |
181 virtual void overrideTimeout(unsigned long timeoutMilliseconds) = 0; | 181 virtual void overrideTimeout(unsigned long timeoutMilliseconds) = 0; |
182 | 182 |
183 virtual void cancel() = 0; | 183 virtual void cancel() = 0; |
184 | 184 |
185 virtual ~ThreadableLoader() { } | 185 virtual ~ThreadableLoader() { } |
186 | 186 |
187 protected: | 187 protected: |
188 ThreadableLoader() { } | 188 ThreadableLoader() { } |
189 }; | 189 }; |
190 | 190 |
191 } // namespace blink | 191 } // namespace blink |
192 | 192 |
193 #endif // ThreadableLoader_h | 193 #endif // ThreadableLoader_h |
OLD | NEW |