| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 | 83 |
| 84 unsigned WorkerThread::workerThreadCount() | 84 unsigned WorkerThread::workerThreadCount() |
| 85 { | 85 { |
| 86 MutexLocker lock(threadSetMutex()); | 86 MutexLocker lock(threadSetMutex()); |
| 87 return workerThreads().size(); | 87 return workerThreads().size(); |
| 88 } | 88 } |
| 89 | 89 |
| 90 class WorkerThreadCancelableTask final : public ExecutionContextTask { | 90 class WorkerThreadCancelableTask final : public ExecutionContextTask { |
| 91 WTF_MAKE_NONCOPYABLE(WorkerThreadCancelableTask); WTF_MAKE_FAST_ALLOCATED; | 91 WTF_MAKE_NONCOPYABLE(WorkerThreadCancelableTask); WTF_MAKE_FAST_ALLOCATED; |
| 92 public: | 92 public: |
| 93 static PassOwnPtr<WorkerThreadCancelableTask> create(const Closure& closure) | 93 static PassOwnPtr<WorkerThreadCancelableTask> create(PassOwnPtr<Closure> clo
sure) |
| 94 { | 94 { |
| 95 return adoptPtr(new WorkerThreadCancelableTask(closure)); | 95 return adoptPtr(new WorkerThreadCancelableTask(closure)); |
| 96 } | 96 } |
| 97 | 97 |
| 98 virtual void performTask(ExecutionContext*) override | 98 virtual void performTask(ExecutionContext*) override |
| 99 { | 99 { |
| 100 if (!m_taskCanceled) | 100 if (!m_taskCanceled) |
| 101 m_closure(); | 101 (*m_closure)(); |
| 102 } | 102 } |
| 103 | 103 |
| 104 void cancelTask() { m_taskCanceled = true; } | 104 void cancelTask() { m_taskCanceled = true; } |
| 105 | 105 |
| 106 private: | 106 private: |
| 107 explicit WorkerThreadCancelableTask(const Closure& closure) | 107 explicit WorkerThreadCancelableTask(PassOwnPtr<Closure> closure) |
| 108 : m_closure(closure) | 108 : m_closure(closure) |
| 109 , m_taskCanceled(false) | 109 , m_taskCanceled(false) |
| 110 { } | 110 { } |
| 111 | 111 |
| 112 Closure m_closure; | 112 OwnPtr<Closure> m_closure; |
| 113 bool m_taskCanceled; | 113 bool m_taskCanceled; |
| 114 }; | 114 }; |
| 115 | 115 |
| 116 class WorkerSharedTimer : public SharedTimer { | 116 class WorkerSharedTimer : public SharedTimer { |
| 117 public: | 117 public: |
| 118 explicit WorkerSharedTimer(WorkerThread* workerThread) | 118 explicit WorkerSharedTimer(WorkerThread* workerThread) |
| 119 : m_workerThread(workerThread) | 119 : m_workerThread(workerThread) |
| 120 , m_nextFireTime(0.0) | 120 , m_nextFireTime(0.0) |
| 121 , m_running(false) | 121 , m_running(false) |
| 122 , m_lastQueuedTask(nullptr) | 122 , m_lastQueuedTask(nullptr) |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 InspectorInstrumentation::didLeaveNestedRunLoop(m_workerGlobalScope.get()); | 533 InspectorInstrumentation::didLeaveNestedRunLoop(m_workerGlobalScope.get()); |
| 534 } | 534 } |
| 535 | 535 |
| 536 void WorkerThread::setWorkerInspectorController(WorkerInspectorController* worke
rInspectorController) | 536 void WorkerThread::setWorkerInspectorController(WorkerInspectorController* worke
rInspectorController) |
| 537 { | 537 { |
| 538 MutexLocker locker(m_workerInspectorControllerMutex); | 538 MutexLocker locker(m_workerInspectorControllerMutex); |
| 539 m_workerInspectorController = workerInspectorController; | 539 m_workerInspectorController = workerInspectorController; |
| 540 } | 540 } |
| 541 | 541 |
| 542 } // namespace blink | 542 } // namespace blink |
| OLD | NEW |