| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef SafePoint_h | 5 #ifndef SafePoint_h |
| 6 #define SafePoint_h | 6 #define SafePoint_h |
| 7 | 7 |
| 8 #include "platform/heap/ThreadState.h" | 8 #include "platform/heap/ThreadState.h" |
| 9 #include "wtf/ThreadingPrimitives.h" | 9 #include "wtf/ThreadingPrimitives.h" |
| 10 | 10 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 } | 86 } |
| 87 | 87 |
| 88 MutexBase& m_mutex; | 88 MutexBase& m_mutex; |
| 89 bool m_locked; | 89 bool m_locked; |
| 90 }; | 90 }; |
| 91 | 91 |
| 92 class SafePointBarrier final { | 92 class SafePointBarrier final { |
| 93 USING_FAST_MALLOC(SafePointBarrier); | 93 USING_FAST_MALLOC(SafePointBarrier); |
| 94 WTF_MAKE_NONCOPYABLE(SafePointBarrier); | 94 WTF_MAKE_NONCOPYABLE(SafePointBarrier); |
| 95 public: | 95 public: |
| 96 SafePointBarrier(); | 96 explicit SafePointBarrier(Heap*); |
| 97 ~SafePointBarrier(); | 97 ~SafePointBarrier(); |
| 98 | 98 |
| 99 // Request other attached threads that are not at safe points to park | 99 // Request other attached threads that are not at safe points to park |
| 100 // themselves on safepoints. | 100 // themselves on safepoints. |
| 101 bool parkOthers(); | 101 bool parkOthers(); |
| 102 | 102 |
| 103 // Resume executions of other attached threads that are parked at | 103 // Resume executions of other attached threads that are parked at |
| 104 // the safe points. | 104 // the safe points. |
| 105 void resumeOthers(bool barrierLocked = false); | 105 void resumeOthers(bool barrierLocked = false); |
| 106 | 106 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 121 static void enterSafePointAfterPushRegisters(SafePointBarrier* barrier, Thre
adState* state, intptr_t* stackEnd) | 121 static void enterSafePointAfterPushRegisters(SafePointBarrier* barrier, Thre
adState* state, intptr_t* stackEnd) |
| 122 { | 122 { |
| 123 barrier->doEnterSafePoint(state, stackEnd); | 123 barrier->doEnterSafePoint(state, stackEnd); |
| 124 } | 124 } |
| 125 | 125 |
| 126 volatile int m_canResume; | 126 volatile int m_canResume; |
| 127 volatile int m_unparkedThreadCount; | 127 volatile int m_unparkedThreadCount; |
| 128 Mutex m_mutex; | 128 Mutex m_mutex; |
| 129 ThreadCondition m_parked; | 129 ThreadCondition m_parked; |
| 130 ThreadCondition m_resume; | 130 ThreadCondition m_resume; |
| 131 Heap* m_heap; |
| 131 }; | 132 }; |
| 132 | 133 |
| 133 } // namespace blink | 134 } // namespace blink |
| 134 | 135 |
| 135 #endif | 136 #endif |
| OLD | NEW |