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

Unified Diff: webrtc/base/messagequeue.h

Issue 2689233003: Relanding: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/base/asyncinvoker-inl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/messagequeue.h
diff --git a/webrtc/base/messagequeue.h b/webrtc/base/messagequeue.h
index 429a56a8c1e3cd69f6dcafa1b19fbc90dfa51f03..df50f54868a214913761493f15a69c504fc02ee8 100644
--- a/webrtc/base/messagequeue.h
+++ b/webrtc/base/messagequeue.h
@@ -17,6 +17,7 @@
#include <list>
#include <memory>
#include <queue>
+#include <utility>
#include <vector>
#include "webrtc/base/basictypes.h"
@@ -98,10 +99,21 @@ class TypedMessageData : public MessageData {
template <class T>
class ScopedMessageData : public MessageData {
public:
- explicit ScopedMessageData(T* data) : data_(data) { }
+ explicit ScopedMessageData(std::unique_ptr<T> data)
+ : data_(std::move(data)) {}
+ // Deprecated.
+ // TODO(deadbeef): Remove this once downstream applications stop using it.
+ explicit ScopedMessageData(T* data) : data_(data) {}
+ // Deprecated.
+ // TODO(deadbeef): Returning a reference to a unique ptr? Why. Get rid of
+ // this once downstream applications stop using it, then rename inner_data to
+ // just data.
const std::unique_ptr<T>& data() const { return data_; }
std::unique_ptr<T>& data() { return data_; }
+ const T& inner_data() const { return *data_; }
+ T& inner_data() { return *data_; }
+
private:
std::unique_ptr<T> data_;
};
« 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