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

Unified Diff: webrtc/pc/channel_unittest.cc

Issue 1736763006: Fix for intermittent tsan2 errors from SendRtpToRtpOnThread and SendSrtpToSrtpOnThread. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/pc/channel_unittest.cc
diff --git a/webrtc/pc/channel_unittest.cc b/webrtc/pc/channel_unittest.cc
index ad5fbaf1847e11997359b66b6846f8f4706ce43c..7dfafcef6c4cbb1abdff72d8ca7d64aba7b503e5 100644
--- a/webrtc/pc/channel_unittest.cc
+++ b/webrtc/pc/channel_unittest.cc
@@ -29,6 +29,8 @@
#include "webrtc/p2p/base/faketransportcontroller.h"
#include "webrtc/pc/channel.h"
+#include <atomic>
+
#define MAYBE_SKIP_TEST(feature) \
if (!(rtc::SSLStreamAdapter::feature())) { \
LOG(LS_INFO) << "Feature disabled... skipping"; \
@@ -408,31 +410,29 @@ class ChannelTest : public testing::Test, public sigslot::has_slots<> {
class CallThread : public rtc::SignalThread {
public:
typedef bool (ChannelTest<T>::*Method)();
- CallThread(ChannelTest<T>* obj, Method method, bool* result)
+ CallThread(ChannelTest<T>* obj, Method method, std::atomic<bool>* result)
: obj_(obj),
method_(method),
result_(result) {
*result = false;
}
virtual void DoWork() {
- bool result = (*obj_.*method_)();
- if (result_) {
- *result_ = result;
- }
+ *result_ = (*obj_.*method_)();
ossu 2016/03/01 15:00:38 Since the pointer is always written to in the cons
Taylor Brandstetter 2016/03/01 20:03:42 I think the purpose of the check was so that you c
}
private:
ChannelTest<T>* obj_;
Method method_;
- bool* result_;
+ std::atomic<bool>* result_;
};
- void CallOnThread(typename CallThread::Method method, bool* result) {
+ void CallOnThread(typename CallThread::Method method,
+ std::atomic<bool>* result) {
CallThread* thread = new CallThread(this, method, result);
thread->Start();
thread->Release();
}
void CallOnThreadAndWaitForDone(typename CallThread::Method method,
- bool* result) {
+ std::atomic<bool>* result) {
CallThread* thread = new CallThread(this, method, result);
thread->Start();
thread->Destroy(true);
@@ -1326,7 +1326,7 @@ class ChannelTest : public testing::Test, public sigslot::has_slots<> {
// Test that we properly send RTP without SRTP from a thread.
void SendRtpToRtpOnThread() {
- bool sent_rtp1, sent_rtp2, sent_rtcp1, sent_rtcp2;
+ std::atomic<bool> sent_rtp1, sent_rtp2, sent_rtcp1, sent_rtcp2;
CreateChannels(RTCP, RTCP);
EXPECT_TRUE(SendInitiate());
EXPECT_TRUE(SendAccept());
@@ -1350,7 +1350,7 @@ class ChannelTest : public testing::Test, public sigslot::has_slots<> {
// Test that we properly send SRTP with RTCP from a thread.
void SendSrtpToSrtpOnThread() {
- bool sent_rtp1, sent_rtp2, sent_rtcp1, sent_rtcp2;
+ std::atomic<bool> sent_rtp1, sent_rtp2, sent_rtcp1, sent_rtcp2;
CreateChannels(RTCP | SECURE, RTCP | SECURE);
EXPECT_TRUE(SendInitiate());
EXPECT_TRUE(SendAccept());
@@ -1624,7 +1624,7 @@ class ChannelTest : public testing::Test, public sigslot::has_slots<> {
}
void TestFlushRtcp() {
- bool send_rtcp1;
+ std::atomic<bool> send_rtcp1;
CreateChannels(RTCP, RTCP);
EXPECT_TRUE(SendInitiate());
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698