Chromium Code Reviews| 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 145 // async failures separately | 145 // async failures separately |
| 146 // | 146 // |
| 147 // Loading completes when one of the following methods are called: | 147 // Loading completes when one of the following methods are called: |
| 148 // - didFinishLoading() | 148 // - didFinishLoading() |
| 149 // - didFail() | 149 // - didFail() |
| 150 // - didFailAccessControlCheck() | 150 // - didFailAccessControlCheck() |
| 151 // - didFailRedirectCheck() | 151 // - didFailRedirectCheck() |
| 152 // After any of these methods is called, the loader won't call any of the | 152 // After any of these methods is called, the loader won't call any of the |
| 153 // ThreadableLoaderClient methods. | 153 // ThreadableLoaderClient methods. |
| 154 // | 154 // |
| 155 // When a ThreadableLoader is destructed, any of the | 155 // A user must guarantee that the loading complete before the attached |
| 156 // ThreadableLoaderClient methods is NOT called in response to the | 156 // client gets invalid. Also, a user must guarantee that the loading |
|
hiroshige
2016/07/19 06:56:14
nits:
s/loading complete /loading completes /
s/th
yhirano
2016/07/19 08:05:03
Done.
| |
| 157 // destruction either synchronously or after destruction. | 157 // completes before the threadable loader is destructed. |
| 158 // | 158 // |
| 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 // std::unique_ptr<ThreadableLoader>). | 169 // std::unique_ptr<ThreadableLoader>). |
| 170 // | |
| 171 // A ThreadableLoader can be destructed only when the loading has already | |
| 172 // completed. | |
|
hiroshige
2016/07/19 06:56:14
Is this equivalent to the comment in Lines 156--15
yhirano
2016/07/19 08:05:04
Thanks, fixed.
| |
| 170 static std::unique_ptr<ThreadableLoader> create(ExecutionContext&, Threadabl eLoaderClient*, const ThreadableLoaderOptions&, const ResourceLoaderOptions&); | 173 static std::unique_ptr<ThreadableLoader> create(ExecutionContext&, Threadabl eLoaderClient*, const ThreadableLoaderOptions&, const ResourceLoaderOptions&); |
| 171 | 174 |
| 172 // The methods on the ThreadableLoaderClient passed on create() call | 175 // The methods on the ThreadableLoaderClient passed on create() call |
| 173 // may be called synchronous to start() call. | 176 // may be called synchronous to start() call. |
| 174 virtual void start(const ResourceRequest&) = 0; | 177 virtual void start(const ResourceRequest&) = 0; |
| 175 | 178 |
| 176 // A ThreadableLoader may have a timeout specified. It is possible, in some cases, for | 179 // 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 | 180 // the timeout to be overridden after the request is sent (for example, XMLH ttpRequests |
| 178 // may override their timeout setting after sending). | 181 // may override their timeout setting after sending). |
| 179 // | 182 // |
| 180 // Set a new timeout relative to the time the request started, in millisecon ds. | 183 // Set a new timeout relative to the time the request started, in millisecon ds. |
| 181 virtual void overrideTimeout(unsigned long timeoutMilliseconds) = 0; | 184 virtual void overrideTimeout(unsigned long timeoutMilliseconds) = 0; |
| 182 | 185 |
| 183 virtual void cancel() = 0; | 186 virtual void cancel() = 0; |
| 184 | 187 |
| 185 virtual ~ThreadableLoader() { } | 188 virtual ~ThreadableLoader() { } |
| 186 | 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 |
| OLD | NEW |