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

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

Issue 1264453002: Split the constructor of ThreadableLoader into two methods (ctor and start()) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Uplaod MockThreadableLoader Created 4 years, 10 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 23 matching lines...) Expand all
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/ThreadableLoaderClientWrapper.h"
37 #include "core/loader/WorkerLoaderClientBridge.h" 37 #include "core/loader/WorkerLoaderClientBridge.h"
38 #include "core/loader/WorkerThreadableLoader.h" 38 #include "core/loader/WorkerThreadableLoader.h"
39 #include "core/workers/WorkerGlobalScope.h" 39 #include "core/workers/WorkerGlobalScope.h"
40 #include "core/workers/WorkerThread.h" 40 #include "core/workers/WorkerThread.h"
41 41
42 namespace blink { 42 namespace blink {
43 43
44 PassRefPtr<ThreadableLoader> ThreadableLoader::create(ExecutionContext& context, ThreadableLoaderClient* client, const ResourceRequest& request, const Threadabl eLoaderOptions& options, const ResourceLoaderOptions& resourceLoaderOptions) 44 PassRefPtr<ThreadableLoader> ThreadableLoader::create(ExecutionContext& context, ThreadableLoaderClient* client, const ThreadableLoaderOptions& options, const R esourceLoaderOptions& resourceLoaderOptions)
45 { 45 {
46 ASSERT(client); 46 ASSERT(client);
47 47
48 if (context.isWorkerGlobalScope()) { 48 if (context.isWorkerGlobalScope()) {
49 WorkerGlobalScope& workerGlobalScope = toWorkerGlobalScope(context); 49 WorkerGlobalScope& workerGlobalScope = toWorkerGlobalScope(context);
50 RefPtr<ThreadableLoaderClientWrapper> clientWrapper(ThreadableLoaderClie ntWrapper::create(client)); 50 RefPtr<ThreadableLoaderClientWrapper> clientWrapper(ThreadableLoaderClie ntWrapper::create(client));
51 OwnPtr<ThreadableLoaderClient> clientBridge(WorkerLoaderClientBridge::cr eate(clientWrapper, workerGlobalScope.thread()->workerLoaderProxy())); 51 OwnPtr<ThreadableLoaderClient> clientBridge(WorkerLoaderClientBridge::cr eate(clientWrapper, workerGlobalScope.thread()->workerLoaderProxy()));
52 return WorkerThreadableLoader::create(workerGlobalScope, clientWrapper, clientBridge.release(), request, options, resourceLoaderOptions); 52 return WorkerThreadableLoader::create(workerGlobalScope, clientWrapper, clientBridge.release(), options, resourceLoaderOptions);
53 } 53 }
54 54
55 return DocumentThreadableLoader::create(toDocument(context), client, request , options, resourceLoaderOptions); 55 return DocumentThreadableLoader::create(toDocument(context), client, options , resourceLoaderOptions);
56 } 56 }
57 57
58 void ThreadableLoader::loadResourceSynchronously(ExecutionContext& context, cons t ResourceRequest& request, ThreadableLoaderClient& client, const ThreadableLoad erOptions& options, const ResourceLoaderOptions& resourceLoaderOptions) 58 void ThreadableLoader::loadResourceSynchronously(ExecutionContext& context, cons t ResourceRequest& request, ThreadableLoaderClient& client, const ThreadableLoad erOptions& options, const ResourceLoaderOptions& resourceLoaderOptions)
59 { 59 {
60 if (context.isWorkerGlobalScope()) { 60 if (context.isWorkerGlobalScope()) {
61 WorkerThreadableLoader::loadResourceSynchronously(toWorkerGlobalScope(co ntext), request, client, options, resourceLoaderOptions); 61 WorkerThreadableLoader::loadResourceSynchronously(toWorkerGlobalScope(co ntext), request, client, options, resourceLoaderOptions);
62 return; 62 return;
63 } 63 }
64 64
65 DocumentThreadableLoader::loadResourceSynchronously(toDocument(context), req uest, client, options, resourceLoaderOptions); 65 DocumentThreadableLoader::loadResourceSynchronously(toDocument(context), req uest, client, options, resourceLoaderOptions);
66 } 66 }
67 67
68 } // namespace blink 68 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698