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

Side by Side Diff: Source/core/workers/WorkerMessagingProxy.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/core/workers/WorkerLanguageTasks.cpp ('k') | Source/core/workers/WorkerNavigator.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) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * Copyright (C) 2009 Google Inc. All Rights Reserved. 3 * Copyright (C) 2009 Google Inc. All Rights Reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 19 matching lines...) Expand all
30 #include "core/workers/WorkerMessagingProxy.h" 30 #include "core/workers/WorkerMessagingProxy.h"
31 31
32 #include "core/dom/CrossThreadTask.h" 32 #include "core/dom/CrossThreadTask.h"
33 #include "core/dom/Document.h" 33 #include "core/dom/Document.h"
34 #include "core/events/ErrorEvent.h" 34 #include "core/events/ErrorEvent.h"
35 #include "core/events/MessageEvent.h" 35 #include "core/events/MessageEvent.h"
36 #include "core/frame/Console.h" 36 #include "core/frame/Console.h"
37 #include "core/frame/FrameConsole.h" 37 #include "core/frame/FrameConsole.h"
38 #include "core/frame/LocalDOMWindow.h" 38 #include "core/frame/LocalDOMWindow.h"
39 #include "core/frame/LocalFrame.h" 39 #include "core/frame/LocalFrame.h"
40 #include "core/frame/Navigator.h"
40 #include "core/frame/csp/ContentSecurityPolicy.h" 41 #include "core/frame/csp/ContentSecurityPolicy.h"
41 #include "core/inspector/ScriptCallStack.h" 42 #include "core/inspector/ScriptCallStack.h"
42 #include "core/inspector/WorkerDebuggerAgent.h" 43 #include "core/inspector/WorkerDebuggerAgent.h"
43 #include "core/loader/DocumentLoadTiming.h" 44 #include "core/loader/DocumentLoadTiming.h"
44 #include "core/loader/DocumentLoader.h" 45 #include "core/loader/DocumentLoader.h"
45 #include "core/workers/DedicatedWorkerGlobalScope.h" 46 #include "core/workers/DedicatedWorkerGlobalScope.h"
46 #include "core/workers/DedicatedWorkerThread.h" 47 #include "core/workers/DedicatedWorkerThread.h"
47 #include "core/workers/Worker.h" 48 #include "core/workers/Worker.h"
48 #include "core/workers/WorkerClients.h" 49 #include "core/workers/WorkerClients.h"
49 #include "core/workers/WorkerInspectorProxy.h" 50 #include "core/workers/WorkerInspectorProxy.h"
51 #include "core/workers/WorkerLanguageTasks.h"
50 #include "core/workers/WorkerObjectProxy.h" 52 #include "core/workers/WorkerObjectProxy.h"
51 #include "core/workers/WorkerThreadStartupData.h" 53 #include "core/workers/WorkerThreadStartupData.h"
54 #include "platform/Language.h"
52 #include "platform/NotImplemented.h" 55 #include "platform/NotImplemented.h"
53 #include "platform/heap/Handle.h" 56 #include "platform/heap/Handle.h"
54 #include "wtf/Functional.h" 57 #include "wtf/Functional.h"
55 #include "wtf/MainThread.h" 58 #include "wtf/MainThread.h"
56 59
57 namespace blink { 60 namespace blink {
58 61
59 class MessageWorkerGlobalScopeTask : public ExecutionContextTask { 62 class MessageWorkerGlobalScopeTask : public ExecutionContextTask {
60 public: 63 public:
61 static PassOwnPtr<MessageWorkerGlobalScopeTask> create(PassRefPtr<Serialized ScriptValue> message, PassOwnPtr<MessagePortChannelArray> channels) 64 static PassOwnPtr<MessageWorkerGlobalScopeTask> create(PassRefPtr<Serialized ScriptValue> message, PassOwnPtr<MessagePortChannelArray> channels)
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(s ource, level, message, sourceURL, lineNumber); 195 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(s ource, level, message, sourceURL, lineNumber);
193 consoleMessage->setWorkerGlobalScopeProxy(this); 196 consoleMessage->setWorkerGlobalScopeProxy(this);
194 frame->console().addMessage(consoleMessage.release()); 197 frame->console().addMessage(consoleMessage.release());
195 } 198 }
196 199
197 void WorkerMessagingProxy::workerThreadCreated(PassRefPtr<DedicatedWorkerThread> workerThread) 200 void WorkerMessagingProxy::workerThreadCreated(PassRefPtr<DedicatedWorkerThread> workerThread)
198 { 201 {
199 ASSERT(!m_askedToTerminate); 202 ASSERT(!m_askedToTerminate);
200 m_workerThread = workerThread; 203 m_workerThread = workerThread;
201 204
205 // Before any other task, pass on ua languages vector to the thread.
206 m_workerThread->postTask(WorkerThreadSetUserPreferredLanguagesTask::create(m _executionContext->executingWindow()->navigator().languages()));
207
202 unsigned taskCount = m_queuedEarlyTasks.size(); 208 unsigned taskCount = m_queuedEarlyTasks.size();
203 ASSERT(!m_unconfirmedMessageCount); 209 ASSERT(!m_unconfirmedMessageCount);
204 m_unconfirmedMessageCount = taskCount; 210 m_unconfirmedMessageCount = taskCount;
205 m_workerThreadHadPendingActivity = true; // Worker initialization means a pe nding activity. 211 m_workerThreadHadPendingActivity = true; // Worker initialization means a pe nding activity.
206 212
207 for (unsigned i = 0; i < taskCount; ++i) 213 for (unsigned i = 0; i < taskCount; ++i)
208 m_workerThread->postTask(m_queuedEarlyTasks[i].release()); 214 m_workerThread->postTask(m_queuedEarlyTasks[i].release());
209 m_queuedEarlyTasks.clear(); 215 m_queuedEarlyTasks.clear();
210 } 216 }
211 217
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 292
287 // FIXME: This need to be revisited when we support nested worker one day 293 // FIXME: This need to be revisited when we support nested worker one day
288 ASSERT(m_executionContext->isDocument()); 294 ASSERT(m_executionContext->isDocument());
289 Document* document = toDocument(m_executionContext.get()); 295 Document* document = toDocument(m_executionContext.get());
290 LocalFrame* frame = document->frame(); 296 LocalFrame* frame = document->frame();
291 if (frame) 297 if (frame)
292 frame->console().adoptWorkerMessagesAfterTermination(this); 298 frame->console().adoptWorkerMessagesAfterTermination(this);
293 } 299 }
294 300
295 } // namespace blink 301 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/workers/WorkerLanguageTasks.cpp ('k') | Source/core/workers/WorkerNavigator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698