| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 virtual ~Loader() | 87 virtual ~Loader() |
| 88 { | 88 { |
| 89 m_scriptLoader->setClient(0); | 89 m_scriptLoader->setClient(0); |
| 90 } | 90 } |
| 91 | 91 |
| 92 void load(ExecutionContext* loadingContext, const KURL& scriptURL, const Clo
sure& receiveResponseCallback, const Closure& finishCallback) | 92 void load(ExecutionContext* loadingContext, const KURL& scriptURL, const Clo
sure& receiveResponseCallback, const Closure& finishCallback) |
| 93 { | 93 { |
| 94 ASSERT(loadingContext); | 94 ASSERT(loadingContext); |
| 95 m_receiveResponseCallback = receiveResponseCallback; | 95 m_receiveResponseCallback = receiveResponseCallback; |
| 96 m_finishCallback = finishCallback; | 96 m_finishCallback = finishCallback; |
| 97 m_scriptLoader->setRequestContext(blink::WebURLRequest::RequestContextSh
aredWorker); | 97 m_scriptLoader->setRequestContext(WebURLRequest::RequestContextSharedWor
ker); |
| 98 m_scriptLoader->loadAsynchronously( | 98 m_scriptLoader->loadAsynchronously( |
| 99 *loadingContext, scriptURL, DenyCrossOriginRequests, this); | 99 *loadingContext, scriptURL, DenyCrossOriginRequests, this); |
| 100 } | 100 } |
| 101 | 101 |
| 102 void didReceiveResponse(unsigned long identifier, const ResourceResponse& re
sponse) OVERRIDE | 102 void didReceiveResponse(unsigned long identifier, const ResourceResponse& re
sponse) OVERRIDE |
| 103 { | 103 { |
| 104 m_identifier = identifier; | 104 m_identifier = identifier; |
| 105 m_appCacheID = response.appCacheID(); | 105 m_appCacheID = response.appCacheID(); |
| 106 m_receiveResponseCallback(); | 106 m_receiveResponseCallback(); |
| 107 } | 107 } |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 bind(&WebSharedWorkerImpl::onScriptLoaderFinished, this)); | 233 bind(&WebSharedWorkerImpl::onScriptLoaderFinished, this)); |
| 234 } | 234 } |
| 235 | 235 |
| 236 // WorkerReportingProxy -------------------------------------------------------- | 236 // WorkerReportingProxy -------------------------------------------------------- |
| 237 | 237 |
| 238 void WebSharedWorkerImpl::reportException(const String& errorMessage, int lineNu
mber, int columnNumber, const String& sourceURL) | 238 void WebSharedWorkerImpl::reportException(const String& errorMessage, int lineNu
mber, int columnNumber, const String& sourceURL) |
| 239 { | 239 { |
| 240 // Not suppported in SharedWorker. | 240 // Not suppported in SharedWorker. |
| 241 } | 241 } |
| 242 | 242 |
| 243 void WebSharedWorkerImpl::reportConsoleMessage(PassRefPtr<blink::ConsoleMessage>
) | 243 void WebSharedWorkerImpl::reportConsoleMessage(PassRefPtrWillBeRawPtr<ConsoleMes
sage>) |
| 244 { | 244 { |
| 245 // Not supported in SharedWorker. | 245 // Not supported in SharedWorker. |
| 246 } | 246 } |
| 247 | 247 |
| 248 void WebSharedWorkerImpl::postMessageToPageInspector(const String& message) | 248 void WebSharedWorkerImpl::postMessageToPageInspector(const String& message) |
| 249 { | 249 { |
| 250 // Note that we need to keep the closure creation on a separate line so | 250 // Note that we need to keep the closure creation on a separate line so |
| 251 // that the temporary created by isolatedCopy() will always be destroyed | 251 // that the temporary created by isolatedCopy() will always be destroyed |
| 252 // before the copy in the closure is used on the main thread. | 252 // before the copy in the closure is used on the main thread. |
| 253 const Closure& boundFunction = bind(&WebSharedWorkerClient::dispatchDevTools
Message, m_clientWeakPtr, message.isolatedCopy()); | 253 const Closure& boundFunction = bind(&WebSharedWorkerClient::dispatchDevTools
Message, m_clientWeakPtr, message.isolatedCopy()); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 if (!m_askedToTerminate) | 359 if (!m_askedToTerminate) |
| 360 delete this; | 360 delete this; |
| 361 return; | 361 return; |
| 362 } | 362 } |
| 363 WorkerThreadStartMode startMode = m_pauseWorkerContextOnStart ? PauseWorkerG
lobalScopeOnStart : DontPauseWorkerGlobalScopeOnStart; | 363 WorkerThreadStartMode startMode = m_pauseWorkerContextOnStart ? PauseWorkerG
lobalScopeOnStart : DontPauseWorkerGlobalScopeOnStart; |
| 364 OwnPtrWillBeRawPtr<WorkerClients> workerClients = WorkerClients::create(); | 364 OwnPtrWillBeRawPtr<WorkerClients> workerClients = WorkerClients::create(); |
| 365 provideLocalFileSystemToWorker(workerClients.get(), LocalFileSystemClient::c
reate()); | 365 provideLocalFileSystemToWorker(workerClients.get(), LocalFileSystemClient::c
reate()); |
| 366 provideDatabaseClientToWorker(workerClients.get(), DatabaseClientImpl::creat
e()); | 366 provideDatabaseClientToWorker(workerClients.get(), DatabaseClientImpl::creat
e()); |
| 367 WebSecurityOrigin webSecurityOrigin(m_loadingDocument->securityOrigin()); | 367 WebSecurityOrigin webSecurityOrigin(m_loadingDocument->securityOrigin()); |
| 368 providePermissionClientToWorker(workerClients.get(), adoptPtr(client()->crea
teWorkerPermissionClientProxy(webSecurityOrigin))); | 368 providePermissionClientToWorker(workerClients.get(), adoptPtr(client()->crea
teWorkerPermissionClientProxy(webSecurityOrigin))); |
| 369 OwnPtrWillBeRawPtr<WorkerThreadStartupData> startupData = WorkerThreadStartu
pData::create(m_url, m_loadingDocument->userAgent(m_url), m_mainScriptLoader->sc
ript(), startMode, m_contentSecurityPolicy, static_cast<blink::ContentSecurityPo
licyHeaderType>(m_policyType), workerClients.release()); | 369 OwnPtrWillBeRawPtr<WorkerThreadStartupData> startupData = WorkerThreadStartu
pData::create(m_url, m_loadingDocument->userAgent(m_url), m_mainScriptLoader->sc
ript(), startMode, m_contentSecurityPolicy, static_cast<ContentSecurityPolicyHea
derType>(m_policyType), workerClients.release()); |
| 370 setWorkerThread(SharedWorkerThread::create(m_name, *this, *this, startupData
.release())); | 370 setWorkerThread(SharedWorkerThread::create(m_name, *this, *this, startupData
.release())); |
| 371 InspectorInstrumentation::scriptImported(m_loadingDocument.get(), m_mainScri
ptLoader->identifier(), m_mainScriptLoader->script()); | 371 InspectorInstrumentation::scriptImported(m_loadingDocument.get(), m_mainScri
ptLoader->identifier(), m_mainScriptLoader->script()); |
| 372 m_mainScriptLoader.clear(); | 372 m_mainScriptLoader.clear(); |
| 373 | 373 |
| 374 if (m_attachDevToolsOnStart) | 374 if (m_attachDevToolsOnStart) |
| 375 workerThread()->postDebuggerTask(createCrossThreadTask(connectToWorkerCo
ntextInspectorTask, true)); | 375 workerThread()->postDebuggerTask(createCrossThreadTask(connectToWorkerCo
ntextInspectorTask, true)); |
| 376 | 376 |
| 377 workerThread()->start(); | 377 workerThread()->start(); |
| 378 if (client()) | 378 if (client()) |
| 379 client()->workerScriptLoaded(); | 379 client()->workerScriptLoaded(); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 workerThread()->postDebuggerTask(createCrossThreadTask(dispatchOnInspectorBa
ckendTask, String(message))); | 449 workerThread()->postDebuggerTask(createCrossThreadTask(dispatchOnInspectorBa
ckendTask, String(message))); |
| 450 workerThread()->interruptAndDispatchInspectorCommands(); | 450 workerThread()->interruptAndDispatchInspectorCommands(); |
| 451 } | 451 } |
| 452 | 452 |
| 453 WebSharedWorker* WebSharedWorker::create(WebSharedWorkerClient* client) | 453 WebSharedWorker* WebSharedWorker::create(WebSharedWorkerClient* client) |
| 454 { | 454 { |
| 455 return new WebSharedWorkerImpl(client); | 455 return new WebSharedWorkerImpl(client); |
| 456 } | 456 } |
| 457 | 457 |
| 458 } // namespace blink | 458 } // namespace blink |
| OLD | NEW |