OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009, 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2009, 2010 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 | 32 |
33 #include "core/loader/WorkerThreadableLoader.h" | 33 #include "core/loader/WorkerThreadableLoader.h" |
34 | 34 |
35 #include "core/dom/CrossThreadTask.h" | 35 #include "core/dom/CrossThreadTask.h" |
36 #include "core/dom/Document.h" | 36 #include "core/dom/Document.h" |
37 #include "core/loader/DocumentThreadableLoader.h" | 37 #include "core/loader/DocumentThreadableLoader.h" |
38 #include "core/loader/WorkerLoaderClientBridgeSyncHelper.h" | 38 #include "core/loader/WorkerLoaderClientBridgeSyncHelper.h" |
39 #include "core/workers/WorkerGlobalScope.h" | 39 #include "core/workers/WorkerGlobalScope.h" |
40 #include "core/workers/WorkerLoaderProxy.h" | 40 #include "core/workers/WorkerLoaderProxy.h" |
41 #include "core/workers/WorkerThread.h" | 41 #include "core/workers/WorkerScript.h" |
42 #include "platform/heap/SafePoint.h" | 42 #include "platform/heap/SafePoint.h" |
43 #include "platform/network/ResourceError.h" | 43 #include "platform/network/ResourceError.h" |
44 #include "platform/network/ResourceRequest.h" | 44 #include "platform/network/ResourceRequest.h" |
45 #include "platform/network/ResourceResponse.h" | 45 #include "platform/network/ResourceResponse.h" |
46 #include "platform/weborigin/SecurityPolicy.h" | 46 #include "platform/weborigin/SecurityPolicy.h" |
47 #include "public/platform/Platform.h" | 47 #include "public/platform/Platform.h" |
48 #include "public/platform/WebWaitableEvent.h" | 48 #include "public/platform/WebWaitableEvent.h" |
49 #include "wtf/MainThread.h" | 49 #include "wtf/MainThread.h" |
50 #include "wtf/OwnPtr.h" | 50 #include "wtf/OwnPtr.h" |
51 #include "wtf/Vector.h" | 51 #include "wtf/Vector.h" |
52 | 52 |
53 namespace blink { | 53 namespace blink { |
54 | 54 |
55 WorkerThreadableLoader::WorkerThreadableLoader(WorkerGlobalScope& workerGlobalSc
ope, PassRefPtr<ThreadableLoaderClientWrapper> clientWrapper, PassOwnPtr<Threada
bleLoaderClient> clientBridge, const ResourceRequest& request, const ThreadableL
oaderOptions& options, const ResourceLoaderOptions& resourceLoaderOptions) | 55 WorkerThreadableLoader::WorkerThreadableLoader(WorkerGlobalScope& workerGlobalSc
ope, PassRefPtr<ThreadableLoaderClientWrapper> clientWrapper, PassOwnPtr<Threada
bleLoaderClient> clientBridge, const ResourceRequest& request, const ThreadableL
oaderOptions& options, const ResourceLoaderOptions& resourceLoaderOptions) |
56 : m_workerGlobalScope(&workerGlobalScope) | 56 : m_workerGlobalScope(&workerGlobalScope) |
57 , m_workerClientWrapper(clientWrapper) | 57 , m_workerClientWrapper(clientWrapper) |
58 , m_bridge(*(new MainThreadBridge(m_workerClientWrapper, clientBridge, worke
rGlobalScope.thread()->workerLoaderProxy(), request, options, resourceLoaderOpti
ons, workerGlobalScope.referrerPolicy(), workerGlobalScope.url().strippedForUseA
sReferrer()))) | 58 , m_bridge(*(new MainThreadBridge(m_workerClientWrapper, clientBridge, worke
rGlobalScope.script()->workerLoaderProxy(), request, options, resourceLoaderOpti
ons, workerGlobalScope.referrerPolicy(), workerGlobalScope.url().strippedForUseA
sReferrer()))) |
59 { | 59 { |
60 } | 60 } |
61 | 61 |
62 WorkerThreadableLoader::~WorkerThreadableLoader() | 62 WorkerThreadableLoader::~WorkerThreadableLoader() |
63 { | 63 { |
64 m_bridge.destroy(); | 64 m_bridge.destroy(); |
65 } | 65 } |
66 | 66 |
67 void WorkerThreadableLoader::loadResourceSynchronously(WorkerGlobalScope& worker
GlobalScope, const ResourceRequest& request, ThreadableLoaderClient& client, con
st ThreadableLoaderOptions& options, const ResourceLoaderOptions& resourceLoader
Options) | 67 void WorkerThreadableLoader::loadResourceSynchronously(WorkerGlobalScope& worker
GlobalScope, const ResourceRequest& request, ThreadableLoaderClient& client, con
st ThreadableLoaderOptions& options, const ResourceLoaderOptions& resourceLoader
Options) |
68 { | 68 { |
69 WebWaitableEvent* shutdownEvent = | 69 WebWaitableEvent* shutdownEvent = |
70 workerGlobalScope.thread()->shutdownEvent(); | 70 workerGlobalScope.script()->shutdownEvent(); |
71 OwnPtr<WebWaitableEvent> loaderDone = | 71 OwnPtr<WebWaitableEvent> loaderDone = |
72 adoptPtr(Platform::current()->createWaitableEvent()); | 72 adoptPtr(Platform::current()->createWaitableEvent()); |
73 | 73 |
74 Vector<WebWaitableEvent*> events; | 74 Vector<WebWaitableEvent*> events; |
75 events.append(shutdownEvent); | 75 events.append(shutdownEvent); |
76 events.append(loaderDone.get()); | 76 events.append(loaderDone.get()); |
77 | 77 |
78 RefPtr<ThreadableLoaderClientWrapper> clientWrapper(ThreadableLoaderClientWr
apper::create(&client)); | 78 RefPtr<ThreadableLoaderClientWrapper> clientWrapper(ThreadableLoaderClientWr
apper::create(&client)); |
79 OwnPtr<WorkerLoaderClientBridgeSyncHelper> clientBridge(WorkerLoaderClientBr
idgeSyncHelper::create(client, loaderDone.release())); | 79 OwnPtr<WorkerLoaderClientBridgeSyncHelper> clientBridge(WorkerLoaderClientBr
idgeSyncHelper::create(client, loaderDone.release())); |
80 | 80 |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 { | 248 { |
249 m_clientBridge->didFailAccessControlCheck(error); | 249 m_clientBridge->didFailAccessControlCheck(error); |
250 } | 250 } |
251 | 251 |
252 void WorkerThreadableLoader::MainThreadBridge::didFailRedirectCheck() | 252 void WorkerThreadableLoader::MainThreadBridge::didFailRedirectCheck() |
253 { | 253 { |
254 m_clientBridge->didFailRedirectCheck(); | 254 m_clientBridge->didFailRedirectCheck(); |
255 } | 255 } |
256 | 256 |
257 } // namespace blink | 257 } // namespace blink |
OLD | NEW |