diff options
author | jiayl@webrtc.org <jiayl@webrtc.org> | 2014-09-18 16:45:21 +0000 |
---|---|---|
committer | jiayl@webrtc.org <jiayl@webrtc.org> | 2014-09-18 16:45:21 +0000 |
commit | ba737cba1aa6607911b1ca10460423b4c3e51fb9 (patch) | |
tree | e0eea5e56470ec212ad598d2d479d2d5cd3ee574 /webrtc/base/thread_unittest.cc | |
parent | 611606297e6a78812b24b7a29b1242fc9e358992 (diff) | |
download | webrtc-ba737cba1aa6607911b1ca10460423b4c3e51fb9.tar.gz |
Do not require synchronization access on the thread if called from rtc::Thread::WrapCurrent.
The synchronization access is unnecessary for rtc::Thread::WrapCurrent (called from JingleThreadWrapper) since JingleThreadWrapper never calls rtc::Thread::Stop or rtc::Thread::Join. Failing to get the access caused crashes in Chrome since rtc::Thread::Current will be NULL when rtc::Thread::WrapCurrent fails.
rtc::ThreadManager::WrapCurrentThread still requires the synchronization access, since I am not sure if the callers (e.g. the plugin) depends on it.
BUG=crbug/413853
R=juberti@webrtc.org, tommi@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/30429004
git-svn-id: http://webrtc.googlecode.com/svn/trunk@7224 4adac7df-926f-26a2-2b94-8c16560cd09d
Diffstat (limited to 'webrtc/base/thread_unittest.cc')
-rw-r--r-- | webrtc/base/thread_unittest.cc | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/webrtc/base/thread_unittest.cc b/webrtc/base/thread_unittest.cc index 6a54ac7b39..6a68757458 100644 --- a/webrtc/base/thread_unittest.cc +++ b/webrtc/base/thread_unittest.cc @@ -105,6 +105,13 @@ class CustomThread : public rtc::Thread { CustomThread() {} virtual ~CustomThread() { Stop(); } bool Start() { return false; } + + bool WrapCurrent() { + return Thread::WrapCurrent(); + } + void UnwrapCurrent() { + Thread::UnwrapCurrent(); + } }; @@ -240,8 +247,6 @@ TEST(ThreadTest, Priorities) { } TEST(ThreadTest, Wrap) { - Thread* current_thread = Thread::Current(); - current_thread->UnwrapCurrent(); CustomThread* cthread = new CustomThread(); EXPECT_TRUE(cthread->WrapCurrent()); EXPECT_TRUE(cthread->RunningForTest()); @@ -249,7 +254,6 @@ TEST(ThreadTest, Wrap) { cthread->UnwrapCurrent(); EXPECT_FALSE(cthread->RunningForTest()); delete cthread; - current_thread->WrapCurrent(); } TEST(ThreadTest, Invoke) { |