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

Unified Diff: webrtc/base/callback.h

Issue 2877023002: Move webrtc/{base => rtc_base} (Closed)
Patch Set: update presubmit.py and DEPS include rules Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/base/byteorder_unittest.cc ('k') | webrtc/base/callback.h.pump » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/callback.h
diff --git a/webrtc/base/callback.h b/webrtc/base/callback.h
index 7ffdcd73735b98c94b678bad227c7691d504b499..4da1e6dfab7e3da099ef6cdd048773b1836099c2 100644
--- a/webrtc/base/callback.h
+++ b/webrtc/base/callback.h
@@ -62,199 +62,9 @@
#ifndef WEBRTC_BASE_CALLBACK_H_
#define WEBRTC_BASE_CALLBACK_H_
-#include "webrtc/base/refcount.h"
-#include "webrtc/base/scoped_ref_ptr.h"
-namespace rtc {
-
-template <class R>
-class Callback0 {
- public:
- // Default copy operations are appropriate for this class.
- Callback0() {}
- template <class T> Callback0(const T& functor)
- : helper_(new RefCountedObject< HelperImpl<T> >(functor)) {}
- R operator()() {
- if (empty())
- return R();
- return helper_->Run();
- }
- bool empty() const { return !helper_; }
-
- private:
- struct Helper : RefCountInterface {
- virtual ~Helper() {}
- virtual R Run() = 0;
- };
- template <class T> struct HelperImpl : Helper {
- explicit HelperImpl(const T& functor) : functor_(functor) {}
- virtual R Run() {
- return functor_();
- }
- T functor_;
- };
- scoped_refptr<Helper> helper_;
-};
-
-template <class R,
- class P1>
-class Callback1 {
- public:
- // Default copy operations are appropriate for this class.
- Callback1() {}
- template <class T> Callback1(const T& functor)
- : helper_(new RefCountedObject< HelperImpl<T> >(functor)) {}
- R operator()(P1 p1) {
- if (empty())
- return R();
- return helper_->Run(p1);
- }
- bool empty() const { return !helper_; }
-
- private:
- struct Helper : RefCountInterface {
- virtual ~Helper() {}
- virtual R Run(P1 p1) = 0;
- };
- template <class T> struct HelperImpl : Helper {
- explicit HelperImpl(const T& functor) : functor_(functor) {}
- virtual R Run(P1 p1) {
- return functor_(p1);
- }
- T functor_;
- };
- scoped_refptr<Helper> helper_;
-};
-
-template <class R,
- class P1,
- class P2>
-class Callback2 {
- public:
- // Default copy operations are appropriate for this class.
- Callback2() {}
- template <class T> Callback2(const T& functor)
- : helper_(new RefCountedObject< HelperImpl<T> >(functor)) {}
- R operator()(P1 p1, P2 p2) {
- if (empty())
- return R();
- return helper_->Run(p1, p2);
- }
- bool empty() const { return !helper_; }
-
- private:
- struct Helper : RefCountInterface {
- virtual ~Helper() {}
- virtual R Run(P1 p1, P2 p2) = 0;
- };
- template <class T> struct HelperImpl : Helper {
- explicit HelperImpl(const T& functor) : functor_(functor) {}
- virtual R Run(P1 p1, P2 p2) {
- return functor_(p1, p2);
- }
- T functor_;
- };
- scoped_refptr<Helper> helper_;
-};
-
-template <class R,
- class P1,
- class P2,
- class P3>
-class Callback3 {
- public:
- // Default copy operations are appropriate for this class.
- Callback3() {}
- template <class T> Callback3(const T& functor)
- : helper_(new RefCountedObject< HelperImpl<T> >(functor)) {}
- R operator()(P1 p1, P2 p2, P3 p3) {
- if (empty())
- return R();
- return helper_->Run(p1, p2, p3);
- }
- bool empty() const { return !helper_; }
-
- private:
- struct Helper : RefCountInterface {
- virtual ~Helper() {}
- virtual R Run(P1 p1, P2 p2, P3 p3) = 0;
- };
- template <class T> struct HelperImpl : Helper {
- explicit HelperImpl(const T& functor) : functor_(functor) {}
- virtual R Run(P1 p1, P2 p2, P3 p3) {
- return functor_(p1, p2, p3);
- }
- T functor_;
- };
- scoped_refptr<Helper> helper_;
-};
-
-template <class R,
- class P1,
- class P2,
- class P3,
- class P4>
-class Callback4 {
- public:
- // Default copy operations are appropriate for this class.
- Callback4() {}
- template <class T> Callback4(const T& functor)
- : helper_(new RefCountedObject< HelperImpl<T> >(functor)) {}
- R operator()(P1 p1, P2 p2, P3 p3, P4 p4) {
- if (empty())
- return R();
- return helper_->Run(p1, p2, p3, p4);
- }
- bool empty() const { return !helper_; }
-
- private:
- struct Helper : RefCountInterface {
- virtual ~Helper() {}
- virtual R Run(P1 p1, P2 p2, P3 p3, P4 p4) = 0;
- };
- template <class T> struct HelperImpl : Helper {
- explicit HelperImpl(const T& functor) : functor_(functor) {}
- virtual R Run(P1 p1, P2 p2, P3 p3, P4 p4) {
- return functor_(p1, p2, p3, p4);
- }
- T functor_;
- };
- scoped_refptr<Helper> helper_;
-};
-
-template <class R,
- class P1,
- class P2,
- class P3,
- class P4,
- class P5>
-class Callback5 {
- public:
- // Default copy operations are appropriate for this class.
- Callback5() {}
- template <class T> Callback5(const T& functor)
- : helper_(new RefCountedObject< HelperImpl<T> >(functor)) {}
- R operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) {
- if (empty())
- return R();
- return helper_->Run(p1, p2, p3, p4, p5);
- }
- bool empty() const { return !helper_; }
-
- private:
- struct Helper : RefCountInterface {
- virtual ~Helper() {}
- virtual R Run(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) = 0;
- };
- template <class T> struct HelperImpl : Helper {
- explicit HelperImpl(const T& functor) : functor_(functor) {}
- virtual R Run(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) {
- return functor_(p1, p2, p3, p4, p5);
- }
- T functor_;
- };
- scoped_refptr<Helper> helper_;
-};
-} // namespace rtc
+// This header is deprecated and is just left here temporarily during
+// refactoring. See https://bugs.webrtc.org/7634 for more details.
+#include "webrtc/rtc_base/callback.h"
#endif // WEBRTC_BASE_CALLBACK_H_
« no previous file with comments | « webrtc/base/byteorder_unittest.cc ('k') | webrtc/base/callback.h.pump » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698