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