Chromium Code Reviews| 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_workerLoaderProxy(workerLoaderProxy) | 255 , m_workerLoaderProxy(workerLoaderProxy) |
| 274 , m_workerReportingProxy(workerReportingProxy) | 256 , m_workerReportingProxy(workerReportingProxy) |
| 275 , m_webScheduler(nullptr) | 257 , m_webScheduler(nullptr) |
| 276 , m_isolate(nullptr) | 258 , m_isolate(nullptr) |
| 277 , m_shutdownEvent(adoptPtr(Platform::current()->createWaitableEvent())) | 259 , m_shutdownEvent(adoptPtr(Platform::current()->createWaitableEvent())) |
| 278 , m_terminationEvent(adoptPtr(Platform::current()->createWaitableEvent())) | 260 , m_terminationEvent(adoptPtr(Platform::current()->createWaitableEvent())) |
| 279 { | 261 { |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 545 m_isolate = nullptr; | 527 m_isolate = nullptr; |
| 546 } | 528 } |
| 547 | 529 |
| 548 void WorkerThread::terminateV8Execution() | 530 void WorkerThread::terminateV8Execution() |
| 549 { | 531 { |
| 550 ASSERT(isMainThread()); | 532 ASSERT(isMainThread()); |
| 551 m_workerGlobalScope->script()->willScheduleExecutionTermination(); | 533 m_workerGlobalScope->script()->willScheduleExecutionTermination(); |
| 552 v8::V8::TerminateExecution(m_isolate); | 534 v8::V8::TerminateExecution(m_isolate); |
| 553 } | 535 } |
| 554 | 536 |
| 555 void WorkerThread::postDebuggerTask(const WebTraceLocation& location, PassOwnPtr <ExecutionContextTask> task) | 537 void WorkerThread::appendDebuggerTask(PassOwnPtr<WebThread::Task> task) |
|
kinuko
2015/05/18 15:19:49
Assuming that we're also going to remove willEnter
sadrul
2015/05/19 03:50:47
That's an interesting idea. pfeldman@/yurus@: what
| |
| 556 { | 538 { |
| 557 m_debuggerMessageQueue.append(WorkerThreadTask::create(*this, task, false)); | 539 m_debuggerMessageQueue.append(task); |
| 558 postTask(location, RunDebuggerQueueTask::create(this)); | |
| 559 } | 540 } |
| 560 | 541 |
| 561 MessageQueueWaitResult WorkerThread::runDebuggerTask(WaitMode waitMode) | 542 MessageQueueWaitResult WorkerThread::runDebuggerTask(WaitMode waitMode) |
| 562 { | 543 { |
| 563 ASSERT(isCurrentThread()); | 544 ASSERT(isCurrentThread()); |
| 564 MessageQueueWaitResult result; | 545 MessageQueueWaitResult result; |
| 565 double absoluteTime = MessageQueue<WebThread::Task>::infiniteTime(); | 546 double absoluteTime = MessageQueue<WebThread::Task>::infiniteTime(); |
| 566 OwnPtr<WebThread::Task> task; | 547 OwnPtr<WebThread::Task> task; |
| 567 { | 548 { |
| 568 if (waitMode == DontWaitForMessage) | 549 if (waitMode == DontWaitForMessage) |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 590 InspectorInstrumentation::didLeaveNestedRunLoop(m_workerGlobalScope.get()); | 571 InspectorInstrumentation::didLeaveNestedRunLoop(m_workerGlobalScope.get()); |
| 591 } | 572 } |
| 592 | 573 |
| 593 void WorkerThread::setWorkerInspectorController(WorkerInspectorController* worke rInspectorController) | 574 void WorkerThread::setWorkerInspectorController(WorkerInspectorController* worke rInspectorController) |
| 594 { | 575 { |
| 595 MutexLocker locker(m_workerInspectorControllerMutex); | 576 MutexLocker locker(m_workerInspectorControllerMutex); |
| 596 m_workerInspectorController = workerInspectorController; | 577 m_workerInspectorController = workerInspectorController; |
| 597 } | 578 } |
| 598 | 579 |
| 599 } // namespace blink | 580 } // namespace blink |
| OLD | NEW |