Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(393)

Side by Side Diff: third_party/WebKit/Source/platform/heap/SafePoint.h

Issue 2619493003: Replace ASSERTs in platform/heap/ with DCHECKs
Patch Set: temp Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
11 namespace blink { 11 namespace blink {
12 12
13 class SafePointScope final { 13 class SafePointScope final {
14 STACK_ALLOCATED(); 14 STACK_ALLOCATED();
15 WTF_MAKE_NONCOPYABLE(SafePointScope); 15 WTF_MAKE_NONCOPYABLE(SafePointScope);
16 16
17 public: 17 public:
18 explicit SafePointScope(BlinkGC::StackState stackState, 18 explicit SafePointScope(BlinkGC::StackState stackState,
19 ThreadState* state = ThreadState::current()) 19 ThreadState* state = ThreadState::current())
20 : m_state(state) { 20 : m_state(state) {
21 if (m_state) { 21 if (m_state) {
22 RELEASE_ASSERT(!m_state->isAtSafePoint()); 22 CHECK(!m_state->isAtSafePoint());
23 m_state->enterSafePoint(stackState, this); 23 m_state->enterSafePoint(stackState, this);
24 } 24 }
25 } 25 }
26 26
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:
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 // When leaving the safepoint we might end up release the mutex 64 // When leaving the safepoint we might end up release the mutex
65 // if another thread is requesting a GC, see 65 // if another thread is requesting a GC, see
66 // SafePointBarrier::checkAndPark. This is the case where we 66 // SafePointBarrier::checkAndPark. This is the case where we
67 // loop around to reacquire the lock. 67 // loop around to reacquire the lock.
68 state->leaveSafePoint(this); 68 state->leaveSafePoint(this);
69 } 69 }
70 } while (!m_locked); 70 } while (!m_locked);
71 } 71 }
72 72
73 ~SafePointAwareMutexLocker() { 73 ~SafePointAwareMutexLocker() {
74 ASSERT(m_locked); 74 DCHECK(m_locked);
75 m_mutex.unlock(); 75 m_mutex.unlock();
76 } 76 }
77 77
78 private: 78 private:
79 friend class SafePointBarrier; 79 friend class SafePointBarrier;
80 80
81 void reset() { 81 void reset() {
82 ASSERT(m_locked); 82 DCHECK(m_locked);
83 m_mutex.unlock(); 83 m_mutex.unlock();
84 m_locked = false; 84 m_locked = false;
85 } 85 }
86 86
87 MutexBase& m_mutex; 87 MutexBase& m_mutex;
88 bool m_locked; 88 bool m_locked;
89 }; 89 };
90 90
91 class SafePointBarrier final { 91 class SafePointBarrier final {
92 USING_FAST_MALLOC(SafePointBarrier); 92 USING_FAST_MALLOC(SafePointBarrier);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698