| 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/ThreadableLoaderClientWrapper.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" |
| 39 #include "core/workers/WorkerThread.h" |
| 40 #include <memory> |
| 38 | 41 |
| 39 namespace blink { | 42 namespace blink { |
| 40 | 43 |
| 41 ThreadableLoader* ThreadableLoader::create(ExecutionContext& context, Threadable
LoaderClient* client, const ThreadableLoaderOptions& options, const ResourceLoad
erOptions& resourceLoaderOptions) | 44 std::unique_ptr<ThreadableLoader> ThreadableLoader::create(ExecutionContext& con
text, ThreadableLoaderClient* client, const ThreadableLoaderOptions& options, co
nst ResourceLoaderOptions& resourceLoaderOptions) |
| 42 { | 45 { |
| 43 ASSERT(client); | 46 ASSERT(client); |
| 44 | 47 |
| 45 if (context.isWorkerGlobalScope()) { | 48 if (context.isWorkerGlobalScope()) { |
| 46 return WorkerThreadableLoader::create(toWorkerGlobalScope(context), clie
nt, options, resourceLoaderOptions); | 49 return WorkerThreadableLoader::create(toWorkerGlobalScope(context), clie
nt, options, resourceLoaderOptions); |
| 47 } | 50 } |
| 48 | 51 |
| 49 return DocumentThreadableLoader::create(toDocument(context), client, options
, resourceLoaderOptions); | 52 return DocumentThreadableLoader::create(toDocument(context), client, options
, resourceLoaderOptions); |
| 50 } | 53 } |
| 51 | 54 |
| 52 void ThreadableLoader::loadResourceSynchronously(ExecutionContext& context, cons
t ResourceRequest& request, ThreadableLoaderClient& client, const ThreadableLoad
erOptions& options, const ResourceLoaderOptions& resourceLoaderOptions) | 55 void ThreadableLoader::loadResourceSynchronously(ExecutionContext& context, cons
t ResourceRequest& request, ThreadableLoaderClient& client, const ThreadableLoad
erOptions& options, const ResourceLoaderOptions& resourceLoaderOptions) |
| 53 { | 56 { |
| 54 if (context.isWorkerGlobalScope()) { | 57 if (context.isWorkerGlobalScope()) { |
| 55 WorkerThreadableLoader::loadResourceSynchronously(toWorkerGlobalScope(co
ntext), request, client, options, resourceLoaderOptions); | 58 WorkerThreadableLoader::loadResourceSynchronously(toWorkerGlobalScope(co
ntext), request, client, options, resourceLoaderOptions); |
| 56 return; | 59 return; |
| 57 } | 60 } |
| 58 | 61 |
| 59 DocumentThreadableLoader::loadResourceSynchronously(toDocument(context), req
uest, client, options, resourceLoaderOptions); | 62 DocumentThreadableLoader::loadResourceSynchronously(toDocument(context), req
uest, client, options, resourceLoaderOptions); |
| 60 } | 63 } |
| 61 | 64 |
| 62 } // namespace blink | 65 } // namespace blink |
| OLD | NEW |