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

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

Issue 2816403002: test all
Patch Set: fix sharedworker 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/RuntimeEnabledFeatures.h"
41 #include "platform/exported/WrappedResourceRequest.h"
42 #include "platform/loader/fetch/FetchParameters.h"
43 #include "platform/loader/fetch/RawResource.h"
44 #include "public/platform/Platform.h"
45 #include "public/platform/WebURLLoader.h"
46 #include "public/platform/WebURLLoaderClient.h"
39 47
40 namespace blink { 48 namespace blink {
41 49
42 ThreadableLoader* ThreadableLoader::Create( 50 ThreadableLoader* ThreadableLoader::Create(
43 ExecutionContext& context, 51 ExecutionContext& context,
44 ThreadableLoaderClient* client, 52 ThreadableLoaderClient* client,
45 const ThreadableLoaderOptions& options, 53 const ThreadableLoaderOptions& options,
46 const ResourceLoaderOptions& resource_loader_options) { 54 const ResourceLoaderOptions& resource_loader_options) {
47 DCHECK(client); 55 DCHECK(client);
48 56
49 if (context.IsWorkerGlobalScope()) { 57 if (context.IsWorkerGlobalScope()) {
58 if (RuntimeEnabledFeatures::offMainThreadFetchEnabled()) {
59 WorkerFetchContext* worker_fetch_contrext =
60 ToWorkerGlobalScope(&context)->FetchContext();
61 if (worker_fetch_contrext) {
62 return DocumentThreadableLoader::Create(
63 *ThreadableLoadingContext::Create(*ToWorkerGlobalScope(&context)),
64 client, options, resource_loader_options);
65 }
66 }
50 return WorkerThreadableLoader::Create(ToWorkerGlobalScope(context), client, 67 return WorkerThreadableLoader::Create(ToWorkerGlobalScope(context), client,
51 options, resource_loader_options); 68 options, resource_loader_options);
52 } 69 }
53 70
54 return DocumentThreadableLoader::Create( 71 return DocumentThreadableLoader::Create(
55 *ThreadableLoadingContext::Create(*ToDocument(&context)), client, options, 72 *ThreadableLoadingContext::Create(*ToDocument(&context)), client, options,
56 resource_loader_options); 73 resource_loader_options);
57 } 74 }
58 75
59 void ThreadableLoader::LoadResourceSynchronously( 76 void ThreadableLoader::LoadResourceSynchronously(
60 ExecutionContext& context, 77 ExecutionContext& context,
61 const ResourceRequest& request, 78 const ResourceRequest& request,
62 ThreadableLoaderClient& client, 79 ThreadableLoaderClient& client,
63 const ThreadableLoaderOptions& options, 80 const ThreadableLoaderOptions& options,
64 const ResourceLoaderOptions& resource_loader_options) { 81 const ResourceLoaderOptions& resource_loader_options) {
65 if (context.IsWorkerGlobalScope()) { 82 if (context.IsWorkerGlobalScope()) {
66 WorkerThreadableLoader::LoadResourceSynchronously( 83 WorkerThreadableLoader::LoadResourceSynchronously(
67 ToWorkerGlobalScope(context), request, client, options, 84 ToWorkerGlobalScope(context), request, client, options,
68 resource_loader_options); 85 resource_loader_options);
69 return; 86 return;
70 } 87 }
71 88
72 DocumentThreadableLoader::LoadResourceSynchronously( 89 DocumentThreadableLoader::LoadResourceSynchronously(
73 ToDocument(context), request, client, options, resource_loader_options); 90 ToDocument(context), request, client, options, resource_loader_options);
74 } 91 }
75 92
76 } // namespace blink 93 } // 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