Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(221)

Side by Side Diff: Source/web/WebEmbeddedWorkerImpl.cpp

Issue 973103003: Revert of Rename WorkerPermissionClient and friends to WorkerContentSettingsClient. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/web/WebEmbeddedWorkerImpl.h ('k') | Source/web/WebSharedWorkerImpl.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 #include "platform/network/ContentSecurityPolicyParsers.h" 53 #include "platform/network/ContentSecurityPolicyParsers.h"
54 #include "platform/network/ContentSecurityPolicyResponseHeaders.h" 54 #include "platform/network/ContentSecurityPolicyResponseHeaders.h"
55 #include "public/platform/Platform.h" 55 #include "public/platform/Platform.h"
56 #include "public/platform/WebServiceWorkerProvider.h" 56 #include "public/platform/WebServiceWorkerProvider.h"
57 #include "public/platform/WebURLRequest.h" 57 #include "public/platform/WebURLRequest.h"
58 #include "public/web/WebDevToolsAgent.h" 58 #include "public/web/WebDevToolsAgent.h"
59 #include "public/web/WebServiceWorkerContextClient.h" 59 #include "public/web/WebServiceWorkerContextClient.h"
60 #include "public/web/WebServiceWorkerNetworkProvider.h" 60 #include "public/web/WebServiceWorkerNetworkProvider.h"
61 #include "public/web/WebSettings.h" 61 #include "public/web/WebSettings.h"
62 #include "public/web/WebView.h" 62 #include "public/web/WebView.h"
63 #include "public/web/WebWorkerContentSettingsClientProxy.h" 63 #include "public/web/WebWorkerPermissionClientProxy.h"
64 #include "web/ServiceWorkerGlobalScopeClientImpl.h" 64 #include "web/ServiceWorkerGlobalScopeClientImpl.h"
65 #include "web/ServiceWorkerGlobalScopeProxy.h" 65 #include "web/ServiceWorkerGlobalScopeProxy.h"
66 #include "web/WebDataSourceImpl.h" 66 #include "web/WebDataSourceImpl.h"
67 #include "web/WebLocalFrameImpl.h" 67 #include "web/WebLocalFrameImpl.h"
68 #include "web/WorkerContentSettingsClient.h" 68 #include "web/WorkerPermissionClient.h"
69 #include "wtf/Functional.h" 69 #include "wtf/Functional.h"
70 70
71 namespace blink { 71 namespace blink {
72 72
73 // A thin wrapper for one-off script loading. 73 // A thin wrapper for one-off script loading.
74 class WebEmbeddedWorkerImpl::Loader : public WorkerScriptLoaderClient { 74 class WebEmbeddedWorkerImpl::Loader : public WorkerScriptLoaderClient {
75 public: 75 public:
76 static PassOwnPtr<Loader> create() 76 static PassOwnPtr<Loader> create()
77 { 77 {
78 return adoptPtr(new Loader()); 78 return adoptPtr(new Loader());
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 private: 119 private:
120 Loader() : m_scriptLoader(WorkerScriptLoader::create()) 120 Loader() : m_scriptLoader(WorkerScriptLoader::create())
121 { 121 {
122 } 122 }
123 123
124 RefPtr<WorkerScriptLoader> m_scriptLoader; 124 RefPtr<WorkerScriptLoader> m_scriptLoader;
125 OwnPtr<Closure> m_callback; 125 OwnPtr<Closure> m_callback;
126 RefPtr<ContentSecurityPolicy> m_contentSecurityPolicy; 126 RefPtr<ContentSecurityPolicy> m_contentSecurityPolicy;
127 }; 127 };
128 128
129 WebEmbeddedWorker* WebEmbeddedWorker::create(WebServiceWorkerContextClient* clie nt, WebWorkerContentSettingsClientProxy* contentSettingsClient) 129 WebEmbeddedWorker* WebEmbeddedWorker::create(WebServiceWorkerContextClient* clie nt, WebWorkerPermissionClientProxy* permissionClient)
130 { 130 {
131 return new WebEmbeddedWorkerImpl(adoptPtr(client), adoptPtr(contentSettingsC lient)); 131 return new WebEmbeddedWorkerImpl(adoptPtr(client), adoptPtr(permissionClient ));
132 } 132 }
133 133
134 static HashSet<WebEmbeddedWorkerImpl*>& runningWorkerInstances() 134 static HashSet<WebEmbeddedWorkerImpl*>& runningWorkerInstances()
135 { 135 {
136 DEFINE_STATIC_LOCAL(HashSet<WebEmbeddedWorkerImpl*>, set, ()); 136 DEFINE_STATIC_LOCAL(HashSet<WebEmbeddedWorkerImpl*>, set, ());
137 return set; 137 return set;
138 } 138 }
139 139
140 WebEmbeddedWorkerImpl::WebEmbeddedWorkerImpl(PassOwnPtr<WebServiceWorkerContextC lient> client, PassOwnPtr<WebWorkerContentSettingsClientProxy> ContentSettingsCl ient) 140 WebEmbeddedWorkerImpl::WebEmbeddedWorkerImpl(PassOwnPtr<WebServiceWorkerContextC lient> client, PassOwnPtr<WebWorkerPermissionClientProxy> permissionClient)
141 : m_workerContextClient(client) 141 : m_workerContextClient(client)
142 , m_contentSettingsClient(ContentSettingsClient) 142 , m_permissionClient(permissionClient)
143 , m_workerInspectorProxy(WorkerInspectorProxy::create()) 143 , m_workerInspectorProxy(WorkerInspectorProxy::create())
144 , m_webView(0) 144 , m_webView(0)
145 , m_mainFrame(0) 145 , m_mainFrame(0)
146 , m_askedToTerminate(false) 146 , m_askedToTerminate(false)
147 , m_pauseAfterDownloadState(DontPauseAfterDownload) 147 , m_pauseAfterDownloadState(DontPauseAfterDownload)
148 , m_waitingForDebuggerState(NotWaitingForDebugger) 148 , m_waitingForDebuggerState(NotWaitingForDebugger)
149 { 149 {
150 runningWorkerInstances().add(this); 150 runningWorkerInstances().add(this);
151 } 151 }
152 152
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 Document* document = toWebLocalFrameImpl(m_mainFrame)->frame()->document(); 401 Document* document = toWebLocalFrameImpl(m_mainFrame)->frame()->document();
402 402
403 WorkerThreadStartMode startMode = DontPauseWorkerGlobalScopeOnStart; 403 WorkerThreadStartMode startMode = DontPauseWorkerGlobalScopeOnStart;
404 if (InspectorInstrumentation::shouldPauseDedicatedWorkerOnStart(document)) 404 if (InspectorInstrumentation::shouldPauseDedicatedWorkerOnStart(document))
405 startMode = PauseWorkerGlobalScopeOnStart; 405 startMode = PauseWorkerGlobalScopeOnStart;
406 406
407 // FIXME: this document's origin is pristine and without any extra privilege s. (crbug.com/254993) 407 // FIXME: this document's origin is pristine and without any extra privilege s. (crbug.com/254993)
408 SecurityOrigin* starterOrigin = document->securityOrigin(); 408 SecurityOrigin* starterOrigin = document->securityOrigin();
409 409
410 OwnPtrWillBeRawPtr<WorkerClients> workerClients = WorkerClients::create(); 410 OwnPtrWillBeRawPtr<WorkerClients> workerClients = WorkerClients::create();
411 provideContentSettingsClientToWorker(workerClients.get(), m_contentSettingsC lient.release()); 411 providePermissionClientToWorker(workerClients.get(), m_permissionClient.rele ase());
412 provideServiceWorkerGlobalScopeClientToWorker(workerClients.get(), ServiceWo rkerGlobalScopeClientImpl::create(*m_workerContextClient)); 412 provideServiceWorkerGlobalScopeClientToWorker(workerClients.get(), ServiceWo rkerGlobalScopeClientImpl::create(*m_workerContextClient));
413 provideServiceWorkerContainerClientToWorker(workerClients.get(), adoptPtr(m_ workerContextClient->createServiceWorkerProvider())); 413 provideServiceWorkerContainerClientToWorker(workerClients.get(), adoptPtr(m_ workerContextClient->createServiceWorkerProvider()));
414 414
415 // We need to set the CSP to both the shadow page's document and the Service WorkerGlobalScope. 415 // We need to set the CSP to both the shadow page's document and the Service WorkerGlobalScope.
416 document->initContentSecurityPolicy(m_mainScriptLoader->releaseContentSecuri tyPolicy()); 416 document->initContentSecurityPolicy(m_mainScriptLoader->releaseContentSecuri tyPolicy());
417 417
418 KURL scriptURL = m_mainScriptLoader->url(); 418 KURL scriptURL = m_mainScriptLoader->url();
419 OwnPtrWillBeRawPtr<WorkerThreadStartupData> startupData = 419 OwnPtrWillBeRawPtr<WorkerThreadStartupData> startupData =
420 WorkerThreadStartupData::create( 420 WorkerThreadStartupData::create(
421 scriptURL, 421 scriptURL,
(...skipping 10 matching lines...) Expand all
432 m_mainScriptLoader.clear(); 432 m_mainScriptLoader.clear();
433 433
434 m_workerGlobalScopeProxy = ServiceWorkerGlobalScopeProxy::create(*this, *doc ument, *m_workerContextClient); 434 m_workerGlobalScopeProxy = ServiceWorkerGlobalScopeProxy::create(*this, *doc ument, *m_workerContextClient);
435 m_loaderProxy = WorkerLoaderProxy::create(this); 435 m_loaderProxy = WorkerLoaderProxy::create(this);
436 m_workerThread = ServiceWorkerThread::create(m_loaderProxy, *m_workerGlobalS copeProxy, startupData.release()); 436 m_workerThread = ServiceWorkerThread::create(m_loaderProxy, *m_workerGlobalS copeProxy, startupData.release());
437 m_workerThread->start(); 437 m_workerThread->start();
438 m_workerInspectorProxy->workerThreadCreated(document, m_workerThread.get(), scriptURL); 438 m_workerInspectorProxy->workerThreadCreated(document, m_workerThread.get(), scriptURL);
439 } 439 }
440 440
441 } // namespace blink 441 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/WebEmbeddedWorkerImpl.h ('k') | Source/web/WebSharedWorkerImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698