OLD | NEW |
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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 class SynchronousMethodCall | 121 class SynchronousMethodCall |
122 : public rtc::MessageData, | 122 : public rtc::MessageData, |
123 public rtc::MessageHandler { | 123 public rtc::MessageHandler { |
124 public: | 124 public: |
125 explicit SynchronousMethodCall(rtc::MessageHandler* proxy) | 125 explicit SynchronousMethodCall(rtc::MessageHandler* proxy) |
126 : e_(), proxy_(proxy) {} | 126 : e_(), proxy_(proxy) {} |
127 ~SynchronousMethodCall() {} | 127 ~SynchronousMethodCall() {} |
128 | 128 |
129 void Invoke(const rtc::Location& posted_from, rtc::Thread* t) { | 129 void Invoke(const rtc::Location& posted_from, rtc::Thread* t) { |
130 if (t->IsCurrent()) { | 130 if (t->IsCurrent()) { |
131 proxy_->OnMessage(NULL); | 131 proxy_->OnMessage(nullptr); |
132 } else { | 132 } else { |
133 e_.reset(new rtc::Event(false, false)); | 133 e_.reset(new rtc::Event(false, false)); |
134 t->Post(posted_from, this, 0); | 134 t->Post(posted_from, this, 0); |
135 e_->Wait(rtc::Event::kForever); | 135 e_->Wait(rtc::Event::kForever); |
136 } | 136 } |
137 } | 137 } |
138 | 138 |
139 private: | 139 private: |
140 void OnMessage(rtc::Message*) { proxy_->OnMessage(NULL); e_->Set(); } | 140 void OnMessage(rtc::Message*) { |
| 141 proxy_->OnMessage(nullptr); |
| 142 e_->Set(); |
| 143 } |
141 std::unique_ptr<rtc::Event> e_; | 144 std::unique_ptr<rtc::Event> e_; |
142 rtc::MessageHandler* proxy_; | 145 rtc::MessageHandler* proxy_; |
143 }; | 146 }; |
144 | 147 |
145 } // namespace internal | 148 } // namespace internal |
146 | 149 |
147 template <typename C, typename R> | 150 template <typename C, typename R> |
148 class MethodCall0 : public rtc::Message, | 151 class MethodCall0 : public rtc::Message, |
149 public rtc::MessageHandler { | 152 public rtc::MessageHandler { |
150 public: | 153 public: |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 #define PROXY_WORKER_CONSTMETHOD3(r, method, t1, t2) \ | 573 #define PROXY_WORKER_CONSTMETHOD3(r, method, t1, t2) \ |
571 r method(t1 a1, t2 a2, t3 a3) const override { \ | 574 r method(t1 a1, t2 a2, t3 a3) const override { \ |
572 ConstMethodCall3<C, r, t1, t2, t3> call(c_, &C::method, std::move(a1), \ | 575 ConstMethodCall3<C, r, t1, t2, t3> call(c_, &C::method, std::move(a1), \ |
573 std::move(a2), std::move(a3)); \ | 576 std::move(a2), std::move(a3)); \ |
574 return call.Marshal(RTC_FROM_HERE, worker_thread_); \ | 577 return call.Marshal(RTC_FROM_HERE, worker_thread_); \ |
575 } | 578 } |
576 | 579 |
577 } // namespace webrtc | 580 } // namespace webrtc |
578 | 581 |
579 #endif // WEBRTC_API_PROXY_H_ | 582 #endif // WEBRTC_API_PROXY_H_ |
OLD | NEW |