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

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

Issue 1967193002: ThreadScope concept to check variable accessed on correct thread (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: generalized ThreadScope Created 4 years, 7 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 | « no previous file | webrtc/base/thread_checker.h » ('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 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
11 #ifndef WEBRTC_BASE_THREAD_H_ 11 #ifndef WEBRTC_BASE_THREAD_H_
12 #define WEBRTC_BASE_THREAD_H_ 12 #define WEBRTC_BASE_THREAD_H_
13 13
14 #include <algorithm> 14 #include <algorithm>
15 #include <list> 15 #include <list>
16 #include <memory> 16 #include <memory>
17 #include <string> 17 #include <string>
18 #include <vector> 18 #include <vector>
19 19
20 #if defined(WEBRTC_POSIX) 20 #if defined(WEBRTC_POSIX)
21 #include <pthread.h> 21 #include <pthread.h>
22 #endif 22 #endif
23 #include "webrtc/base/checks.h"
23 #include "webrtc/base/constructormagic.h" 24 #include "webrtc/base/constructormagic.h"
24 #include "webrtc/base/event.h" 25 #include "webrtc/base/event.h"
25 #include "webrtc/base/messagequeue.h" 26 #include "webrtc/base/messagequeue.h"
26 27
27 #if defined(WEBRTC_WIN) 28 #if defined(WEBRTC_WIN)
28 #include "webrtc/base/win32.h" 29 #include "webrtc/base/win32.h"
29 #endif 30 #endif
30 31
31 namespace rtc { 32 namespace rtc {
32 33
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 87
87 protected: 88 protected:
88 Runnable() {} 89 Runnable() {}
89 90
90 private: 91 private:
91 RTC_DISALLOW_COPY_AND_ASSIGN(Runnable); 92 RTC_DISALLOW_COPY_AND_ASSIGN(Runnable);
92 }; 93 };
93 94
94 // WARNING! SUBCLASSES MUST CALL Stop() IN THEIR DESTRUCTORS! See ~Thread(). 95 // WARNING! SUBCLASSES MUST CALL Stop() IN THEIR DESTRUCTORS! See ~Thread().
95 96
96 class Thread : public MessageQueue { 97 class LOCKABLE Thread : public MessageQueue {
97 public: 98 public:
98 // Create a new Thread and optionally assign it to the passed SocketServer. 99 // Create a new Thread and optionally assign it to the passed SocketServer.
99 Thread(); 100 Thread();
100 explicit Thread(SocketServer* ss); 101 explicit Thread(SocketServer* ss);
101 explicit Thread(std::unique_ptr<SocketServer> ss); 102 explicit Thread(std::unique_ptr<SocketServer> ss);
102 103
103 // NOTE: ALL SUBCLASSES OF Thread MUST CALL Stop() IN THEIR DESTRUCTORS (or 104 // NOTE: ALL SUBCLASSES OF Thread MUST CALL Stop() IN THEIR DESTRUCTORS (or
104 // guarantee Stop() is explicitly called before the subclass is destroyed). 105 // guarantee Stop() is explicitly called before the subclass is destroyed).
105 // This is required to avoid a data race between the destructor modifying the 106 // This is required to avoid a data race between the destructor modifying the
106 // vtable, and the Thread::PreRun calling the virtual method Run(). 107 // vtable, and the Thread::PreRun calling the virtual method Run().
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 328
328 private: 329 private:
329 SocketServer* old_ss_; 330 SocketServer* old_ss_;
330 331
331 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(SocketServerScope); 332 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(SocketServerScope);
332 }; 333 };
333 334
334 } // namespace rtc 335 } // namespace rtc
335 336
336 #endif // WEBRTC_BASE_THREAD_H_ 337 #endif // WEBRTC_BASE_THREAD_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/base/thread_checker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698