OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(Worker); | 118 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(Worker); |
119 }; | 119 }; |
120 | 120 |
121 class SCOPED_LOCKABLE EnterExit { | 121 class SCOPED_LOCKABLE EnterExit { |
122 public: | 122 public: |
123 explicit EnterExit(SignalThread* t) EXCLUSIVE_LOCK_FUNCTION(t->cs_) | 123 explicit EnterExit(SignalThread* t) EXCLUSIVE_LOCK_FUNCTION(t->cs_) |
124 : t_(t) { | 124 : t_(t) { |
125 t_->cs_.Enter(); | 125 t_->cs_.Enter(); |
126 // If refcount_ is zero then the object has already been deleted and we | 126 // If refcount_ is zero then the object has already been deleted and we |
127 // will be double-deleting it in ~EnterExit()! (shouldn't happen) | 127 // will be double-deleting it in ~EnterExit()! (shouldn't happen) |
128 RTC_DCHECK(t_->refcount_ != 0); | 128 RTC_DCHECK_NE(t_->refcount_, 0); |
129 ++t_->refcount_; | 129 ++t_->refcount_; |
130 } | 130 } |
131 ~EnterExit() UNLOCK_FUNCTION() { | 131 ~EnterExit() UNLOCK_FUNCTION() { |
132 bool d = (0 == --t_->refcount_); | 132 bool d = (0 == --t_->refcount_); |
133 t_->cs_.Leave(); | 133 t_->cs_.Leave(); |
134 if (d) | 134 if (d) |
135 delete t_; | 135 delete t_; |
136 } | 136 } |
137 | 137 |
138 private: | 138 private: |
(...skipping 12 matching lines...) Expand all Loading... |
151 int refcount_; | 151 int refcount_; |
152 | 152 |
153 RTC_DISALLOW_COPY_AND_ASSIGN(SignalThread); | 153 RTC_DISALLOW_COPY_AND_ASSIGN(SignalThread); |
154 }; | 154 }; |
155 | 155 |
156 /////////////////////////////////////////////////////////////////////////////// | 156 /////////////////////////////////////////////////////////////////////////////// |
157 | 157 |
158 } // namespace rtc | 158 } // namespace rtc |
159 | 159 |
160 #endif // WEBRTC_BASE_SIGNALTHREAD_H_ | 160 #endif // WEBRTC_BASE_SIGNALTHREAD_H_ |
OLD | NEW |