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

Side by Side Diff: webrtc/base/thread.h

Issue 1666863002: Fix race between Thread ctor/dtor and MessageQueueManager registrations. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Added unittest. 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 unified diff | Download patch
OLDNEW
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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 290
291 private: 291 private:
292 RTC_DISALLOW_COPY_AND_ASSIGN(AutoThread); 292 RTC_DISALLOW_COPY_AND_ASSIGN(AutoThread);
293 }; 293 };
294 294
295 // Win32 extension for threads that need to use COM 295 // Win32 extension for threads that need to use COM
296 #if defined(WEBRTC_WIN) 296 #if defined(WEBRTC_WIN)
297 class ComThread : public Thread { 297 class ComThread : public Thread {
298 public: 298 public:
299 ComThread() {} 299 ComThread() {}
300 virtual ~ComThread() { Stop(); } 300 ~ComThread() override;
301 301
302 protected: 302 protected:
303 virtual void Run(); 303 virtual void Run();
304 304
305 private: 305 private:
306 RTC_DISALLOW_COPY_AND_ASSIGN(ComThread); 306 RTC_DISALLOW_COPY_AND_ASSIGN(ComThread);
307 }; 307 };
308 #endif 308 #endif
309 309
310 // Provides an easy way to install/uninstall a socketserver on a thread. 310 // Provides an easy way to install/uninstall a socketserver on a thread.
311 class SocketServerScope { 311 class SocketServerScope {
312 public: 312 public:
313 explicit SocketServerScope(SocketServer* ss) { 313 explicit SocketServerScope(SocketServer* ss) {
314 old_ss_ = Thread::Current()->socketserver(); 314 old_ss_ = Thread::Current()->socketserver();
315 Thread::Current()->set_socketserver(ss); 315 Thread::Current()->set_socketserver(ss);
316 } 316 }
317 ~SocketServerScope() { 317 ~SocketServerScope() {
318 Thread::Current()->set_socketserver(old_ss_); 318 Thread::Current()->set_socketserver(old_ss_);
319 } 319 }
320 320
321 private: 321 private:
322 SocketServer* old_ss_; 322 SocketServer* old_ss_;
323 323
324 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(SocketServerScope); 324 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(SocketServerScope);
325 }; 325 };
326 326
327 } // namespace rtc 327 } // namespace rtc
328 328
329 #endif // WEBRTC_BASE_THREAD_H_ 329 #endif // WEBRTC_BASE_THREAD_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698