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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 #include "public/platform/WebFileError.h" | 59 #include "public/platform/WebFileError.h" |
60 #include "public/platform/WebMessagePortChannel.h" | 60 #include "public/platform/WebMessagePortChannel.h" |
61 #include "public/platform/WebString.h" | 61 #include "public/platform/WebString.h" |
62 #include "public/platform/WebURL.h" | 62 #include "public/platform/WebURL.h" |
63 #include "public/platform/WebURLRequest.h" | 63 #include "public/platform/WebURLRequest.h" |
64 #include "public/web/WebDevToolsAgent.h" | 64 #include "public/web/WebDevToolsAgent.h" |
65 #include "public/web/WebFrame.h" | 65 #include "public/web/WebFrame.h" |
66 #include "public/web/WebServiceWorkerNetworkProvider.h" | 66 #include "public/web/WebServiceWorkerNetworkProvider.h" |
67 #include "public/web/WebSettings.h" | 67 #include "public/web/WebSettings.h" |
68 #include "public/web/WebView.h" | 68 #include "public/web/WebView.h" |
69 #include "public/web/WebWorkerPermissionClientProxy.h" | 69 #include "public/web/WebWorkerContentSettingsClientProxy.h" |
70 #include "web/LocalFileSystemClient.h" | 70 #include "web/LocalFileSystemClient.h" |
71 #include "web/WebDataSourceImpl.h" | 71 #include "web/WebDataSourceImpl.h" |
72 #include "web/WebLocalFrameImpl.h" | 72 #include "web/WebLocalFrameImpl.h" |
73 #include "web/WorkerPermissionClient.h" | 73 #include "web/WorkerContentSettingsClient.h" |
74 #include "wtf/Functional.h" | 74 #include "wtf/Functional.h" |
75 #include "wtf/MainThread.h" | 75 #include "wtf/MainThread.h" |
76 | 76 |
77 namespace blink { | 77 namespace blink { |
78 | 78 |
79 // A thin wrapper for one-off script loading. | 79 // A thin wrapper for one-off script loading. |
80 class WebSharedWorkerImpl::Loader : public WorkerScriptLoaderClient { | 80 class WebSharedWorkerImpl::Loader : public WorkerScriptLoaderClient { |
81 public: | 81 public: |
82 static PassOwnPtr<Loader> create() | 82 static PassOwnPtr<Loader> create() |
83 { | 83 { |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 WorkerThreadStartMode startMode = DontPauseWorkerGlobalScopeOnStart; | 408 WorkerThreadStartMode startMode = DontPauseWorkerGlobalScopeOnStart; |
409 if (InspectorInstrumentation::shouldPauseDedicatedWorkerOnStart(document)) | 409 if (InspectorInstrumentation::shouldPauseDedicatedWorkerOnStart(document)) |
410 startMode = PauseWorkerGlobalScopeOnStart; | 410 startMode = PauseWorkerGlobalScopeOnStart; |
411 | 411 |
412 // FIXME: this document's origin is pristine and without any extra privilege
s. (crbug.com/254993) | 412 // FIXME: this document's origin is pristine and without any extra privilege
s. (crbug.com/254993) |
413 SecurityOrigin* starterOrigin = document->securityOrigin(); | 413 SecurityOrigin* starterOrigin = document->securityOrigin(); |
414 | 414 |
415 OwnPtrWillBeRawPtr<WorkerClients> workerClients = WorkerClients::create(); | 415 OwnPtrWillBeRawPtr<WorkerClients> workerClients = WorkerClients::create(); |
416 provideLocalFileSystemToWorker(workerClients.get(), LocalFileSystemClient::c
reate()); | 416 provideLocalFileSystemToWorker(workerClients.get(), LocalFileSystemClient::c
reate()); |
417 WebSecurityOrigin webSecurityOrigin(m_loadingDocument->securityOrigin()); | 417 WebSecurityOrigin webSecurityOrigin(m_loadingDocument->securityOrigin()); |
418 providePermissionClientToWorker(workerClients.get(), adoptPtr(client()->crea
teWorkerPermissionClientProxy(webSecurityOrigin))); | 418 provideContentSettingsClientToWorker(workerClients.get(), adoptPtr(client()-
>createWorkerContentSettingsClientProxy(webSecurityOrigin))); |
419 OwnPtrWillBeRawPtr<WorkerThreadStartupData> startupData = WorkerThreadStartu
pData::create(m_url, m_loadingDocument->userAgent(m_url), m_mainScriptLoader->sc
ript(), nullptr, startMode, m_contentSecurityPolicy, static_cast<ContentSecurity
PolicyHeaderType>(m_policyType), starterOrigin, workerClients.release()); | 419 OwnPtrWillBeRawPtr<WorkerThreadStartupData> startupData = WorkerThreadStartu
pData::create(m_url, m_loadingDocument->userAgent(m_url), m_mainScriptLoader->sc
ript(), nullptr, startMode, m_contentSecurityPolicy, static_cast<ContentSecurity
PolicyHeaderType>(m_policyType), starterOrigin, workerClients.release()); |
420 m_loaderProxy = WorkerLoaderProxy::create(this); | 420 m_loaderProxy = WorkerLoaderProxy::create(this); |
421 setWorkerThread(SharedWorkerThread::create(m_name, m_loaderProxy, *this, sta
rtupData.release())); | 421 setWorkerThread(SharedWorkerThread::create(m_name, m_loaderProxy, *this, sta
rtupData.release())); |
422 InspectorInstrumentation::scriptImported(m_loadingDocument.get(), m_mainScri
ptLoader->identifier(), m_mainScriptLoader->script()); | 422 InspectorInstrumentation::scriptImported(m_loadingDocument.get(), m_mainScri
ptLoader->identifier(), m_mainScriptLoader->script()); |
423 m_mainScriptLoader.clear(); | 423 m_mainScriptLoader.clear(); |
424 | 424 |
425 workerThread()->start(); | 425 workerThread()->start(); |
426 m_workerInspectorProxy->workerThreadCreated(m_loadingDocument.get(), workerT
hread(), m_url); | 426 m_workerInspectorProxy->workerThreadCreated(m_loadingDocument.get(), workerT
hread(), m_url); |
427 if (client()) | 427 if (client()) |
428 client()->workerScriptLoaded(); | 428 client()->workerScriptLoaded(); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 if (devtoolsAgent) | 473 if (devtoolsAgent) |
474 devtoolsAgent->dispatchOnInspectorBackend(message); | 474 devtoolsAgent->dispatchOnInspectorBackend(message); |
475 } | 475 } |
476 | 476 |
477 WebSharedWorker* WebSharedWorker::create(WebSharedWorkerClient* client) | 477 WebSharedWorker* WebSharedWorker::create(WebSharedWorkerClient* client) |
478 { | 478 { |
479 return new WebSharedWorkerImpl(client); | 479 return new WebSharedWorkerImpl(client); |
480 } | 480 } |
481 | 481 |
482 } // namespace blink | 482 } // namespace blink |
OLD | NEW |