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