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

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

Issue 2436623004: [Fetch, Loader] Expect on-heap objects will never get destroyed with a reference (Closed)
Patch Set: Created 4 years, 2 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 // behavior. 124 // behavior.
125 // 125 //
126 // - ResourceLoaderOptions argument will be passed to the FetchRequest 126 // - ResourceLoaderOptions argument will be passed to the FetchRequest
127 // that this ThreadableLoader creates. It can be altered e.g. when 127 // that this ThreadableLoader creates. It can be altered e.g. when
128 // redirect happens. 128 // redirect happens.
129 class CORE_EXPORT ThreadableLoader 129 class CORE_EXPORT ThreadableLoader
130 : public GarbageCollectedFinalized<ThreadableLoader> { 130 : public GarbageCollectedFinalized<ThreadableLoader> {
131 WTF_MAKE_NONCOPYABLE(ThreadableLoader); 131 WTF_MAKE_NONCOPYABLE(ThreadableLoader);
132 132
133 public: 133 public:
134 // ThreadableLoaderClient methods may not destroy the ThreadableLoader
135 // instance in them.
136 static void loadResourceSynchronously(ExecutionContext&, 134 static void loadResourceSynchronously(ExecutionContext&,
137 const ResourceRequest&, 135 const ResourceRequest&,
138 ThreadableLoaderClient&, 136 ThreadableLoaderClient&,
139 const ThreadableLoaderOptions&, 137 const ThreadableLoaderOptions&,
140 const ResourceLoaderOptions&); 138 const ResourceLoaderOptions&);
141 139
142 // This method never returns nullptr. 140 // This method never returns nullptr.
143 // 141 //
144 // This method must always be followed by start() call. 142 // This method must always be followed by start() call.
145 // ThreadableLoaderClient methods are never called before start() call. 143 // ThreadableLoaderClient methods are never called before start() call.
(...skipping 15 matching lines...) Expand all
161 // A user must guarantee that the loading completes before the attached 159 // A user must guarantee that the loading completes before the attached
162 // client gets invalid. Also, a user must guarantee that the loading 160 // client gets invalid. Also, a user must guarantee that the loading
163 // completes before the ThreadableLoader is destructed. 161 // completes before the ThreadableLoader is destructed.
164 // 162 //
165 // When ThreadableLoader::cancel() is called, 163 // When ThreadableLoader::cancel() is called,
166 // ThreadableLoaderClient::didFail() is called with a ResourceError 164 // ThreadableLoaderClient::didFail() is called with a ResourceError
167 // with isCancellation() returning true, if any of didFinishLoading() 165 // with isCancellation() returning true, if any of didFinishLoading()
168 // or didFail.*() methods have not been called yet. (didFail() may be 166 // or didFail.*() methods have not been called yet. (didFail() may be
169 // called with a ResourceError with isCancellation() returning true 167 // called with a ResourceError with isCancellation() returning true
170 // also for cancellation happened inside the loader.) 168 // also for cancellation happened inside the loader.)
171 //
172 // ThreadableLoaderClient methods:
hiroshige 2016/10/21 05:45:14 Isn't the part of "ThreadableLoaderClient methods
yhirano 2016/10/26 11:09:34 You're right, thanks.
173 // - may call cancel()
174 // - can destroy the ThreadableLoader instance in them (by clearing
175 // std::unique_ptr<ThreadableLoader>).
176 static ThreadableLoader* create(ExecutionContext&, 169 static ThreadableLoader* create(ExecutionContext&,
177 ThreadableLoaderClient*, 170 ThreadableLoaderClient*,
178 const ThreadableLoaderOptions&, 171 const ThreadableLoaderOptions&,
179 const ResourceLoaderOptions&); 172 const ResourceLoaderOptions&);
180 173
181 // The methods on the ThreadableLoaderClient passed on create() call 174 // The methods on the ThreadableLoaderClient passed on create() call
182 // may be called synchronous to start() call. 175 // may be called synchronous to start() call.
183 virtual void start(const ResourceRequest&) = 0; 176 virtual void start(const ResourceRequest&) = 0;
184 177
185 // A ThreadableLoader may have a timeout specified. It is possible, in some 178 // A ThreadableLoader may have a timeout specified. It is possible, in some
(...skipping 10 matching lines...) Expand all
196 189
197 DEFINE_INLINE_VIRTUAL_TRACE() {} 190 DEFINE_INLINE_VIRTUAL_TRACE() {}
198 191
199 protected: 192 protected:
200 ThreadableLoader() {} 193 ThreadableLoader() {}
201 }; 194 };
202 195
203 } // namespace blink 196 } // namespace blink
204 197
205 #endif // ThreadableLoader_h 198 #endif // ThreadableLoader_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698