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 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 value_ = value; | 329 value_ = value; |
330 } | 330 } |
331 | 331 |
332 bool Get() { | 332 bool Get() { |
333 CritScope lock(&crit_); | 333 CritScope lock(&crit_); |
334 return value_; | 334 return value_; |
335 } | 335 } |
336 | 336 |
337 private: | 337 private: |
338 CriticalSection crit_; | 338 CriticalSection crit_; |
339 bool value_ GUARDED_BY(crit_); | 339 bool value_ RTC_GUARDED_BY(crit_); |
340 }; | 340 }; |
341 | 341 |
342 struct LocalFuncs { | 342 struct LocalFuncs { |
343 static void Set(LockedBool* out) { out->Set(true); } | 343 static void Set(LockedBool* out) { out->Set(true); } |
344 static void InvokeSet(Thread* thread, LockedBool* out) { | 344 static void InvokeSet(Thread* thread, LockedBool* out) { |
345 thread->Invoke<void>(RTC_FROM_HERE, Bind(&Set, out)); | 345 thread->Invoke<void>(RTC_FROM_HERE, Bind(&Set, out)); |
346 } | 346 } |
347 | 347 |
348 // Set |out| true and call InvokeSet on |thread|. | 348 // Set |out| true and call InvokeSet on |thread|. |
349 static void SetAndInvokeSet(LockedBool* out, | 349 static void SetAndInvokeSet(LockedBool* out, |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 // Execute pending calls with id == 5. | 636 // Execute pending calls with id == 5. |
637 EXPECT_TRUE(invoker.Flush(5)); | 637 EXPECT_TRUE(invoker.Flush(5)); |
638 EXPECT_TRUE(flag1.get()); | 638 EXPECT_TRUE(flag1.get()); |
639 EXPECT_FALSE(flag2.get()); | 639 EXPECT_FALSE(flag2.get()); |
640 flag1 = false; | 640 flag1 = false; |
641 // Execute all pending calls. The id == 5 call should not execute again. | 641 // Execute all pending calls. The id == 5 call should not execute again. |
642 EXPECT_TRUE(invoker.Flush()); | 642 EXPECT_TRUE(invoker.Flush()); |
643 EXPECT_FALSE(flag1.get()); | 643 EXPECT_FALSE(flag1.get()); |
644 EXPECT_TRUE(flag2.get()); | 644 EXPECT_TRUE(flag2.get()); |
645 } | 645 } |
OLD | NEW |