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

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

Issue 2703613006: Revert of Use std::unique_ptr instead of rtc::scoped_refptr in AsyncInvoker. (Closed)
Patch Set: Created 3 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
« no previous file with comments | « webrtc/base/asyncinvoker-inl.h ('k') | no next file » | 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_MESSAGEQUEUE_H_ 11 #ifndef WEBRTC_BASE_MESSAGEQUEUE_H_
12 #define WEBRTC_BASE_MESSAGEQUEUE_H_ 12 #define WEBRTC_BASE_MESSAGEQUEUE_H_
13 13
14 #include <string.h> 14 #include <string.h>
15 15
16 #include <algorithm> 16 #include <algorithm>
17 #include <list> 17 #include <list>
18 #include <memory> 18 #include <memory>
19 #include <queue> 19 #include <queue>
20 #include <utility>
21 #include <vector> 20 #include <vector>
22 21
23 #include "webrtc/base/basictypes.h" 22 #include "webrtc/base/basictypes.h"
24 #include "webrtc/base/constructormagic.h" 23 #include "webrtc/base/constructormagic.h"
25 #include "webrtc/base/criticalsection.h" 24 #include "webrtc/base/criticalsection.h"
26 #include "webrtc/base/location.h" 25 #include "webrtc/base/location.h"
27 #include "webrtc/base/messagehandler.h" 26 #include "webrtc/base/messagehandler.h"
28 #include "webrtc/base/scoped_ref_ptr.h" 27 #include "webrtc/base/scoped_ref_ptr.h"
29 #include "webrtc/base/sharedexclusivelock.h" 28 #include "webrtc/base/sharedexclusivelock.h"
30 #include "webrtc/base/sigslot.h" 29 #include "webrtc/base/sigslot.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 const T& data() const { return data_; } 91 const T& data() const { return data_; }
93 T& data() { return data_; } 92 T& data() { return data_; }
94 private: 93 private:
95 T data_; 94 T data_;
96 }; 95 };
97 96
98 // Like TypedMessageData, but for pointers that require a delete. 97 // Like TypedMessageData, but for pointers that require a delete.
99 template <class T> 98 template <class T>
100 class ScopedMessageData : public MessageData { 99 class ScopedMessageData : public MessageData {
101 public: 100 public:
102 explicit ScopedMessageData(std::unique_ptr<T> data) 101 explicit ScopedMessageData(T* data) : data_(data) { }
103 : data_(std::move(data)) {} 102 const std::unique_ptr<T>& data() const { return data_; }
104 const T& data() const { return *data_; } 103 std::unique_ptr<T>& data() { return data_; }
105 T& data() { return *data_; }
106 104
107 private: 105 private:
108 std::unique_ptr<T> data_; 106 std::unique_ptr<T> data_;
109 }; 107 };
110 108
111 // Like ScopedMessageData, but for reference counted pointers. 109 // Like ScopedMessageData, but for reference counted pointers.
112 template <class T> 110 template <class T>
113 class ScopedRefMessageData : public MessageData { 111 class ScopedRefMessageData : public MessageData {
114 public: 112 public:
115 explicit ScopedRefMessageData(T* data) : data_(data) { } 113 explicit ScopedRefMessageData(T* data) : data_(data) { }
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 // Used if SocketServer ownership lies with |this|. 309 // Used if SocketServer ownership lies with |this|.
312 std::unique_ptr<SocketServer> own_ss_; 310 std::unique_ptr<SocketServer> own_ss_;
313 SharedExclusiveLock ss_lock_; 311 SharedExclusiveLock ss_lock_;
314 312
315 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(MessageQueue); 313 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(MessageQueue);
316 }; 314 };
317 315
318 } // namespace rtc 316 } // namespace rtc
319 317
320 #endif // WEBRTC_BASE_MESSAGEQUEUE_H_ 318 #endif // WEBRTC_BASE_MESSAGEQUEUE_H_
OLDNEW
« no previous file with comments | « webrtc/base/asyncinvoker-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698