OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 v8::Isolate* WorkerThread::isolate() | 233 v8::Isolate* WorkerThread::isolate() |
234 { | 234 { |
235 return workerBackingThread().isolate(); | 235 return workerBackingThread().isolate(); |
236 } | 236 } |
237 | 237 |
238 bool WorkerThread::isCurrentThread() | 238 bool WorkerThread::isCurrentThread() |
239 { | 239 { |
240 return m_started && workerBackingThread().backingThread().isCurrentThread(); | 240 return m_started && workerBackingThread().backingThread().isCurrentThread(); |
241 } | 241 } |
242 | 242 |
243 void WorkerThread::postTask(const WebTraceLocation& location, std::unique_ptr<Ex
ecutionContextTask> task) | 243 void WorkerThread::postTask(const WebTraceLocation& location, std::unique_ptr<Ex
ecutionContextTask> task, bool isInstrumented) |
244 { | 244 { |
245 { | 245 { |
246 MutexLocker lock(m_threadStateMutex); | 246 MutexLocker lock(m_threadStateMutex); |
247 if (m_terminated || m_readyToShutdown) | 247 if (m_terminated || m_readyToShutdown) |
248 return; | 248 return; |
249 } | 249 } |
250 | 250 |
251 bool isInstrumented = !task->taskNameForInstrumentation().isEmpty(); | |
252 if (isInstrumented) { | 251 if (isInstrumented) { |
253 DCHECK(isCurrentThread()); | 252 DCHECK(isCurrentThread()); |
254 InspectorInstrumentation::asyncTaskScheduled(workerGlobalScope(), "Worke
r task", task.get()); | 253 InspectorInstrumentation::asyncTaskScheduled(workerGlobalScope(), "Worke
r task", task.get()); |
255 } | 254 } |
256 workerBackingThread().backingThread().postTask(location, threadSafeBind(&Wor
kerThread::performTaskOnWorkerThread, AllowCrossThreadAccess(this), passed(std::
move(task)), isInstrumented)); | 255 workerBackingThread().backingThread().postTask(location, threadSafeBind(&Wor
kerThread::performTaskOnWorkerThread, AllowCrossThreadAccess(this), passed(std::
move(task)), isInstrumented)); |
257 } | 256 } |
258 | 257 |
259 void WorkerThread::appendDebuggerTask(std::unique_ptr<CrossThreadClosure> task) | 258 void WorkerThread::appendDebuggerTask(std::unique_ptr<CrossThreadClosure> task) |
260 { | 259 { |
261 DCHECK(isMainThread()); | 260 DCHECK(isMainThread()); |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 (*task)(); | 617 (*task)(); |
619 } | 618 } |
620 | 619 |
621 WorkerThread::ExitCode WorkerThread::getExitCode() | 620 WorkerThread::ExitCode WorkerThread::getExitCode() |
622 { | 621 { |
623 MutexLocker lock(m_threadStateMutex); | 622 MutexLocker lock(m_threadStateMutex); |
624 return m_exitCode; | 623 return m_exitCode; |
625 } | 624 } |
626 | 625 |
627 } // namespace blink | 626 } // namespace blink |
OLD | NEW |