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

Side by Side Diff: webrtc/api/proxy.h

Issue 1930463002: Replace scoped_ptr with unique_ptr in webrtc/api/ (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 7 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/api/peerconnectioninterface_unittest.cc ('k') | webrtc/api/proxy_unittest.cc » ('j') | 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 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2013 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 29 matching lines...) Expand all
40 // 40 //
41 // TestProxy::Create(Thread* signaling_thread, Thread* worker_thread, 41 // TestProxy::Create(Thread* signaling_thread, Thread* worker_thread,
42 // TestInterface*). 42 // TestInterface*).
43 // 43 //
44 // The variant defined with BEGIN_SIGNALING_PROXY_MAP is unaware of 44 // The variant defined with BEGIN_SIGNALING_PROXY_MAP is unaware of
45 // the worker thread, and invokes all methods on the signaling thread. 45 // the worker thread, and invokes all methods on the signaling thread.
46 46
47 #ifndef WEBRTC_API_PROXY_H_ 47 #ifndef WEBRTC_API_PROXY_H_
48 #define WEBRTC_API_PROXY_H_ 48 #define WEBRTC_API_PROXY_H_
49 49
50 #include <memory>
51
50 #include "webrtc/base/event.h" 52 #include "webrtc/base/event.h"
51 #include "webrtc/base/thread.h" 53 #include "webrtc/base/thread.h"
52 54
53 namespace webrtc { 55 namespace webrtc {
54 56
55 template <typename R> 57 template <typename R>
56 class ReturnType { 58 class ReturnType {
57 public: 59 public:
58 template<typename C, typename M> 60 template<typename C, typename M>
59 void Invoke(C* c, M m) { r_ = (c->*m)(); } 61 void Invoke(C* c, M m) { r_ = (c->*m)(); }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 proxy_->OnMessage(NULL); 112 proxy_->OnMessage(NULL);
111 } else { 113 } else {
112 e_.reset(new rtc::Event(false, false)); 114 e_.reset(new rtc::Event(false, false));
113 t->Post(this, 0); 115 t->Post(this, 0);
114 e_->Wait(rtc::Event::kForever); 116 e_->Wait(rtc::Event::kForever);
115 } 117 }
116 } 118 }
117 119
118 private: 120 private:
119 void OnMessage(rtc::Message*) { proxy_->OnMessage(NULL); e_->Set(); } 121 void OnMessage(rtc::Message*) { proxy_->OnMessage(NULL); e_->Set(); }
120 rtc::scoped_ptr<rtc::Event> e_; 122 std::unique_ptr<rtc::Event> e_;
121 rtc::MessageHandler* proxy_; 123 rtc::MessageHandler* proxy_;
122 }; 124 };
123 125
124 } // namespace internal 126 } // namespace internal
125 127
126 template <typename C, typename R> 128 template <typename C, typename R>
127 class MethodCall0 : public rtc::Message, 129 class MethodCall0 : public rtc::Message,
128 public rtc::MessageHandler { 130 public rtc::MessageHandler {
129 public: 131 public:
130 typedef R (C::*Method)(); 132 typedef R (C::*Method)();
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 c_ = NULL; \ 422 c_ = NULL; \
421 } \ 423 } \
422 mutable rtc::Thread* signaling_thread_; \ 424 mutable rtc::Thread* signaling_thread_; \
423 mutable rtc::Thread* worker_thread_; \ 425 mutable rtc::Thread* worker_thread_; \
424 rtc::scoped_refptr<C> c_; \ 426 rtc::scoped_refptr<C> c_; \
425 }; \ 427 }; \
426 428
427 } // namespace webrtc 429 } // namespace webrtc
428 430
429 #endif // WEBRTC_API_PROXY_H_ 431 #endif // WEBRTC_API_PROXY_H_
OLDNEW
« no previous file with comments | « webrtc/api/peerconnectioninterface_unittest.cc ('k') | webrtc/api/proxy_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698