| 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 16 matching lines...) Expand all Loading... |
| 27 ~SafePointScope() { | 27 ~SafePointScope() { |
| 28 if (m_state) | 28 if (m_state) |
| 29 m_state->leaveSafePoint(); | 29 m_state->leaveSafePoint(); |
| 30 } | 30 } |
| 31 | 31 |
| 32 private: | 32 private: |
| 33 ThreadState* m_state; | 33 ThreadState* m_state; |
| 34 }; | 34 }; |
| 35 | 35 |
| 36 // The SafePointAwareMutexLocker is used to enter a safepoint while waiting for | 36 // The SafePointAwareMutexLocker is used to enter a safepoint while waiting for |
| 37 // a mutex lock. It also ensures that the lock is not held while waiting for a G
C | 37 // a mutex lock. It also ensures that the lock is not held while waiting for a |
| 38 // to complete in the leaveSafePoint method, by releasing the lock if the | 38 // GC to complete in the leaveSafePoint method, by releasing the lock if the |
| 39 // leaveSafePoint method cannot complete without blocking, see | 39 // leaveSafePoint method cannot complete without blocking, see |
| 40 // SafePointBarrier::checkAndPark. | 40 // SafePointBarrier::checkAndPark. |
| 41 class SafePointAwareMutexLocker final { | 41 class SafePointAwareMutexLocker final { |
| 42 STACK_ALLOCATED(); | 42 STACK_ALLOCATED(); |
| 43 WTF_MAKE_NONCOPYABLE(SafePointAwareMutexLocker); | 43 WTF_MAKE_NONCOPYABLE(SafePointAwareMutexLocker); |
| 44 | 44 |
| 45 public: | 45 public: |
| 46 explicit SafePointAwareMutexLocker( | 46 explicit SafePointAwareMutexLocker( |
| 47 MutexBase& mutex, | 47 MutexBase& mutex, |
| 48 BlinkGC::StackState stackState = BlinkGC::HeapPointersOnStack) | 48 BlinkGC::StackState stackState = BlinkGC::HeapPointersOnStack) |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 | 153 |
| 154 Mutex m_mutex; | 154 Mutex m_mutex; |
| 155 | 155 |
| 156 ThreadCondition m_parked; | 156 ThreadCondition m_parked; |
| 157 ThreadCondition m_resume; | 157 ThreadCondition m_resume; |
| 158 }; | 158 }; |
| 159 | 159 |
| 160 } // namespace blink | 160 } // namespace blink |
| 161 | 161 |
| 162 #endif | 162 #endif |
| OLD | NEW |