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

Side by Side Diff: webrtc/system_wrappers/source/critical_section_unittest.cc

Issue 2708723003: Introduce new constructor to PlatformThread. (Closed)
Patch Set: Disable RTC_DCHECK in channel_proxy + add TODO Created 3 years, 10 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
« no previous file with comments | « webrtc/modules/video_coding/frame_buffer2_unittest.cc ('k') | webrtc/video/end_to_end_tests.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 // test both fast and non-flaky. 61 // test both fast and non-flaky.
62 // With 1 us wait as the switch, up to 7 rounds have been observed. 62 // With 1 us wait as the switch, up to 7 rounds have been observed.
63 while (count->Count() < target && loop_counter < 100 * target) { 63 while (count->Count() < target && loop_counter < 100 * target) {
64 ++loop_counter; 64 ++loop_counter;
65 SwitchProcess(); 65 SwitchProcess();
66 } 66 }
67 return (count->Count() >= target); 67 return (count->Count() >= target);
68 } 68 }
69 }; 69 };
70 70
71 bool LockUnlockThenStopRunFunction(void* obj) { 71 void LockUnlockThenStopRunFunction(void* obj) {
72 ProtectedCount* the_count = static_cast<ProtectedCount*>(obj); 72 ProtectedCount* the_count = static_cast<ProtectedCount*>(obj);
73 the_count->Increment(); 73 the_count->Increment();
74 return false;
75 } 74 }
76 75
77 TEST_F(CritSectTest, ThreadWakesOnce) NO_THREAD_SAFETY_ANALYSIS { 76 TEST_F(CritSectTest, ThreadWakesOnce) NO_THREAD_SAFETY_ANALYSIS {
78 CriticalSectionWrapper* crit_sect = 77 CriticalSectionWrapper* crit_sect =
79 CriticalSectionWrapper::CreateCriticalSection(); 78 CriticalSectionWrapper::CreateCriticalSection();
80 ProtectedCount count(crit_sect); 79 ProtectedCount count(crit_sect);
81 rtc::PlatformThread thread( 80 rtc::PlatformThread thread(
82 &LockUnlockThenStopRunFunction, &count, "ThreadWakesOnce"); 81 &LockUnlockThenStopRunFunction, &count, "ThreadWakesOnce");
83 crit_sect->Enter(); 82 crit_sect->Enter();
84 thread.Start(); 83 thread.Start();
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 127
129 SwitchProcess(); 128 SwitchProcess();
130 EXPECT_TRUE(WaitForCount(count_before + 1, &count)); 129 EXPECT_TRUE(WaitForCount(count_before + 1, &count));
131 thread.Stop(); 130 thread.Stop();
132 delete crit_sect; 131 delete crit_sect;
133 } 132 }
134 133
135 } // anonymous namespace 134 } // anonymous namespace
136 135
137 } // namespace webrtc 136 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/video_coding/frame_buffer2_unittest.cc ('k') | webrtc/video/end_to_end_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698