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. |
97 template <class T> | 110 template <class T> |
98 class ScopedRefMessageData : public MessageData { | 111 class ScopedRefMessageData : public MessageData { |
99 public: | 112 public: |
100 explicit ScopedRefMessageData(T* data) : data_(data) { } | 113 explicit ScopedRefMessageData(T* data) : data_(data) { } |
101 const scoped_refptr<T>& data() const { return data_; } | 114 const scoped_refptr<T>& data() const { return data_; } |
102 scoped_refptr<T>& data() { return data_; } | 115 scoped_refptr<T>& data() { return data_; } |
103 private: | 116 private: |
104 scoped_refptr<T> data_; | 117 scoped_refptr<T> data_; |
105 }; | 118 }; |
106 | 119 |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 // Used if SocketServer ownership lies with |this|. | 305 // Used if SocketServer ownership lies with |this|. |
293 std::unique_ptr<SocketServer> own_ss_; | 306 std::unique_ptr<SocketServer> own_ss_; |
294 SharedExclusiveLock ss_lock_; | 307 SharedExclusiveLock ss_lock_; |
295 | 308 |
296 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(MessageQueue); | 309 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(MessageQueue); |
297 }; | 310 }; |
298 | 311 |
299 } // namespace rtc | 312 } // namespace rtc |
300 | 313 |
301 #endif // WEBRTC_BASE_MESSAGEQUEUE_H_ | 314 #endif // WEBRTC_BASE_MESSAGEQUEUE_H_ |
OLD | NEW |