| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 #include "public/web/WebView.h" | 64 #include "public/web/WebView.h" |
| 65 #include "public/web/WebWorkerPermissionClientProxy.h" | 65 #include "public/web/WebWorkerPermissionClientProxy.h" |
| 66 #include "web/DatabaseClientImpl.h" | 66 #include "web/DatabaseClientImpl.h" |
| 67 #include "web/LocalFileSystemClient.h" | 67 #include "web/LocalFileSystemClient.h" |
| 68 #include "web/WebDataSourceImpl.h" | 68 #include "web/WebDataSourceImpl.h" |
| 69 #include "web/WebLocalFrameImpl.h" | 69 #include "web/WebLocalFrameImpl.h" |
| 70 #include "web/WorkerPermissionClient.h" | 70 #include "web/WorkerPermissionClient.h" |
| 71 #include "wtf/Functional.h" | 71 #include "wtf/Functional.h" |
| 72 #include "wtf/MainThread.h" | 72 #include "wtf/MainThread.h" |
| 73 | 73 |
| 74 using namespace WebCore; | 74 using namespace blink; |
| 75 | 75 |
| 76 namespace blink { | 76 namespace blink { |
| 77 | 77 |
| 78 // A thin wrapper for one-off script loading. | 78 // A thin wrapper for one-off script loading. |
| 79 class WebSharedWorkerImpl::Loader : public WorkerScriptLoaderClient { | 79 class WebSharedWorkerImpl::Loader : public WorkerScriptLoaderClient { |
| 80 public: | 80 public: |
| 81 static PassOwnPtr<Loader> create() | 81 static PassOwnPtr<Loader> create() |
| 82 { | 82 { |
| 83 return adoptPtr(new Loader()); | 83 return adoptPtr(new Loader()); |
| 84 } | 84 } |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 if (!m_askedToTerminate) | 358 if (!m_askedToTerminate) |
| 359 delete this; | 359 delete this; |
| 360 return; | 360 return; |
| 361 } | 361 } |
| 362 WorkerThreadStartMode startMode = m_pauseWorkerContextOnStart ? PauseWorkerG
lobalScopeOnStart : DontPauseWorkerGlobalScopeOnStart; | 362 WorkerThreadStartMode startMode = m_pauseWorkerContextOnStart ? PauseWorkerG
lobalScopeOnStart : DontPauseWorkerGlobalScopeOnStart; |
| 363 OwnPtrWillBeRawPtr<WorkerClients> workerClients = WorkerClients::create(); | 363 OwnPtrWillBeRawPtr<WorkerClients> workerClients = WorkerClients::create(); |
| 364 provideLocalFileSystemToWorker(workerClients.get(), LocalFileSystemClient::c
reate()); | 364 provideLocalFileSystemToWorker(workerClients.get(), LocalFileSystemClient::c
reate()); |
| 365 provideDatabaseClientToWorker(workerClients.get(), DatabaseClientImpl::creat
e()); | 365 provideDatabaseClientToWorker(workerClients.get(), DatabaseClientImpl::creat
e()); |
| 366 WebSecurityOrigin webSecurityOrigin(m_loadingDocument->securityOrigin()); | 366 WebSecurityOrigin webSecurityOrigin(m_loadingDocument->securityOrigin()); |
| 367 providePermissionClientToWorker(workerClients.get(), adoptPtr(client()->crea
teWorkerPermissionClientProxy(webSecurityOrigin))); | 367 providePermissionClientToWorker(workerClients.get(), adoptPtr(client()->crea
teWorkerPermissionClientProxy(webSecurityOrigin))); |
| 368 OwnPtrWillBeRawPtr<WorkerThreadStartupData> startupData = WorkerThreadStartu
pData::create(m_url, m_loadingDocument->userAgent(m_url), m_mainScriptLoader->sc
ript(), startMode, m_contentSecurityPolicy, static_cast<WebCore::ContentSecurity
PolicyHeaderType>(m_policyType), workerClients.release()); | 368 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 setWorkerThread(SharedWorkerThread::create(m_name, *this, *this, startupData
.release())); | 369 setWorkerThread(SharedWorkerThread::create(m_name, *this, *this, startupData
.release())); |
| 370 InspectorInstrumentation::scriptImported(m_loadingDocument.get(), m_mainScri
ptLoader->identifier(), m_mainScriptLoader->script()); | 370 InspectorInstrumentation::scriptImported(m_loadingDocument.get(), m_mainScri
ptLoader->identifier(), m_mainScriptLoader->script()); |
| 371 m_mainScriptLoader.clear(); | 371 m_mainScriptLoader.clear(); |
| 372 | 372 |
| 373 if (m_attachDevToolsOnStart) | 373 if (m_attachDevToolsOnStart) |
| 374 workerThread()->runLoop().postDebuggerTask(createCrossThreadTask(connect
ToWorkerContextInspectorTask, true)); | 374 workerThread()->runLoop().postDebuggerTask(createCrossThreadTask(connect
ToWorkerContextInspectorTask, true)); |
| 375 | 375 |
| 376 workerThread()->start(); | 376 workerThread()->start(); |
| 377 if (client()) | 377 if (client()) |
| 378 client()->workerScriptLoaded(); | 378 client()->workerScriptLoaded(); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 workerThread()->runLoop().postDebuggerTask(createCrossThreadTask(dispatchOnI
nspectorBackendTask, String(message))); | 446 workerThread()->runLoop().postDebuggerTask(createCrossThreadTask(dispatchOnI
nspectorBackendTask, String(message))); |
| 447 WorkerDebuggerAgent::interruptAndDispatchInspectorCommands(workerThread()); | 447 WorkerDebuggerAgent::interruptAndDispatchInspectorCommands(workerThread()); |
| 448 } | 448 } |
| 449 | 449 |
| 450 WebSharedWorker* WebSharedWorker::create(WebSharedWorkerClient* client) | 450 WebSharedWorker* WebSharedWorker::create(WebSharedWorkerClient* client) |
| 451 { | 451 { |
| 452 return new WebSharedWorkerImpl(client); | 452 return new WebSharedWorkerImpl(client); |
| 453 } | 453 } |
| 454 | 454 |
| 455 } // namespace blink | 455 } // namespace blink |
| OLD | NEW |