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 20 matching lines...) Expand all Loading... |
31 #include "config.h" | 31 #include "config.h" |
32 #include "core/loader/ThreadableLoader.h" | 32 #include "core/loader/ThreadableLoader.h" |
33 | 33 |
34 #include "core/dom/Document.h" | 34 #include "core/dom/Document.h" |
35 #include "core/dom/ExecutionContext.h" | 35 #include "core/dom/ExecutionContext.h" |
36 #include "core/loader/DocumentThreadableLoader.h" | 36 #include "core/loader/DocumentThreadableLoader.h" |
37 #include "core/loader/ThreadableLoaderClientWrapper.h" | 37 #include "core/loader/ThreadableLoaderClientWrapper.h" |
38 #include "core/loader/WorkerLoaderClientBridge.h" | 38 #include "core/loader/WorkerLoaderClientBridge.h" |
39 #include "core/loader/WorkerThreadableLoader.h" | 39 #include "core/loader/WorkerThreadableLoader.h" |
40 #include "core/workers/WorkerGlobalScope.h" | 40 #include "core/workers/WorkerGlobalScope.h" |
41 #include "core/workers/WorkerThread.h" | 41 #include "core/workers/WorkerScript.h" |
42 | 42 |
43 namespace blink { | 43 namespace blink { |
44 | 44 |
45 PassRefPtr<ThreadableLoader> ThreadableLoader::create(ExecutionContext& context,
ThreadableLoaderClient* client, const ResourceRequest& request, const Threadabl
eLoaderOptions& options, const ResourceLoaderOptions& resourceLoaderOptions) | 45 PassRefPtr<ThreadableLoader> ThreadableLoader::create(ExecutionContext& context,
ThreadableLoaderClient* client, const ResourceRequest& request, const Threadabl
eLoaderOptions& options, const ResourceLoaderOptions& resourceLoaderOptions) |
46 { | 46 { |
47 ASSERT(client); | 47 ASSERT(client); |
48 | 48 |
49 if (context.isWorkerGlobalScope()) { | 49 if (context.isWorkerGlobalScope()) { |
50 WorkerGlobalScope& workerGlobalScope = toWorkerGlobalScope(context); | 50 WorkerGlobalScope& workerGlobalScope = toWorkerGlobalScope(context); |
51 RefPtr<ThreadableLoaderClientWrapper> clientWrapper(ThreadableLoaderClie
ntWrapper::create(client)); | 51 RefPtr<ThreadableLoaderClientWrapper> clientWrapper(ThreadableLoaderClie
ntWrapper::create(client)); |
52 OwnPtr<ThreadableLoaderClient> clientBridge(WorkerLoaderClientBridge::cr
eate(clientWrapper, workerGlobalScope.thread()->workerLoaderProxy())); | 52 OwnPtr<ThreadableLoaderClient> clientBridge(WorkerLoaderClientBridge::cr
eate(clientWrapper, workerGlobalScope.script()->workerLoaderProxy())); |
53 return WorkerThreadableLoader::create(workerGlobalScope, clientWrapper,
clientBridge.release(), request, options, resourceLoaderOptions); | 53 return WorkerThreadableLoader::create(workerGlobalScope, clientWrapper,
clientBridge.release(), request, options, resourceLoaderOptions); |
54 } | 54 } |
55 | 55 |
56 return DocumentThreadableLoader::create(toDocument(context), client, request
, options, resourceLoaderOptions); | 56 return DocumentThreadableLoader::create(toDocument(context), client, request
, options, resourceLoaderOptions); |
57 } | 57 } |
58 | 58 |
59 void ThreadableLoader::loadResourceSynchronously(ExecutionContext& context, cons
t ResourceRequest& request, ThreadableLoaderClient& client, const ThreadableLoad
erOptions& options, const ResourceLoaderOptions& resourceLoaderOptions) | 59 void ThreadableLoader::loadResourceSynchronously(ExecutionContext& context, cons
t ResourceRequest& request, ThreadableLoaderClient& client, const ThreadableLoad
erOptions& options, const ResourceLoaderOptions& resourceLoaderOptions) |
60 { | 60 { |
61 if (context.isWorkerGlobalScope()) { | 61 if (context.isWorkerGlobalScope()) { |
62 WorkerThreadableLoader::loadResourceSynchronously(toWorkerGlobalScope(co
ntext), request, client, options, resourceLoaderOptions); | 62 WorkerThreadableLoader::loadResourceSynchronously(toWorkerGlobalScope(co
ntext), request, client, options, resourceLoaderOptions); |
63 return; | 63 return; |
64 } | 64 } |
65 | 65 |
66 DocumentThreadableLoader::loadResourceSynchronously(toDocument(context), req
uest, client, options, resourceLoaderOptions); | 66 DocumentThreadableLoader::loadResourceSynchronously(toDocument(context), req
uest, client, options, resourceLoaderOptions); |
67 } | 67 } |
68 | 68 |
69 } // namespace blink | 69 } // namespace blink |
OLD | NEW |