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

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

Issue 592183002: [WIP]Implement Blink side changes for navigator.language(s) support for workers. Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Dedicated worker languagechange event added. Still WIP. Created 6 years, 2 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/WebSharedWorkerImpl.h ('k') | public/web/WebSharedWorker.h » ('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) 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 16 matching lines...) Expand all
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "web/WebSharedWorkerImpl.h" 32 #include "web/WebSharedWorkerImpl.h"
33 33
34 #include "core/dom/CrossThreadTask.h" 34 #include "core/dom/CrossThreadTask.h"
35 #include "core/dom/Document.h" 35 #include "core/dom/Document.h"
36 #include "core/events/MessageEvent.h" 36 #include "core/events/MessageEvent.h"
37 #include "core/frame/Navigator.h"
37 #include "core/html/HTMLFormElement.h" 38 #include "core/html/HTMLFormElement.h"
38 #include "core/inspector/ConsoleMessage.h" 39 #include "core/inspector/ConsoleMessage.h"
39 #include "core/inspector/InspectorInstrumentation.h" 40 #include "core/inspector/InspectorInstrumentation.h"
40 #include "core/inspector/WorkerDebuggerAgent.h" 41 #include "core/inspector/WorkerDebuggerAgent.h"
41 #include "core/inspector/WorkerInspectorController.h" 42 #include "core/inspector/WorkerInspectorController.h"
42 #include "core/loader/FrameLoadRequest.h" 43 #include "core/loader/FrameLoadRequest.h"
43 #include "core/loader/FrameLoader.h" 44 #include "core/loader/FrameLoader.h"
44 #include "core/page/Page.h" 45 #include "core/page/Page.h"
45 #include "core/workers/SharedWorkerGlobalScope.h" 46 #include "core/workers/SharedWorkerGlobalScope.h"
46 #include "core/workers/SharedWorkerThread.h" 47 #include "core/workers/SharedWorkerThread.h"
47 #include "core/workers/WorkerClients.h" 48 #include "core/workers/WorkerClients.h"
48 #include "core/workers/WorkerGlobalScope.h" 49 #include "core/workers/WorkerGlobalScope.h"
49 #include "core/workers/WorkerInspectorProxy.h" 50 #include "core/workers/WorkerInspectorProxy.h"
51 #include "core/workers/WorkerLanguageTasks.h"
52 #include "core/workers/WorkerNavigator.h"
50 #include "core/workers/WorkerScriptLoader.h" 53 #include "core/workers/WorkerScriptLoader.h"
51 #include "core/workers/WorkerThreadStartupData.h" 54 #include "core/workers/WorkerThreadStartupData.h"
52 #include "platform/RuntimeEnabledFeatures.h" 55 #include "platform/RuntimeEnabledFeatures.h"
53 #include "platform/heap/Handle.h" 56 #include "platform/heap/Handle.h"
54 #include "platform/network/ContentSecurityPolicyParsers.h" 57 #include "platform/network/ContentSecurityPolicyParsers.h"
55 #include "platform/network/ResourceResponse.h" 58 #include "platform/network/ResourceResponse.h"
56 #include "platform/weborigin/KURL.h" 59 #include "platform/weborigin/KURL.h"
57 #include "platform/weborigin/SecurityOrigin.h" 60 #include "platform/weborigin/SecurityOrigin.h"
58 #include "public/platform/WebFileError.h" 61 #include "public/platform/WebFileError.h"
59 #include "public/platform/WebMessagePortChannel.h" 62 #include "public/platform/WebMessagePortChannel.h"
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 } 306 }
304 307
305 void WebSharedWorkerImpl::workerGlobalScopeClosedOnMainThread() 308 void WebSharedWorkerImpl::workerGlobalScopeClosedOnMainThread()
306 { 309 {
307 if (client()) 310 if (client())
308 client()->workerContextClosed(); 311 client()->workerContextClosed();
309 312
310 stopWorkerThread(); 313 stopWorkerThread();
311 } 314 }
312 315
313 void WebSharedWorkerImpl::workerGlobalScopeStarted(WorkerGlobalScope*) 316 void WebSharedWorkerImpl::workerGlobalScopeStarted(WorkerGlobalScope* workerGlob alScope)
314 { 317 {
318 WTF::Vector<WTF::String> languages;
319 String acceptLangsString = m_acceptLanguages;
320 acceptLangsString.split(',', languages);
321 // Get the navigator and set the user preferred langauges
322 workerGlobalScope->navigator()->setUserPreferredLanguagesForWorkers(language s);
315 } 323 }
316 324
317 void WebSharedWorkerImpl::workerThreadTerminated() 325 void WebSharedWorkerImpl::workerThreadTerminated()
318 { 326 {
319 callOnMainThread(bind(&WebSharedWorkerImpl::workerThreadTerminatedOnMainThre ad, this)); 327 callOnMainThread(bind(&WebSharedWorkerImpl::workerThreadTerminatedOnMainThre ad, this));
320 } 328 }
321 329
322 void WebSharedWorkerImpl::workerThreadTerminatedOnMainThread() 330 void WebSharedWorkerImpl::workerThreadTerminatedOnMainThread()
323 { 331 {
324 if (client()) 332 if (client())
(...skipping 24 matching lines...) Expand all
349 void WebSharedWorkerImpl::connectTask(ExecutionContext* context, PassOwnPtr<WebM essagePortChannel> channel) 357 void WebSharedWorkerImpl::connectTask(ExecutionContext* context, PassOwnPtr<WebM essagePortChannel> channel)
350 { 358 {
351 // Wrap the passed-in channel in a MessagePort, and send it off via a connec t event. 359 // Wrap the passed-in channel in a MessagePort, and send it off via a connec t event.
352 RefPtrWillBeRawPtr<MessagePort> port = MessagePort::create(*context); 360 RefPtrWillBeRawPtr<MessagePort> port = MessagePort::create(*context);
353 port->entangle(channel); 361 port->entangle(channel);
354 WorkerGlobalScope* workerGlobalScope = toWorkerGlobalScope(context); 362 WorkerGlobalScope* workerGlobalScope = toWorkerGlobalScope(context);
355 ASSERT_WITH_SECURITY_IMPLICATION(workerGlobalScope->isSharedWorkerGlobalScop e()); 363 ASSERT_WITH_SECURITY_IMPLICATION(workerGlobalScope->isSharedWorkerGlobalScop e());
356 workerGlobalScope->dispatchEvent(createConnectEvent(port.release())); 364 workerGlobalScope->dispatchEvent(createConnectEvent(port.release()));
357 } 365 }
358 366
359 void WebSharedWorkerImpl::startWorkerContext(const WebURL& url, const WebString& name, const WebString& contentSecurityPolicy, WebContentSecurityPolicyType poli cyType) 367 void WebSharedWorkerImpl::startWorkerContext(const WebURL& url, const WebString& name, const WebString& contentSecurityPolicy, WebContentSecurityPolicyType poli cyType, const WebString& acceptLanguages)
360 { 368 {
361 m_url = url; 369 m_url = url;
362 m_name = name; 370 m_name = name;
363 m_contentSecurityPolicy = contentSecurityPolicy; 371 m_contentSecurityPolicy = contentSecurityPolicy;
364 m_policyType = policyType; 372 m_policyType = policyType;
373 m_acceptLanguages = acceptLanguages;
365 initializeLoader(url); 374 initializeLoader(url);
366 } 375 }
367 376
368 void WebSharedWorkerImpl::didReceiveScriptLoaderResponse() 377 void WebSharedWorkerImpl::didReceiveScriptLoaderResponse()
369 { 378 {
370 InspectorInstrumentation::didReceiveScriptResponse(m_loadingDocument.get(), m_mainScriptLoader->identifier()); 379 InspectorInstrumentation::didReceiveScriptResponse(m_loadingDocument.get(), m_mainScriptLoader->identifier());
371 if (client()) 380 if (client())
372 client()->selectAppCacheID(m_mainScriptLoader->appCacheID()); 381 client()->selectAppCacheID(m_mainScriptLoader->appCacheID());
373 } 382 }
374 383
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 if (devtoolsAgent) 466 if (devtoolsAgent)
458 devtoolsAgent->dispatchOnInspectorBackend(message); 467 devtoolsAgent->dispatchOnInspectorBackend(message);
459 } 468 }
460 469
461 WebSharedWorker* WebSharedWorker::create(WebSharedWorkerClient* client) 470 WebSharedWorker* WebSharedWorker::create(WebSharedWorkerClient* client)
462 { 471 {
463 return new WebSharedWorkerImpl(client); 472 return new WebSharedWorkerImpl(client);
464 } 473 }
465 474
466 } // namespace blink 475 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/WebSharedWorkerImpl.h ('k') | public/web/WebSharedWorker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698