Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(316)

Side by Side Diff: third_party/WebKit/Source/core/loader/ThreadableLoader.cpp

Issue 2701753003: [WIP] off-main-thread loading
Patch Set: small fix Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 16 matching lines...) Expand all
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/ThreadableLoadingContext.h"
37 #include "core/loader/WorkerFetchContext.h"
37 #include "core/loader/WorkerThreadableLoader.h" 38 #include "core/loader/WorkerThreadableLoader.h"
38 #include "core/workers/WorkerGlobalScope.h" 39 #include "core/workers/WorkerGlobalScope.h"
40 #include "platform/exported/WrappedResourceRequest.h"
41 #include "platform/loader/fetch/FetchRequest.h"
42 #include "platform/loader/fetch/RawResource.h"
43 #include "public/platform/Platform.h"
44 #include "public/platform/WebURLLoader.h"
45 #include "public/platform/WebURLLoaderClient.h"
39 46
40 namespace blink { 47 namespace blink {
41 48
42 ThreadableLoader* ThreadableLoader::create( 49 ThreadableLoader* ThreadableLoader::create(
43 ExecutionContext& context, 50 ExecutionContext& context,
44 ThreadableLoaderClient* client, 51 ThreadableLoaderClient* client,
45 const ThreadableLoaderOptions& options, 52 const ThreadableLoaderOptions& options,
46 const ResourceLoaderOptions& resourceLoaderOptions) { 53 const ResourceLoaderOptions& resourceLoaderOptions) {
47 DCHECK(client); 54 DCHECK(client);
48 55
49 if (context.isWorkerGlobalScope()) { 56 if (context.isWorkerGlobalScope()) {
57 WorkerFetchContext* workerFetchContrext = WorkerFetchContext::from(context);
58 if (workerFetchContrext) {
59 return DocumentThreadableLoader::create(
60 *ThreadableLoadingContext::create(*toWorkerGlobalScope(&context)),
61 client, options, resourceLoaderOptions);
62 }
50 return WorkerThreadableLoader::create(toWorkerGlobalScope(context), client, 63 return WorkerThreadableLoader::create(toWorkerGlobalScope(context), client,
51 options, resourceLoaderOptions); 64 options, resourceLoaderOptions);
52 } 65 }
53 66
54 return DocumentThreadableLoader::create( 67 return DocumentThreadableLoader::create(
55 *ThreadableLoadingContext::create(*toDocument(&context)), client, options, 68 *ThreadableLoadingContext::create(*toDocument(&context)), client, options,
56 resourceLoaderOptions); 69 resourceLoaderOptions);
57 } 70 }
58 71
59 void ThreadableLoader::loadResourceSynchronously( 72 void ThreadableLoader::loadResourceSynchronously(
60 ExecutionContext& context, 73 ExecutionContext& context,
61 const ResourceRequest& request, 74 const ResourceRequest& request,
62 ThreadableLoaderClient& client, 75 ThreadableLoaderClient& client,
63 const ThreadableLoaderOptions& options, 76 const ThreadableLoaderOptions& options,
64 const ResourceLoaderOptions& resourceLoaderOptions) { 77 const ResourceLoaderOptions& resourceLoaderOptions) {
65 if (context.isWorkerGlobalScope()) { 78 if (context.isWorkerGlobalScope()) {
66 WorkerThreadableLoader::loadResourceSynchronously( 79 WorkerThreadableLoader::loadResourceSynchronously(
67 toWorkerGlobalScope(context), request, client, options, 80 toWorkerGlobalScope(context), request, client, options,
68 resourceLoaderOptions); 81 resourceLoaderOptions);
69 return; 82 return;
70 } 83 }
71 84
72 DocumentThreadableLoader::loadResourceSynchronously( 85 DocumentThreadableLoader::loadResourceSynchronously(
73 toDocument(context), request, client, options, resourceLoaderOptions); 86 toDocument(context), request, client, options, resourceLoaderOptions);
74 } 87 }
75 88
76 } // namespace blink 89 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/loader/PingLoader.cpp ('k') | third_party/WebKit/Source/core/loader/ThreadableLoadingContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698