OLD | NEW |
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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 template <class T> | 87 template <class T> |
88 class TypedMessageData : public MessageData { | 88 class TypedMessageData : public MessageData { |
89 public: | 89 public: |
90 explicit TypedMessageData(const T& data) : data_(data) { } | 90 explicit TypedMessageData(const T& data) : data_(data) { } |
91 const T& data() const { return data_; } | 91 const T& data() const { return data_; } |
92 T& data() { return data_; } | 92 T& data() { return data_; } |
93 private: | 93 private: |
94 T data_; | 94 T data_; |
95 }; | 95 }; |
96 | 96 |
97 // Like TypedMessageData, but for pointers that require a delete. | |
98 template <class T> | |
99 class ScopedMessageData : public MessageData { | |
100 public: | |
101 explicit ScopedMessageData(T* data) : data_(data) { } | |
102 const std::unique_ptr<T>& data() const { return data_; } | |
103 std::unique_ptr<T>& data() { return data_; } | |
104 | |
105 private: | |
106 std::unique_ptr<T> data_; | |
107 }; | |
108 | |
109 // Like ScopedMessageData, but for reference counted pointers. | |
110 template <class T> | 97 template <class T> |
111 class ScopedRefMessageData : public MessageData { | 98 class ScopedRefMessageData : public MessageData { |
112 public: | 99 public: |
113 explicit ScopedRefMessageData(T* data) : data_(data) { } | 100 explicit ScopedRefMessageData(T* data) : data_(data) { } |
114 const scoped_refptr<T>& data() const { return data_; } | 101 const scoped_refptr<T>& data() const { return data_; } |
115 scoped_refptr<T>& data() { return data_; } | 102 scoped_refptr<T>& data() { return data_; } |
116 private: | 103 private: |
117 scoped_refptr<T> data_; | 104 scoped_refptr<T> data_; |
118 }; | 105 }; |
119 | 106 |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 // Used if SocketServer ownership lies with |this|. | 292 // Used if SocketServer ownership lies with |this|. |
306 std::unique_ptr<SocketServer> own_ss_; | 293 std::unique_ptr<SocketServer> own_ss_; |
307 SharedExclusiveLock ss_lock_; | 294 SharedExclusiveLock ss_lock_; |
308 | 295 |
309 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(MessageQueue); | 296 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(MessageQueue); |
310 }; | 297 }; |
311 | 298 |
312 } // namespace rtc | 299 } // namespace rtc |
313 | 300 |
314 #endif // WEBRTC_BASE_MESSAGEQUEUE_H_ | 301 #endif // WEBRTC_BASE_MESSAGEQUEUE_H_ |
OLD | NEW |