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

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

Issue 1766653002: Replace SetCapturer and SetCaptureDevice by SetSource. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase. 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 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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 T2 a2_; 292 T2 a2_;
293 T3 a3_; 293 T3 a3_;
294 T4 a4_; 294 T4 a4_;
295 T5 a5_; 295 T5 a5_;
296 }; 296 };
297 297
298 #define BEGIN_PROXY_MAP(c) \ 298 #define BEGIN_PROXY_MAP(c) \
299 class c##Proxy : public c##Interface { \ 299 class c##Proxy : public c##Interface { \
300 protected: \ 300 protected: \
301 typedef c##Interface C; \ 301 typedef c##Interface C; \
302 c##Proxy(rtc::Thread* thread, C* c) : owner_thread_(thread), c_(c) {} \ 302 c##Proxy(rtc::Thread* signal_thread, rtc::Thread* worker_thread, C* c) \
303 : signal_thread_(signal_thread), worker_thread_(worker_thread), c_(c) {} \
303 ~c##Proxy() { \ 304 ~c##Proxy() { \
304 MethodCall0<c##Proxy, void> call(this, &c##Proxy::Release_s); \ 305 MethodCall0<c##Proxy, void> call(this, &c##Proxy::Release_s); \
305 call.Marshal(owner_thread_); \ 306 call.Marshal(signal_thread_); \
306 } \ 307 } \
307 \ 308 \
308 public: \ 309 public: \
309 static rtc::scoped_refptr<C> Create(rtc::Thread* thread, C* c) { \ 310 /* Worker thread must be provided if any worker methods are defined. */ \
310 return new rtc::RefCountedObject<c##Proxy>(thread, c); \ 311 static rtc::scoped_refptr<C> Create( \
312 rtc::Thread* signal_thread, rtc::Thread* worker_thread, C* c) { \
313 return new rtc::RefCountedObject<c##Proxy>( \
314 signal_thread, worker_thread, c); \
311 } 315 }
312 316
313 #define PROXY_METHOD0(r, method) \ 317 #define PROXY_METHOD0(r, method) \
314 r method() override { \ 318 r method() override { \
315 MethodCall0<C, r> call(c_.get(), &C::method); \ 319 MethodCall0<C, r> call(c_.get(), &C::method); \
316 return call.Marshal(owner_thread_); \ 320 return call.Marshal(signal_thread_); \
317 } 321 }
318 322
319 #define PROXY_CONSTMETHOD0(r, method) \ 323 #define PROXY_CONSTMETHOD0(r, method) \
320 r method() const override { \ 324 r method() const override { \
321 ConstMethodCall0<C, r> call(c_.get(), &C::method); \ 325 ConstMethodCall0<C, r> call(c_.get(), &C::method); \
322 return call.Marshal(owner_thread_); \ 326 return call.Marshal(signal_thread_); \
323 } 327 }
324 328
325 #define PROXY_METHOD1(r, method, t1) \ 329 #define PROXY_METHOD1(r, method, t1) \
326 r method(t1 a1) override { \ 330 r method(t1 a1) override { \
327 MethodCall1<C, r, t1> call(c_.get(), &C::method, a1); \ 331 MethodCall1<C, r, t1> call(c_.get(), &C::method, a1); \
328 return call.Marshal(owner_thread_); \ 332 return call.Marshal(signal_thread_); \
329 } 333 }
330 334
331 #define PROXY_CONSTMETHOD1(r, method, t1) \ 335 #define PROXY_CONSTMETHOD1(r, method, t1) \
332 r method(t1 a1) const override { \ 336 r method(t1 a1) const override { \
333 ConstMethodCall1<C, r, t1> call(c_.get(), &C::method, a1); \ 337 ConstMethodCall1<C, r, t1> call(c_.get(), &C::method, a1); \
334 return call.Marshal(owner_thread_); \ 338 return call.Marshal(signal_thread_); \
335 } 339 }
336 340
337 #define PROXY_METHOD2(r, method, t1, t2) \ 341 #define PROXY_METHOD2(r, method, t1, t2) \
338 r method(t1 a1, t2 a2) override { \ 342 r method(t1 a1, t2 a2) override { \
339 MethodCall2<C, r, t1, t2> call(c_.get(), &C::method, a1, a2); \ 343 MethodCall2<C, r, t1, t2> call(c_.get(), &C::method, a1, a2); \
340 return call.Marshal(owner_thread_); \ 344 return call.Marshal(signal_thread_); \
341 } 345 }
342 346
343 #define PROXY_METHOD3(r, method, t1, t2, t3) \ 347 #define PROXY_METHOD3(r, method, t1, t2, t3) \
344 r method(t1 a1, t2 a2, t3 a3) override { \ 348 r method(t1 a1, t2 a2, t3 a3) override { \
345 MethodCall3<C, r, t1, t2, t3> call(c_.get(), &C::method, a1, a2, a3); \ 349 MethodCall3<C, r, t1, t2, t3> call(c_.get(), &C::method, a1, a2, a3); \
346 return call.Marshal(owner_thread_); \ 350 return call.Marshal(signal_thread_); \
347 } 351 }
348 352
349 #define PROXY_METHOD4(r, method, t1, t2, t3, t4) \ 353 #define PROXY_METHOD4(r, method, t1, t2, t3, t4) \
350 r method(t1 a1, t2 a2, t3 a3, t4 a4) override { \ 354 r method(t1 a1, t2 a2, t3 a3, t4 a4) override { \
351 MethodCall4<C, r, t1, t2, t3, t4> call(c_.get(), &C::method, a1, a2, a3, \ 355 MethodCall4<C, r, t1, t2, t3, t4> call(c_.get(), &C::method, a1, a2, a3, \
352 a4); \ 356 a4); \
353 return call.Marshal(owner_thread_); \ 357 return call.Marshal(signal_thread_); \
354 } 358 }
355 359
356 #define PROXY_METHOD5(r, method, t1, t2, t3, t4, t5) \ 360 #define PROXY_METHOD5(r, method, t1, t2, t3, t4, t5) \
357 r method(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5) override { \ 361 r method(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5) override { \
358 MethodCall5<C, r, t1, t2, t3, t4, t5> call(c_.get(), &C::method, a1, a2, \ 362 MethodCall5<C, r, t1, t2, t3, t4, t5> call(c_.get(), &C::method, a1, a2, \
359 a3, a4, a5); \ 363 a3, a4, a5); \
360 return call.Marshal(owner_thread_); \ 364 return call.Marshal(signal_thread_); \
365 }
366
367 // Define methods which should be invoked on the worker thread.
368 #define PROXY_WORKER_METHOD1(r, method, t1) \
369 r method(t1 a1) override { \
370 MethodCall1<C, r, t1> call(c_.get(), &C::method, a1); \
371 return call.Marshal(worker_thread_); \
372 }
373
374 #define PROXY_WORKER_METHOD2(r, method, t1, t2) \
375 r method(t1 a1, t2 a2) override { \
376 MethodCall2<C, r, t1, t2> call(c_.get(), &C::method, a1, a2); \
377 return call.Marshal(worker_thread_); \
361 } 378 }
362 379
363 #define END_PROXY() \ 380 #define END_PROXY() \
364 private:\ 381 private:\
365 void Release_s() {\ 382 void Release_s() {\
366 c_ = NULL;\ 383 c_ = NULL;\
384 /* TODO(nisse): Temporary hack to silence unusedness warnings */ \
385 (void) worker_thread_; \
367 }\ 386 }\
368 mutable rtc::Thread* owner_thread_;\ 387 mutable rtc::Thread* signal_thread_;\
388 mutable rtc::Thread* worker_thread_;\
369 rtc::scoped_refptr<C> c_;\ 389 rtc::scoped_refptr<C> c_;\
370 };\ 390 };\
371 391
372 } // namespace webrtc 392 } // namespace webrtc
373 393
374 #endif // WEBRTC_API_PROXY_H_ 394 #endif // WEBRTC_API_PROXY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698