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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 DEFINE_STATIC_LOCAL(HashSet<WorkerThread*>, threads, ()); | 103 DEFINE_STATIC_LOCAL(HashSet<WorkerThread*>, threads, ()); |
104 return threads; | 104 return threads; |
105 } | 105 } |
106 | 106 |
107 unsigned WorkerThread::workerThreadCount() | 107 unsigned WorkerThread::workerThreadCount() |
108 { | 108 { |
109 MutexLocker lock(threadSetMutex()); | 109 MutexLocker lock(threadSetMutex()); |
110 return workerThreads().size(); | 110 return workerThreads().size(); |
111 } | 111 } |
112 | 112 |
113 class WorkerThreadTask : public WebThread::Task { | 113 class WorkerThreadTask : public WebTaskRunner::Task { |
114 WTF_MAKE_NONCOPYABLE(WorkerThreadTask); WTF_MAKE_FAST_ALLOCATED(WorkerThread
Task); | 114 WTF_MAKE_NONCOPYABLE(WorkerThreadTask); WTF_MAKE_FAST_ALLOCATED(WorkerThread
Task); |
115 public: | 115 public: |
116 static PassOwnPtr<WorkerThreadTask> create(WorkerThread& workerThread, PassO
wnPtr<ExecutionContextTask> task, bool isInstrumented) | 116 static PassOwnPtr<WorkerThreadTask> create(WorkerThread& workerThread, PassO
wnPtr<ExecutionContextTask> task, bool isInstrumented) |
117 { | 117 { |
118 return adoptPtr(new WorkerThreadTask(workerThread, task, isInstrumented)
); | 118 return adoptPtr(new WorkerThreadTask(workerThread, task, isInstrumented)
); |
119 } | 119 } |
120 | 120 |
121 ~WorkerThreadTask() override { } | 121 ~WorkerThreadTask() override { } |
122 | 122 |
123 void run() override | 123 void run() override |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 ASSERT(isCurrentThread()); | 468 ASSERT(isCurrentThread()); |
469 V8PerIsolateData::destroy(m_isolate); | 469 V8PerIsolateData::destroy(m_isolate); |
470 } | 470 } |
471 | 471 |
472 void WorkerThread::terminateV8Execution() | 472 void WorkerThread::terminateV8Execution() |
473 { | 473 { |
474 ASSERT(isMainThread()); | 474 ASSERT(isMainThread()); |
475 v8::V8::TerminateExecution(m_isolate); | 475 v8::V8::TerminateExecution(m_isolate); |
476 } | 476 } |
477 | 477 |
478 void WorkerThread::appendDebuggerTask(PassOwnPtr<WebThread::Task> task) | 478 void WorkerThread::appendDebuggerTask(PassOwnPtr<WebTaskRunner::Task> task) |
479 { | 479 { |
480 { | 480 { |
481 MutexLocker lock(m_threadStateMutex); | 481 MutexLocker lock(m_threadStateMutex); |
482 if (m_shutdown) | 482 if (m_shutdown) |
483 return; | 483 return; |
484 } | 484 } |
485 m_debuggerMessageQueue.append(task); | 485 m_debuggerMessageQueue.append(task); |
486 } | 486 } |
487 | 487 |
488 MessageQueueWaitResult WorkerThread::runDebuggerTask(WaitMode waitMode) | 488 MessageQueueWaitResult WorkerThread::runDebuggerTask(WaitMode waitMode) |
489 { | 489 { |
490 ASSERT(isCurrentThread()); | 490 ASSERT(isCurrentThread()); |
491 MessageQueueWaitResult result; | 491 MessageQueueWaitResult result; |
492 double absoluteTime = MessageQueue<WebThread::Task>::infiniteTime(); | 492 double absoluteTime = MessageQueue<WebTaskRunner::Task>::infiniteTime(); |
493 OwnPtr<WebThread::Task> task; | 493 OwnPtr<WebTaskRunner::Task> task; |
494 { | 494 { |
495 if (waitMode == DontWaitForMessage) | 495 if (waitMode == DontWaitForMessage) |
496 absoluteTime = 0.0; | 496 absoluteTime = 0.0; |
497 SafePointScope safePointScope(ThreadState::NoHeapPointersOnStack); | 497 SafePointScope safePointScope(ThreadState::NoHeapPointersOnStack); |
498 task = m_debuggerMessageQueue.waitForMessageWithTimeout(result, absolute
Time); | 498 task = m_debuggerMessageQueue.waitForMessageWithTimeout(result, absolute
Time); |
499 } | 499 } |
500 | 500 |
501 if (result == MessageQueueMessageReceived) { | 501 if (result == MessageQueueMessageReceived) { |
502 InspectorInstrumentation::willProcessTask(workerGlobalScope()); | 502 InspectorInstrumentation::willProcessTask(workerGlobalScope()); |
503 task->run(); | 503 task->run(); |
(...skipping 13 matching lines...) Expand all Loading... |
517 InspectorInstrumentation::didLeaveNestedRunLoop(m_workerGlobalScope.get()); | 517 InspectorInstrumentation::didLeaveNestedRunLoop(m_workerGlobalScope.get()); |
518 } | 518 } |
519 | 519 |
520 void WorkerThread::setWorkerInspectorController(WorkerInspectorController* worke
rInspectorController) | 520 void WorkerThread::setWorkerInspectorController(WorkerInspectorController* worke
rInspectorController) |
521 { | 521 { |
522 MutexLocker locker(m_workerInspectorControllerMutex); | 522 MutexLocker locker(m_workerInspectorControllerMutex); |
523 m_workerInspectorController = workerInspectorController; | 523 m_workerInspectorController = workerInspectorController; |
524 } | 524 } |
525 | 525 |
526 } // namespace blink | 526 } // namespace blink |
OLD | NEW |