OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
3 * Copyright (C) 2009, 2011 Google Inc. All Rights Reserved. | 3 * Copyright (C) 2009, 2011 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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 | 169 |
170 void WorkerGlobalScope::close() | 170 void WorkerGlobalScope::close() |
171 { | 171 { |
172 if (m_closing) | 172 if (m_closing) |
173 return; | 173 return; |
174 | 174 |
175 // Let current script run to completion but prevent future script evaluation
s. | 175 // Let current script run to completion but prevent future script evaluation
s. |
176 // After m_closing is set, all the tasks in the queue continue to be fetched
but only | 176 // After m_closing is set, all the tasks in the queue continue to be fetched
but only |
177 // tasks with isCleanupTask()==true will be executed. | 177 // tasks with isCleanupTask()==true will be executed. |
178 m_closing = true; | 178 m_closing = true; |
179 postTask(CloseWorkerGlobalScopeTask::create()); | 179 postTask(FROM_HERE, CloseWorkerGlobalScopeTask::create()); |
180 } | 180 } |
181 | 181 |
182 WorkerConsole* WorkerGlobalScope::console() | 182 WorkerConsole* WorkerGlobalScope::console() |
183 { | 183 { |
184 if (!m_console) | 184 if (!m_console) |
185 m_console = WorkerConsole::create(this); | 185 m_console = WorkerConsole::create(this); |
186 return m_console.get(); | 186 return m_console.get(); |
187 } | 187 } |
188 | 188 |
189 WorkerNavigator* WorkerGlobalScope::navigator() const | 189 WorkerNavigator* WorkerGlobalScope::navigator() const |
190 { | 190 { |
191 if (!m_navigator) | 191 if (!m_navigator) |
192 m_navigator = WorkerNavigator::create(m_userAgent); | 192 m_navigator = WorkerNavigator::create(m_userAgent); |
193 return m_navigator.get(); | 193 return m_navigator.get(); |
194 } | 194 } |
195 | 195 |
196 void WorkerGlobalScope::postTask(PassOwnPtr<ExecutionContextTask> task) | 196 void WorkerGlobalScope::postTask(const WebTraceLocation& location, PassOwnPtr<Ex
ecutionContextTask> task) |
197 { | 197 { |
198 thread()->postTask(task); | 198 thread()->postTask(task); |
199 } | 199 } |
200 | 200 |
201 // FIXME: Called twice, from WorkerThreadShutdownFinishTask and WorkerGlobalScop
e::dispose. | 201 // FIXME: Called twice, from WorkerThreadShutdownFinishTask and WorkerGlobalScop
e::dispose. |
202 void WorkerGlobalScope::clearInspector() | 202 void WorkerGlobalScope::clearInspector() |
203 { | 203 { |
204 if (!m_workerInspectorController) | 204 if (!m_workerInspectorController) |
205 return; | 205 return; |
206 thread()->setWorkerInspectorController(nullptr); | 206 thread()->setWorkerInspectorController(nullptr); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 | 289 |
290 void WorkerGlobalScope::reportBlockedScriptExecutionToInspector(const String& di
rectiveText) | 290 void WorkerGlobalScope::reportBlockedScriptExecutionToInspector(const String& di
rectiveText) |
291 { | 291 { |
292 InspectorInstrumentation::scriptExecutionBlockedByCSP(this, directiveText); | 292 InspectorInstrumentation::scriptExecutionBlockedByCSP(this, directiveText); |
293 } | 293 } |
294 | 294 |
295 void WorkerGlobalScope::addConsoleMessage(PassRefPtrWillBeRawPtr<ConsoleMessage>
prpConsoleMessage) | 295 void WorkerGlobalScope::addConsoleMessage(PassRefPtrWillBeRawPtr<ConsoleMessage>
prpConsoleMessage) |
296 { | 296 { |
297 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = prpConsoleMessage; | 297 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = prpConsoleMessage; |
298 if (!isContextThread()) { | 298 if (!isContextThread()) { |
299 postTask(AddConsoleMessageTask::create(consoleMessage->source(), console
Message->level(), consoleMessage->message())); | 299 postTask(FROM_HERE, AddConsoleMessageTask::create(consoleMessage->source
(), consoleMessage->level(), consoleMessage->message())); |
300 return; | 300 return; |
301 } | 301 } |
302 thread()->workerReportingProxy().reportConsoleMessage(consoleMessage); | 302 thread()->workerReportingProxy().reportConsoleMessage(consoleMessage); |
303 addMessageToWorkerConsole(consoleMessage.release()); | 303 addMessageToWorkerConsole(consoleMessage.release()); |
304 } | 304 } |
305 | 305 |
306 void WorkerGlobalScope::addMessageToWorkerConsole(PassRefPtrWillBeRawPtr<Console
Message> consoleMessage) | 306 void WorkerGlobalScope::addMessageToWorkerConsole(PassRefPtrWillBeRawPtr<Console
Message> consoleMessage) |
307 { | 307 { |
308 ASSERT(isContextThread()); | 308 ASSERT(isContextThread()); |
309 m_messageStorage->reportMessage(this, consoleMessage); | 309 m_messageStorage->reportMessage(this, consoleMessage); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 visitor->trace(m_timers); | 372 visitor->trace(m_timers); |
373 visitor->trace(m_messageStorage); | 373 visitor->trace(m_messageStorage); |
374 visitor->trace(m_pendingMessages); | 374 visitor->trace(m_pendingMessages); |
375 HeapSupplementable<WorkerGlobalScope>::trace(visitor); | 375 HeapSupplementable<WorkerGlobalScope>::trace(visitor); |
376 #endif | 376 #endif |
377 ExecutionContext::trace(visitor); | 377 ExecutionContext::trace(visitor); |
378 EventTargetWithInlineData::trace(visitor); | 378 EventTargetWithInlineData::trace(visitor); |
379 } | 379 } |
380 | 380 |
381 } // namespace blink | 381 } // namespace blink |
OLD | NEW |