| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009, 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2009, 2010 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 signalled = blink::Platform::current()->waitMultipleEvents(events); | 88 signalled = blink::Platform::current()->waitMultipleEvents(events); |
| 89 } | 89 } |
| 90 if (signalled == shutdownEvent) { | 90 if (signalled == shutdownEvent) { |
| 91 loader->cancel(); | 91 loader->cancel(); |
| 92 return; | 92 return; |
| 93 } | 93 } |
| 94 | 94 |
| 95 clientBridgePtr->run(); | 95 clientBridgePtr->run(); |
| 96 } | 96 } |
| 97 | 97 |
| 98 void WorkerThreadableLoader::overrideTimeout(unsigned long timeoutMilliseconds) |
| 99 { |
| 100 m_bridge.overrideTimeout(timeoutMilliseconds); |
| 101 } |
| 102 |
| 98 void WorkerThreadableLoader::cancel() | 103 void WorkerThreadableLoader::cancel() |
| 99 { | 104 { |
| 100 m_bridge.cancel(); | 105 m_bridge.cancel(); |
| 101 } | 106 } |
| 102 | 107 |
| 103 WorkerThreadableLoader::MainThreadBridge::MainThreadBridge( | 108 WorkerThreadableLoader::MainThreadBridge::MainThreadBridge( |
| 104 PassRefPtr<ThreadableLoaderClientWrapper> workerClientWrapper, | 109 PassRefPtr<ThreadableLoaderClientWrapper> workerClientWrapper, |
| 105 PassOwnPtr<ThreadableLoaderClient> clientBridge, | 110 PassOwnPtr<ThreadableLoaderClient> clientBridge, |
| 106 WorkerLoaderProxy& loaderProxy, | 111 WorkerLoaderProxy& loaderProxy, |
| 107 const ResourceRequest& request, const ThreadableLoaderOptions& options, cons
t String& outgoingReferrer) | 112 const ResourceRequest& request, const ThreadableLoaderOptions& options, cons
t String& outgoingReferrer) |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 void WorkerThreadableLoader::MainThreadBridge::destroy() | 150 void WorkerThreadableLoader::MainThreadBridge::destroy() |
| 146 { | 151 { |
| 147 // Ensure that no more client callbacks are done in the worker context's thr
ead. | 152 // Ensure that no more client callbacks are done in the worker context's thr
ead. |
| 148 clearClientWrapper(); | 153 clearClientWrapper(); |
| 149 | 154 |
| 150 // "delete this" and m_mainThreadLoader::deref() on the worker object's thre
ad. | 155 // "delete this" and m_mainThreadLoader::deref() on the worker object's thre
ad. |
| 151 m_loaderProxy.postTaskToLoader( | 156 m_loaderProxy.postTaskToLoader( |
| 152 createCallbackTask(&MainThreadBridge::mainThreadDestroy, AllowCrossThrea
dAccess(this))); | 157 createCallbackTask(&MainThreadBridge::mainThreadDestroy, AllowCrossThrea
dAccess(this))); |
| 153 } | 158 } |
| 154 | 159 |
| 160 void WorkerThreadableLoader::MainThreadBridge::mainThreadOverrideTimeout(Executi
onContext* context, MainThreadBridge* thisPtr, unsigned long timeoutMilliseconds
) |
| 161 { |
| 162 ASSERT(isMainThread()); |
| 163 ASSERT_UNUSED(context, context->isDocument()); |
| 164 |
| 165 if (!thisPtr->m_mainThreadLoader) |
| 166 return; |
| 167 thisPtr->m_mainThreadLoader->overrideTimeout(timeoutMilliseconds); |
| 168 } |
| 169 |
| 155 void WorkerThreadableLoader::MainThreadBridge::mainThreadCancel(ExecutionContext
* context, MainThreadBridge* thisPtr) | 170 void WorkerThreadableLoader::MainThreadBridge::mainThreadCancel(ExecutionContext
* context, MainThreadBridge* thisPtr) |
| 156 { | 171 { |
| 157 ASSERT(isMainThread()); | 172 ASSERT(isMainThread()); |
| 158 ASSERT_UNUSED(context, context->isDocument()); | 173 ASSERT_UNUSED(context, context->isDocument()); |
| 159 | 174 |
| 160 if (!thisPtr->m_mainThreadLoader) | 175 if (!thisPtr->m_mainThreadLoader) |
| 161 return; | 176 return; |
| 162 thisPtr->m_mainThreadLoader->cancel(); | 177 thisPtr->m_mainThreadLoader->cancel(); |
| 163 thisPtr->m_mainThreadLoader = nullptr; | 178 thisPtr->m_mainThreadLoader = nullptr; |
| 164 } | 179 } |
| 165 | 180 |
| 181 void WorkerThreadableLoader::MainThreadBridge::overrideTimeout(unsigned long tim
eoutMilliseconds) |
| 182 { |
| 183 m_loaderProxy.postTaskToLoader( |
| 184 createCallbackTask(&MainThreadBridge::mainThreadOverrideTimeout, AllowCr
ossThreadAccess(this), |
| 185 timeoutMilliseconds)); |
| 186 } |
| 187 |
| 166 void WorkerThreadableLoader::MainThreadBridge::cancel() | 188 void WorkerThreadableLoader::MainThreadBridge::cancel() |
| 167 { | 189 { |
| 168 m_loaderProxy.postTaskToLoader( | 190 m_loaderProxy.postTaskToLoader( |
| 169 createCallbackTask(&MainThreadBridge::mainThreadCancel, AllowCrossThread
Access(this))); | 191 createCallbackTask(&MainThreadBridge::mainThreadCancel, AllowCrossThread
Access(this))); |
| 170 ThreadableLoaderClientWrapper* clientWrapper = m_workerClientWrapper.get(); | 192 ThreadableLoaderClientWrapper* clientWrapper = m_workerClientWrapper.get(); |
| 171 if (!clientWrapper->done()) { | 193 if (!clientWrapper->done()) { |
| 172 // If the client hasn't reached a termination state, then transition it
by sending a cancellation error. | 194 // If the client hasn't reached a termination state, then transition it
by sending a cancellation error. |
| 173 // Note: no more client callbacks will be done after this method -- the
clearClientWrapper() call ensures that. | 195 // Note: no more client callbacks will be done after this method -- the
clearClientWrapper() call ensures that. |
| 174 ResourceError error(String(), 0, String(), String()); | 196 ResourceError error(String(), 0, String(), String()); |
| 175 error.setIsCancellation(true); | 197 error.setIsCancellation(true); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 { | 244 { |
| 223 m_clientBridge->didFailAccessControlCheck(error); | 245 m_clientBridge->didFailAccessControlCheck(error); |
| 224 } | 246 } |
| 225 | 247 |
| 226 void WorkerThreadableLoader::MainThreadBridge::didFailRedirectCheck() | 248 void WorkerThreadableLoader::MainThreadBridge::didFailRedirectCheck() |
| 227 { | 249 { |
| 228 m_clientBridge->didFailRedirectCheck(); | 250 m_clientBridge->didFailRedirectCheck(); |
| 229 } | 251 } |
| 230 | 252 |
| 231 } // namespace WebCore | 253 } // namespace WebCore |
| OLD | NEW |