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

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

Issue 50773002: Introduce WebWorkerPermissionClientProxy to deprecate WorkerAllowMainThreadBridge (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 1 month 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
OLDNEW
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 26 matching lines...) Expand all
37 #include "public/platform/WebURL.h" 37 #include "public/platform/WebURL.h"
38 #include "wtf/MainThread.h" 38 #include "wtf/MainThread.h"
39 #include "WebDataSourceImpl.h" 39 #include "WebDataSourceImpl.h"
40 #include "WebFrameClient.h" 40 #include "WebFrameClient.h"
41 #include "WebFrameImpl.h" 41 #include "WebFrameImpl.h"
42 #include "WebRuntimeFeatures.h" 42 #include "WebRuntimeFeatures.h"
43 #include "WebSettings.h" 43 #include "WebSettings.h"
44 #include "WebSharedWorkerClient.h" 44 #include "WebSharedWorkerClient.h"
45 #include "WebView.h" 45 #include "WebView.h"
46 #include "WorkerFileSystemClient.h" 46 #include "WorkerFileSystemClient.h"
47 #include "WorkerPermissionClient.h"
47 #include "core/dom/CrossThreadTask.h" 48 #include "core/dom/CrossThreadTask.h"
48 #include "core/dom/Document.h" 49 #include "core/dom/Document.h"
49 #include "core/dom/ExecutionContext.h" 50 #include "core/dom/ExecutionContext.h"
50 #include "core/dom/MessagePortChannel.h" 51 #include "core/dom/MessagePortChannel.h"
51 #include "core/events/MessageEvent.h" 52 #include "core/events/MessageEvent.h"
52 #include "core/html/HTMLFormElement.h" 53 #include "core/html/HTMLFormElement.h"
53 #include "core/inspector/WorkerDebuggerAgent.h" 54 #include "core/inspector/WorkerDebuggerAgent.h"
54 #include "core/inspector/WorkerInspectorController.h" 55 #include "core/inspector/WorkerInspectorController.h"
55 #include "core/loader/FrameLoadRequest.h" 56 #include "core/loader/FrameLoadRequest.h"
56 #include "core/loader/FrameLoader.h" 57 #include "core/loader/FrameLoader.h"
57 #include "core/page/Page.h" 58 #include "core/page/Page.h"
58 #include "core/page/PageGroup.h" 59 #include "core/page/PageGroup.h"
59 #include "core/workers/SharedWorkerGlobalScope.h" 60 #include "core/workers/SharedWorkerGlobalScope.h"
60 #include "core/workers/SharedWorkerThread.h" 61 #include "core/workers/SharedWorkerThread.h"
61 #include "core/workers/WorkerClients.h" 62 #include "core/workers/WorkerClients.h"
62 #include "core/workers/WorkerGlobalScope.h" 63 #include "core/workers/WorkerGlobalScope.h"
63 #include "core/workers/WorkerLoaderProxy.h" 64 #include "core/workers/WorkerLoaderProxy.h"
64 #include "core/workers/WorkerThread.h" 65 #include "core/workers/WorkerThread.h"
65 #include "core/workers/WorkerThreadStartupData.h" 66 #include "core/workers/WorkerThreadStartupData.h"
66 #include "modules/webdatabase/DatabaseTask.h" 67 #include "modules/webdatabase/DatabaseTask.h"
68 #include "public/web/WebWorkerPermissionClientProxy.h"
67 #include "weborigin/KURL.h" 69 #include "weborigin/KURL.h"
68 #include "weborigin/SecurityOrigin.h" 70 #include "weborigin/SecurityOrigin.h"
69 71
70 using namespace WebCore; 72 using namespace WebCore;
71 73
72 namespace WebKit { 74 namespace WebKit {
73 75
74 // This function is called on the main thread to force to initialize some static 76 // This function is called on the main thread to force to initialize some static
75 // values used in WebKit before any worker thread is started. This is because in 77 // values used in WebKit before any worker thread is started. This is because in
76 // our worker processs, we do not run any WebKit code in main thread and thus 78 // our worker processs, we do not run any WebKit code in main thread and thus
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 workerGlobalScope->dispatchEvent(createConnectEvent(port)); 280 workerGlobalScope->dispatchEvent(createConnectEvent(port));
279 } 281 }
280 282
281 void WebSharedWorkerImpl::startWorkerContext(const WebURL& url, const WebString& name, const WebString& userAgent, const WebString& sourceCode, const WebString& contentSecurityPolicy, WebContentSecurityPolicyType policyType, long long) 283 void WebSharedWorkerImpl::startWorkerContext(const WebURL& url, const WebString& name, const WebString& userAgent, const WebString& sourceCode, const WebString& contentSecurityPolicy, WebContentSecurityPolicyType policyType, long long)
282 { 284 {
283 initializeLoader(url); 285 initializeLoader(url);
284 286
285 WorkerThreadStartMode startMode = m_pauseWorkerContextOnStart ? PauseWorkerG lobalScopeOnStart : DontPauseWorkerGlobalScopeOnStart; 287 WorkerThreadStartMode startMode = m_pauseWorkerContextOnStart ? PauseWorkerG lobalScopeOnStart : DontPauseWorkerGlobalScopeOnStart;
286 OwnPtr<WorkerClients> workerClients = WorkerClients::create(); 288 OwnPtr<WorkerClients> workerClients = WorkerClients::create();
287 provideLocalFileSystemToWorker(workerClients.get(), WorkerFileSystemClient:: create()); 289 provideLocalFileSystemToWorker(workerClients.get(), WorkerFileSystemClient:: create());
290 WebSecurityOrigin webSecurityOrigin(m_loadingDocument->securityOrigin());
291 providePermissionClientToWorker(workerClients.get(), adoptPtr(m_client->crea teWorkerPermissionClientProxy(webSecurityOrigin)));
abarth-chromium 2013/10/30 06:49:03 Does the WorkerPermissionClientProxy retain the Se
kinuko 2013/10/30 07:05:52 No, it's only used for initialization. I can add
288 OwnPtr<WorkerThreadStartupData> startupData = WorkerThreadStartupData::creat e(url, userAgent, sourceCode, startMode, contentSecurityPolicy, static_cast<WebC ore::ContentSecurityPolicy::HeaderType>(policyType), workerClients.release()); 292 OwnPtr<WorkerThreadStartupData> startupData = WorkerThreadStartupData::creat e(url, userAgent, sourceCode, startMode, contentSecurityPolicy, static_cast<WebC ore::ContentSecurityPolicy::HeaderType>(policyType), workerClients.release());
289 setWorkerThread(SharedWorkerThread::create(name, *this, *this, startupData.r elease())); 293 setWorkerThread(SharedWorkerThread::create(name, *this, *this, startupData.r elease()));
290 294
291 workerThread()->start(); 295 workerThread()->start();
292 } 296 }
293 297
294 void WebSharedWorkerImpl::terminateWorkerContext() 298 void WebSharedWorkerImpl::terminateWorkerContext()
295 { 299 {
296 stopWorkerThread(); 300 stopWorkerThread();
297 } 301 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 workerThread()->runLoop().postTaskForMode(createCallbackTask(dispatchOnInspe ctorBackendTask, String(message)), WorkerDebuggerAgent::debuggerTaskMode); 364 workerThread()->runLoop().postTaskForMode(createCallbackTask(dispatchOnInspe ctorBackendTask, String(message)), WorkerDebuggerAgent::debuggerTaskMode);
361 WorkerDebuggerAgent::interruptAndDispatchInspectorCommands(workerThread()); 365 WorkerDebuggerAgent::interruptAndDispatchInspectorCommands(workerThread());
362 } 366 }
363 367
364 WebSharedWorker* WebSharedWorker::create(WebSharedWorkerClient* client) 368 WebSharedWorker* WebSharedWorker::create(WebSharedWorkerClient* client)
365 { 369 {
366 return new WebSharedWorkerImpl(client); 370 return new WebSharedWorkerImpl(client);
367 } 371 }
368 372
369 } // namespace WebKit 373 } // namespace WebKit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698