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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 m_isInstrumented = !m_task->taskNameForInstrumentation().isEmpty(); | 242 m_isInstrumented = !m_task->taskNameForInstrumentation().isEmpty(); |
243 if (m_isInstrumented) | 243 if (m_isInstrumented) |
244 InspectorInstrumentation::didPostExecutionContextTask(m_workerThread
.workerGlobalScope(), m_task.get()); | 244 InspectorInstrumentation::didPostExecutionContextTask(m_workerThread
.workerGlobalScope(), m_task.get()); |
245 } | 245 } |
246 | 246 |
247 WorkerThread& m_workerThread; | 247 WorkerThread& m_workerThread; |
248 OwnPtr<ExecutionContextTask> m_task; | 248 OwnPtr<ExecutionContextTask> m_task; |
249 bool m_isInstrumented; | 249 bool m_isInstrumented; |
250 }; | 250 }; |
251 | 251 |
252 class RunDebuggerQueueTask final : public ExecutionContextTask { | |
253 public: | |
254 static PassOwnPtr<RunDebuggerQueueTask> create(WorkerThread* thread) | |
255 { | |
256 return adoptPtr(new RunDebuggerQueueTask(thread)); | |
257 } | |
258 virtual void performTask(ExecutionContext* context) override | |
259 { | |
260 ASSERT(context->isWorkerGlobalScope()); | |
261 m_thread->runDebuggerTask(WorkerThread::DontWaitForMessage); | |
262 } | |
263 | |
264 private: | |
265 explicit RunDebuggerQueueTask(WorkerThread* thread) : m_thread(thread) { } | |
266 | |
267 WorkerThread* m_thread; | |
268 }; | |
269 | |
270 WorkerThread::WorkerThread(PassRefPtr<WorkerLoaderProxy> workerLoaderProxy, Work
erReportingProxy& workerReportingProxy) | 252 WorkerThread::WorkerThread(PassRefPtr<WorkerLoaderProxy> workerLoaderProxy, Work
erReportingProxy& workerReportingProxy) |
271 : m_started(false) | 253 : m_started(false) |
272 , m_terminated(false) | 254 , m_terminated(false) |
273 , m_shutdown(false) | 255 , m_shutdown(false) |
274 , m_workerLoaderProxy(workerLoaderProxy) | 256 , m_workerLoaderProxy(workerLoaderProxy) |
275 , m_workerReportingProxy(workerReportingProxy) | 257 , m_workerReportingProxy(workerReportingProxy) |
276 , m_webScheduler(nullptr) | 258 , m_webScheduler(nullptr) |
277 , m_isolate(nullptr) | 259 , m_isolate(nullptr) |
278 , m_shutdownEvent(adoptPtr(Platform::current()->createWaitableEvent())) | 260 , m_shutdownEvent(adoptPtr(Platform::current()->createWaitableEvent())) |
279 , m_terminationEvent(adoptPtr(Platform::current()->createWaitableEvent())) | 261 , m_terminationEvent(adoptPtr(Platform::current()->createWaitableEvent())) |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 m_isolate = nullptr; | 536 m_isolate = nullptr; |
555 } | 537 } |
556 | 538 |
557 void WorkerThread::terminateV8Execution() | 539 void WorkerThread::terminateV8Execution() |
558 { | 540 { |
559 ASSERT(isMainThread()); | 541 ASSERT(isMainThread()); |
560 m_workerGlobalScope->script()->willScheduleExecutionTermination(); | 542 m_workerGlobalScope->script()->willScheduleExecutionTermination(); |
561 v8::V8::TerminateExecution(m_isolate); | 543 v8::V8::TerminateExecution(m_isolate); |
562 } | 544 } |
563 | 545 |
564 void WorkerThread::postDebuggerTask(const WebTraceLocation& location, PassOwnPtr
<ExecutionContextTask> task) | 546 void WorkerThread::appendDebuggerTask(PassOwnPtr<WebThread::Task> task) |
565 { | 547 { |
566 m_debuggerMessageQueue.append(WorkerThreadTask::create(*this, task, false)); | 548 m_debuggerMessageQueue.append(task); |
567 postTask(location, RunDebuggerQueueTask::create(this)); | |
568 } | 549 } |
569 | 550 |
570 MessageQueueWaitResult WorkerThread::runDebuggerTask(WaitMode waitMode) | 551 MessageQueueWaitResult WorkerThread::runDebuggerTask(WaitMode waitMode) |
571 { | 552 { |
572 ASSERT(isCurrentThread()); | 553 ASSERT(isCurrentThread()); |
573 MessageQueueWaitResult result; | 554 MessageQueueWaitResult result; |
574 double absoluteTime = MessageQueue<WebThread::Task>::infiniteTime(); | 555 double absoluteTime = MessageQueue<WebThread::Task>::infiniteTime(); |
575 OwnPtr<WebThread::Task> task; | 556 OwnPtr<WebThread::Task> task; |
576 { | 557 { |
577 if (waitMode == DontWaitForMessage) | 558 if (waitMode == DontWaitForMessage) |
(...skipping 21 matching lines...) Expand all Loading... |
599 InspectorInstrumentation::didLeaveNestedRunLoop(m_workerGlobalScope.get()); | 580 InspectorInstrumentation::didLeaveNestedRunLoop(m_workerGlobalScope.get()); |
600 } | 581 } |
601 | 582 |
602 void WorkerThread::setWorkerInspectorController(WorkerInspectorController* worke
rInspectorController) | 583 void WorkerThread::setWorkerInspectorController(WorkerInspectorController* worke
rInspectorController) |
603 { | 584 { |
604 MutexLocker locker(m_workerInspectorControllerMutex); | 585 MutexLocker locker(m_workerInspectorControllerMutex); |
605 m_workerInspectorController = workerInspectorController; | 586 m_workerInspectorController = workerInspectorController; |
606 } | 587 } |
607 | 588 |
608 } // namespace blink | 589 } // namespace blink |
OLD | NEW |