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

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

Issue 2023373002: Separating internal and external methods of RtpSender/RtpReceiver. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Renaming "ProxyTo<X>" to "ProxyWithInternal<X>" Created 4 years, 6 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 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 C* c_; 299 C* c_;
300 Method m_; 300 Method m_;
301 ReturnType<R> r_; 301 ReturnType<R> r_;
302 T1 a1_; 302 T1 a1_;
303 T2 a2_; 303 T2 a2_;
304 T3 a3_; 304 T3 a3_;
305 T4 a4_; 305 T4 a4_;
306 T5 a5_; 306 T5 a5_;
307 }; 307 };
308 308
309 #define BEGIN_SIGNALING_PROXY_MAP(c) \ 309 #define BEGIN_SIGNALING_PROXY_MAP(c) \
310 class c##Proxy : public c##Interface { \ 310 template <class INTERNAL_CLASS> \
311 protected: \ 311 class c##ProxyWithInternal; \
312 typedef c##Interface C; \ 312 typedef c##ProxyWithInternal<c##Interface> c##Proxy; \
313 c##Proxy(rtc::Thread* signaling_thread, C* c) \ 313 template <class INTERNAL_CLASS> \
314 : signaling_thread_(signaling_thread), c_(c) {} \ 314 class c##ProxyWithInternal : public c##Interface { \
315 ~c##Proxy() { \ 315 protected: \
316 MethodCall0<c##Proxy, void> call( \ 316 typedef c##Interface C; \
317 this, &c##Proxy::Release_s); \ 317 c##ProxyWithInternal(rtc::Thread* signaling_thread, INTERNAL_CLASS* c) \
318 call.Marshal(signaling_thread_); \ 318 : signaling_thread_(signaling_thread), c_(c) {} \
319 } \ 319 ~c##ProxyWithInternal() { \
320 \ 320 MethodCall0<c##ProxyWithInternal, void> call( \
321 public: \ 321 this, &c##ProxyWithInternal::Release_s); \
322 static rtc::scoped_refptr<C> Create(rtc::Thread* signaling_thread, C* c) { \ 322 call.Marshal(signaling_thread_); \
323 return new rtc::RefCountedObject<c##Proxy>( \ 323 } \
324 signaling_thread, c); \ 324 \
325 } 325 public: \
326 static rtc::scoped_refptr<c##ProxyWithInternal> Create( \
327 rtc::Thread* signaling_thread, \
328 INTERNAL_CLASS* c) { \
329 return new rtc::RefCountedObject<c##ProxyWithInternal>(signaling_thread, \
330 c); \
331 } \
332 const INTERNAL_CLASS* internal() const { return c_.get(); } \
333 INTERNAL_CLASS* internal() { return c_.get(); }
326 334
327 #define BEGIN_PROXY_MAP(c) \ 335 #define BEGIN_PROXY_MAP(c) \
328 class c##Proxy : public c##Interface { \ 336 template <class INTERNAL_CLASS> \
329 protected: \ 337 class c##ProxyWithInternal; \
330 typedef c##Interface C; \ 338 typedef c##ProxyWithInternal<c##Interface> c##Proxy; \
331 c##Proxy(rtc::Thread* signaling_thread, rtc::Thread* worker_thread, C* c) \ 339 template <class INTERNAL_CLASS> \
332 : signaling_thread_(signaling_thread), \ 340 class c##ProxyWithInternal : public c##Interface { \
333 worker_thread_(worker_thread), \ 341 protected: \
334 c_(c) {} \ 342 typedef c##Interface C; \
335 ~c##Proxy() { \ 343 c##ProxyWithInternal(rtc::Thread* signaling_thread, \
336 MethodCall0<c##Proxy, void> call(this, &c##Proxy::Release_s); \ 344 rtc::Thread* worker_thread, \
337 call.Marshal(signaling_thread_); \ 345 INTERNAL_CLASS* c) \
338 } \ 346 : signaling_thread_(signaling_thread), \
339 \ 347 worker_thread_(worker_thread), \
340 public: \ 348 c_(c) {} \
341 static rtc::scoped_refptr<C> Create( \ 349 ~c##ProxyWithInternal() { \
342 rtc::Thread* signaling_thread, rtc::Thread* worker_thread, C* c) { \ 350 MethodCall0<c##ProxyWithInternal, void> call( \
343 return new rtc::RefCountedObject<c##Proxy>( \ 351 this, &c##ProxyWithInternal::Release_s); \
344 signaling_thread, worker_thread, c); \ 352 call.Marshal(signaling_thread_); \
345 } 353 } \
354 \
355 public: \
356 static rtc::scoped_refptr<c##ProxyWithInternal> Create( \
357 rtc::Thread* signaling_thread, \
358 rtc::Thread* worker_thread, \
359 INTERNAL_CLASS* c) { \
360 return new rtc::RefCountedObject<c##ProxyWithInternal>( \
361 signaling_thread, worker_thread, c); \
362 } \
363 const INTERNAL_CLASS* internal() const { return c_.get(); } \
364 INTERNAL_CLASS* internal() { return c_.get(); }
346 365
347 #define PROXY_METHOD0(r, method) \ 366 #define PROXY_METHOD0(r, method) \
348 r method() override { \ 367 r method() override { \
349 MethodCall0<C, r> call(c_.get(), &C::method); \ 368 MethodCall0<C, r> call(c_.get(), &C::method); \
350 return call.Marshal(signaling_thread_); \ 369 return call.Marshal(signaling_thread_); \
351 } 370 }
352 371
353 #define PROXY_CONSTMETHOD0(r, method) \ 372 #define PROXY_CONSTMETHOD0(r, method) \
354 r method() const override { \ 373 r method() const override { \
355 ConstMethodCall0<C, r> call(c_.get(), &C::method); \ 374 ConstMethodCall0<C, r> call(c_.get(), &C::method); \
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 MethodCall1<C, r, t1> call(c_.get(), &C::method, a1); \ 419 MethodCall1<C, r, t1> call(c_.get(), &C::method, a1); \
401 return call.Marshal(worker_thread_); \ 420 return call.Marshal(worker_thread_); \
402 } 421 }
403 422
404 #define PROXY_WORKER_METHOD2(r, method, t1, t2) \ 423 #define PROXY_WORKER_METHOD2(r, method, t1, t2) \
405 r method(t1 a1, t2 a2) override { \ 424 r method(t1 a1, t2 a2) override { \
406 MethodCall2<C, r, t1, t2> call(c_.get(), &C::method, a1, a2); \ 425 MethodCall2<C, r, t1, t2> call(c_.get(), &C::method, a1, a2); \
407 return call.Marshal(worker_thread_); \ 426 return call.Marshal(worker_thread_); \
408 } 427 }
409 428
410 #define END_SIGNALING_PROXY() \ 429 #define END_SIGNALING_PROXY() \
411 private:\ 430 private: \
412 void Release_s() {\ 431 void Release_s() { c_ = NULL; } \
413 c_ = NULL;\ 432 mutable rtc::Thread* signaling_thread_; \
414 }\ 433 rtc::scoped_refptr<INTERNAL_CLASS> c_; \
415 mutable rtc::Thread* signaling_thread_;\ 434 } \
416 rtc::scoped_refptr<C> c_;\ 435 ;
417 };
418 436
419 #define END_PROXY() \ 437 #define END_PROXY() \
420 private: \ 438 private: \
421 void Release_s() { \ 439 void Release_s() { c_ = NULL; } \
422 c_ = NULL; \ 440 mutable rtc::Thread* signaling_thread_; \
423 } \ 441 mutable rtc::Thread* worker_thread_; \
424 mutable rtc::Thread* signaling_thread_; \ 442 rtc::scoped_refptr<INTERNAL_CLASS> c_; \
425 mutable rtc::Thread* worker_thread_; \ 443 } \
426 rtc::scoped_refptr<C> c_; \ 444 ;
427 }; \
428 445
429 } // namespace webrtc 446 } // namespace webrtc
430 447
431 #endif // WEBRTC_API_PROXY_H_ 448 #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