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

Side by Side Diff: third_party/WebKit/Source/core/loader/ThreadableLoader.h

Issue 2181243002: Move ThreadableLoader to Oilpan heap (2/3) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@onheap-bridge-peer-in-worker-threadable-loader
Patch Set: fix Created 4 years, 4 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) 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 16 matching lines...) Expand all
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
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 "platform/heap/Handle.h"
37 #include "wtf/Allocator.h" 38 #include "wtf/Allocator.h"
38 #include "wtf/Noncopyable.h" 39 #include "wtf/Noncopyable.h"
39 #include <memory> 40 #include <memory>
40 41
41 namespace blink { 42 namespace blink {
42 43
43 class ResourceRequest; 44 class ResourceRequest;
44 class ExecutionContext; 45 class ExecutionContext;
45 class ThreadableLoaderClient; 46 class ThreadableLoaderClient;
46 47
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 // just able to run on threads other than the main thread). 120 // just able to run on threads other than the main thread).
120 // 121 //
121 // Arguments common to both loadResourceSynchronously() and create(): 122 // Arguments common to both loadResourceSynchronously() and create():
122 // 123 //
123 // - ThreadableLoaderOptions argument configures this ThreadableLoader's 124 // - ThreadableLoaderOptions argument configures this ThreadableLoader's
124 // behavior. 125 // behavior.
125 // 126 //
126 // - ResourceLoaderOptions argument will be passed to the FetchRequest 127 // - ResourceLoaderOptions argument will be passed to the FetchRequest
127 // that this ThreadableLoader creates. It can be altered e.g. when 128 // that this ThreadableLoader creates. It can be altered e.g. when
128 // redirect happens. 129 // redirect happens.
129 class CORE_EXPORT ThreadableLoader { 130 class CORE_EXPORT ThreadableLoader : public GarbageCollectedFinalized<Threadable Loader> {
130 WTF_MAKE_NONCOPYABLE(ThreadableLoader); 131 WTF_MAKE_NONCOPYABLE(ThreadableLoader);
131 public: 132 public:
132 // ThreadableLoaderClient methods may not destroy the ThreadableLoader 133 // ThreadableLoaderClient methods may not destroy the ThreadableLoader
133 // instance in them. 134 // instance in them.
134 static void loadResourceSynchronously(ExecutionContext&, const ResourceReque st&, ThreadableLoaderClient&, const ThreadableLoaderOptions&, const ResourceLoad erOptions&); 135 static void loadResourceSynchronously(ExecutionContext&, const ResourceReque st&, ThreadableLoaderClient&, const ThreadableLoaderOptions&, const ResourceLoad erOptions&);
135 136
136 // This method never returns nullptr. 137 // This method never returns nullptr.
137 // 138 //
138 // This method must always be followed by start() call. 139 // This method must always be followed by start() call.
139 // ThreadableLoaderClient methods are never called before start() call. 140 // ThreadableLoaderClient methods are never called before start() call.
(...skipping 20 matching lines...) Expand all
160 // ThreadableLoaderClient::didFail() is called with a ResourceError 161 // ThreadableLoaderClient::didFail() is called with a ResourceError
161 // with isCancellation() returning true, if any of didFinishLoading() 162 // with isCancellation() returning true, if any of didFinishLoading()
162 // or didFail.*() methods have not been called yet. (didFail() may be 163 // or didFail.*() methods have not been called yet. (didFail() may be
163 // called with a ResourceError with isCancellation() returning true 164 // called with a ResourceError with isCancellation() returning true
164 // also for cancellation happened inside the loader.) 165 // also for cancellation happened inside the loader.)
165 // 166 //
166 // ThreadableLoaderClient methods: 167 // ThreadableLoaderClient methods:
167 // - may call cancel() 168 // - may call cancel()
168 // - can destroy the ThreadableLoader instance in them (by clearing 169 // - can destroy the ThreadableLoader instance in them (by clearing
169 // std::unique_ptr<ThreadableLoader>). 170 // std::unique_ptr<ThreadableLoader>).
170 static std::unique_ptr<ThreadableLoader> create(ExecutionContext&, Threadabl eLoaderClient*, const ThreadableLoaderOptions&, const ResourceLoaderOptions&); 171 static ThreadableLoader* create(ExecutionContext&, ThreadableLoaderClient*, const ThreadableLoaderOptions&, const ResourceLoaderOptions&);
171 172
172 // The methods on the ThreadableLoaderClient passed on create() call 173 // The methods on the ThreadableLoaderClient passed on create() call
173 // may be called synchronous to start() call. 174 // may be called synchronous to start() call.
174 virtual void start(const ResourceRequest&) = 0; 175 virtual void start(const ResourceRequest&) = 0;
175 176
176 // A ThreadableLoader may have a timeout specified. It is possible, in some cases, for 177 // 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 178 // the timeout to be overridden after the request is sent (for example, XMLH ttpRequests
178 // may override their timeout setting after sending). 179 // may override their timeout setting after sending).
179 // 180 //
180 // Set a new timeout relative to the time the request started, in millisecon ds. 181 // Set a new timeout relative to the time the request started, in millisecon ds.
181 virtual void overrideTimeout(unsigned long timeoutMilliseconds) = 0; 182 virtual void overrideTimeout(unsigned long timeoutMilliseconds) = 0;
182 183
183 virtual void cancel() = 0; 184 virtual void cancel() = 0;
184 185
185 virtual ~ThreadableLoader() { } 186 virtual ~ThreadableLoader() { }
186 187
188 DEFINE_INLINE_VIRTUAL_TRACE() {}
189
187 protected: 190 protected:
188 ThreadableLoader() { } 191 ThreadableLoader() { }
189 }; 192 };
190 193
191 } // namespace blink 194 } // namespace blink
192 195
193 #endif // ThreadableLoader_h 196 #endif // ThreadableLoader_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698