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

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

Issue 1920043002: Replace scoped_ptr with unique_ptr in webrtc/base/ (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fixes for compile errors. Created 4 years, 8 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
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 <queue> 19 #include <queue>
19 #include <vector> 20 #include <vector>
20 21
21 #include "webrtc/base/basictypes.h" 22 #include "webrtc/base/basictypes.h"
22 #include "webrtc/base/constructormagic.h" 23 #include "webrtc/base/constructormagic.h"
23 #include "webrtc/base/criticalsection.h" 24 #include "webrtc/base/criticalsection.h"
24 #include "webrtc/base/messagehandler.h" 25 #include "webrtc/base/messagehandler.h"
25 #include "webrtc/base/scoped_ptr.h"
26 #include "webrtc/base/scoped_ref_ptr.h" 26 #include "webrtc/base/scoped_ref_ptr.h"
27 #include "webrtc/base/sharedexclusivelock.h" 27 #include "webrtc/base/sharedexclusivelock.h"
28 #include "webrtc/base/sigslot.h" 28 #include "webrtc/base/sigslot.h"
29 #include "webrtc/base/socketserver.h" 29 #include "webrtc/base/socketserver.h"
30 #include "webrtc/base/timeutils.h" 30 #include "webrtc/base/timeutils.h"
31 #include "webrtc/base/thread_annotations.h" 31 #include "webrtc/base/thread_annotations.h"
32 32
33 namespace rtc { 33 namespace rtc {
34 34
35 struct Message; 35 struct Message;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 T& data() { return data_; } 82 T& data() { return data_; }
83 private: 83 private:
84 T data_; 84 T data_;
85 }; 85 };
86 86
87 // Like TypedMessageData, but for pointers that require a delete. 87 // Like TypedMessageData, but for pointers that require a delete.
88 template <class T> 88 template <class T>
89 class ScopedMessageData : public MessageData { 89 class ScopedMessageData : public MessageData {
90 public: 90 public:
91 explicit ScopedMessageData(T* data) : data_(data) { } 91 explicit ScopedMessageData(T* data) : data_(data) { }
92 const scoped_ptr<T>& data() const { return data_; } 92 const std::unique_ptr<T>& data() const { return data_; }
93 scoped_ptr<T>& data() { return data_; } 93 std::unique_ptr<T>& data() { return data_; }
94 private: 94 private:
95 scoped_ptr<T> data_; 95 std::unique_ptr<T> data_;
96 }; 96 };
97 97
98 // Like ScopedMessageData, but for reference counted pointers. 98 // Like ScopedMessageData, but for reference counted pointers.
99 template <class T> 99 template <class T>
100 class ScopedRefMessageData : public MessageData { 100 class ScopedRefMessageData : public MessageData {
101 public: 101 public:
102 explicit ScopedRefMessageData(T* data) : data_(data) { } 102 explicit ScopedRefMessageData(T* data) : data_(data) { }
103 const scoped_refptr<T>& data() const { return data_; } 103 const scoped_refptr<T>& data() const { return data_; }
104 scoped_refptr<T>& data() { return data_; } 104 scoped_refptr<T>& data() { return data_; }
105 private: 105 private:
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 PriorityQueue dmsgq_ GUARDED_BY(crit_); 271 PriorityQueue dmsgq_ GUARDED_BY(crit_);
272 uint32_t dmsgq_next_num_ GUARDED_BY(crit_); 272 uint32_t dmsgq_next_num_ GUARDED_BY(crit_);
273 CriticalSection crit_; 273 CriticalSection crit_;
274 bool fInitialized_; 274 bool fInitialized_;
275 bool fDestroyed_; 275 bool fDestroyed_;
276 276
277 private: 277 private:
278 // The SocketServer is not owned by MessageQueue. 278 // The SocketServer is not owned by MessageQueue.
279 SocketServer* ss_ GUARDED_BY(ss_lock_); 279 SocketServer* ss_ GUARDED_BY(ss_lock_);
280 // If a server isn't supplied in the constructor, use this one. 280 // If a server isn't supplied in the constructor, use this one.
281 scoped_ptr<SocketServer> default_ss_; 281 std::unique_ptr<SocketServer> default_ss_;
282 SharedExclusiveLock ss_lock_; 282 SharedExclusiveLock ss_lock_;
283 283
284 RTC_DISALLOW_COPY_AND_ASSIGN(MessageQueue); 284 RTC_DISALLOW_COPY_AND_ASSIGN(MessageQueue);
285 }; 285 };
286 286
287 } // namespace rtc 287 } // namespace rtc
288 288
289 #endif // WEBRTC_BASE_MESSAGEQUEUE_H_ 289 #endif // WEBRTC_BASE_MESSAGEQUEUE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698