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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 { | 60 { |
61 } | 61 } |
62 | 62 |
63 WorkerThreadableLoader::~WorkerThreadableLoader() | 63 WorkerThreadableLoader::~WorkerThreadableLoader() |
64 { | 64 { |
65 m_bridge.destroy(); | 65 m_bridge.destroy(); |
66 } | 66 } |
67 | 67 |
68 void WorkerThreadableLoader::loadResourceSynchronously(WorkerGlobalScope& worker
GlobalScope, const ResourceRequest& request, ThreadableLoaderClient& client, con
st ThreadableLoaderOptions& options, const ResourceLoaderOptions& resourceLoader
Options) | 68 void WorkerThreadableLoader::loadResourceSynchronously(WorkerGlobalScope& worker
GlobalScope, const ResourceRequest& request, ThreadableLoaderClient& client, con
st ThreadableLoaderOptions& options, const ResourceLoaderOptions& resourceLoader
Options) |
69 { | 69 { |
70 blink::WebWaitableEvent* shutdownEvent = | 70 WebWaitableEvent* shutdownEvent = |
71 workerGlobalScope.thread()->shutdownEvent(); | 71 workerGlobalScope.thread()->shutdownEvent(); |
72 OwnPtr<blink::WebWaitableEvent> loaderDone = | 72 OwnPtr<WebWaitableEvent> loaderDone = |
73 adoptPtr(blink::Platform::current()->createWaitableEvent()); | 73 adoptPtr(Platform::current()->createWaitableEvent()); |
74 | 74 |
75 Vector<blink::WebWaitableEvent*> events; | 75 Vector<WebWaitableEvent*> events; |
76 events.append(shutdownEvent); | 76 events.append(shutdownEvent); |
77 events.append(loaderDone.get()); | 77 events.append(loaderDone.get()); |
78 | 78 |
79 RefPtr<ThreadableLoaderClientWrapper> clientWrapper(ThreadableLoaderClientWr
apper::create(&client)); | 79 RefPtr<ThreadableLoaderClientWrapper> clientWrapper(ThreadableLoaderClientWr
apper::create(&client)); |
80 OwnPtr<WorkerLoaderClientBridgeSyncHelper> clientBridge(WorkerLoaderClientBr
idgeSyncHelper::create(client, loaderDone.release())); | 80 OwnPtr<WorkerLoaderClientBridgeSyncHelper> clientBridge(WorkerLoaderClientBr
idgeSyncHelper::create(client, loaderDone.release())); |
81 | 81 |
82 // This must be valid while loader is around. | 82 // This must be valid while loader is around. |
83 WorkerLoaderClientBridgeSyncHelper* clientBridgePtr = clientBridge.get(); | 83 WorkerLoaderClientBridgeSyncHelper* clientBridgePtr = clientBridge.get(); |
84 | 84 |
85 RefPtr<WorkerThreadableLoader> loader = WorkerThreadableLoader::create(worke
rGlobalScope, clientWrapper, clientBridge.release(), request, options, resourceL
oaderOptions); | 85 RefPtr<WorkerThreadableLoader> loader = WorkerThreadableLoader::create(worke
rGlobalScope, clientWrapper, clientBridge.release(), request, options, resourceL
oaderOptions); |
86 | 86 |
87 blink::WebWaitableEvent* signalled; | 87 WebWaitableEvent* signalled; |
88 { | 88 { |
89 SafePointScope scope(ThreadState::HeapPointersOnStack); | 89 SafePointScope scope(ThreadState::HeapPointersOnStack); |
90 signalled = blink::Platform::current()->waitMultipleEvents(events); | 90 signalled = Platform::current()->waitMultipleEvents(events); |
91 } | 91 } |
92 if (signalled == shutdownEvent) { | 92 if (signalled == shutdownEvent) { |
93 loader->cancel(); | 93 loader->cancel(); |
94 return; | 94 return; |
95 } | 95 } |
96 | 96 |
97 clientBridgePtr->run(); | 97 clientBridgePtr->run(); |
98 } | 98 } |
99 | 99 |
100 void WorkerThreadableLoader::overrideTimeout(unsigned long timeoutMilliseconds) | 100 void WorkerThreadableLoader::overrideTimeout(unsigned long timeoutMilliseconds) |
(...skipping 147 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 |