| 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 15 matching lines...) Expand all Loading... |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 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 #include "core/loader/ThreadableLoader.h" | 31 #include "core/loader/ThreadableLoader.h" |
| 32 | 32 |
| 33 #include "core/dom/Document.h" | 33 #include "core/dom/Document.h" |
| 34 #include "core/dom/ExecutionContext.h" | 34 #include "core/dom/ExecutionContext.h" |
| 35 #include "core/loader/DocumentThreadableLoader.h" | 35 #include "core/loader/DocumentThreadableLoader.h" |
| 36 #include "core/loader/ThreadableLoadingContext.h" |
| 36 #include "core/loader/WorkerThreadableLoader.h" | 37 #include "core/loader/WorkerThreadableLoader.h" |
| 37 #include "core/workers/WorkerGlobalScope.h" | 38 #include "core/workers/WorkerGlobalScope.h" |
| 38 | 39 |
| 39 namespace blink { | 40 namespace blink { |
| 40 | 41 |
| 41 ThreadableLoader* ThreadableLoader::create( | 42 ThreadableLoader* ThreadableLoader::create( |
| 42 ExecutionContext& context, | 43 ExecutionContext& context, |
| 43 ThreadableLoaderClient* client, | 44 ThreadableLoaderClient* client, |
| 44 const ThreadableLoaderOptions& options, | 45 const ThreadableLoaderOptions& options, |
| 45 const ResourceLoaderOptions& resourceLoaderOptions) { | 46 const ResourceLoaderOptions& resourceLoaderOptions) { |
| 46 DCHECK(client); | 47 DCHECK(client); |
| 47 | 48 |
| 48 if (context.isWorkerGlobalScope()) { | 49 if (context.isWorkerGlobalScope()) { |
| 49 return WorkerThreadableLoader::create(toWorkerGlobalScope(context), client, | 50 return WorkerThreadableLoader::create(toWorkerGlobalScope(context), client, |
| 50 options, resourceLoaderOptions); | 51 options, resourceLoaderOptions); |
| 51 } | 52 } |
| 52 | 53 |
| 53 return DocumentThreadableLoader::create(toDocument(context), client, options, | 54 return DocumentThreadableLoader::create( |
| 54 resourceLoaderOptions); | 55 *ThreadableLoadingContext::create(*toDocument(&context)), client, options, |
| 56 resourceLoaderOptions); |
| 55 } | 57 } |
| 56 | 58 |
| 57 void ThreadableLoader::loadResourceSynchronously( | 59 void ThreadableLoader::loadResourceSynchronously( |
| 58 ExecutionContext& context, | 60 ExecutionContext& context, |
| 59 const ResourceRequest& request, | 61 const ResourceRequest& request, |
| 60 ThreadableLoaderClient& client, | 62 ThreadableLoaderClient& client, |
| 61 const ThreadableLoaderOptions& options, | 63 const ThreadableLoaderOptions& options, |
| 62 const ResourceLoaderOptions& resourceLoaderOptions) { | 64 const ResourceLoaderOptions& resourceLoaderOptions) { |
| 63 if (context.isWorkerGlobalScope()) { | 65 if (context.isWorkerGlobalScope()) { |
| 64 WorkerThreadableLoader::loadResourceSynchronously( | 66 WorkerThreadableLoader::loadResourceSynchronously( |
| 65 toWorkerGlobalScope(context), request, client, options, | 67 toWorkerGlobalScope(context), request, client, options, |
| 66 resourceLoaderOptions); | 68 resourceLoaderOptions); |
| 67 return; | 69 return; |
| 68 } | 70 } |
| 69 | 71 |
| 70 DocumentThreadableLoader::loadResourceSynchronously( | 72 DocumentThreadableLoader::loadResourceSynchronously( |
| 71 toDocument(context), request, client, options, resourceLoaderOptions); | 73 toDocument(context), request, client, options, resourceLoaderOptions); |
| 72 } | 74 } |
| 73 | 75 |
| 74 } // namespace blink | 76 } // namespace blink |
| OLD | NEW |