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

Side by Side Diff: chrome/browser/sync/notifier/gaia_auth/sigslotrepeater.h

Issue 194065: Initial commit of sync engine code to browser/sync.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Fixes to gtest include path, reverted syncapi. Created 11 years, 3 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 | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_SYNC_NOTIFIER_GAIA_AUTH_INET_ATON_H_SIGSLOTREPEATER_H_
6 #define CHROME_BROWSER_SYNC_NOTIFIER_GAIA_AUTH_INET_ATON_H_SIGSLOTREPEATER_H_
7
8 // Repeaters are both signals and slots, which are designed as intermediate
9 // pass-throughs for signals and slots which don't know about each other (for
10 // modularity or encapsulation). This eliminates the need to declare a signal
11 // handler whose sole purpose is to fire another signal. The repeater connects
12 // to the originating signal using the 'repeat' method. When the repeated
13 // signal fires, the repeater will also fire.
14
15 #include "talk/base/sigslot.h"
16
17 namespace sigslot {
18
19 template<class mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
20 class repeater0 : public signal0<mt_policy>,
21 public has_slots<mt_policy> {
22 public:
23 typedef signal0<mt_policy> base_type;
24 typedef repeater0<mt_policy> this_type;
25
26 repeater0() { }
27 explicit repeater0(const this_type& s) : base_type(s) { }
28
29 void reemit() { signal0<mt_policy>::emit(); }
30 void repeat(base_type &s) { s.connect(this, &this_type::reemit); }
31 };
32
33 template<class arg1_type, class mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
34 class repeater1 : public signal1<arg1_type, mt_policy>,
35 public has_slots<mt_policy>
36 {
37 public:
38 typedef signal1<arg1_type, mt_policy> base_type;
39 typedef repeater1<arg1_type, mt_policy> this_type;
40
41 repeater1() { }
42 repeater1(const this_type& s) : base_type(s) { }
43
44 void reemit(arg1_type a1) { signal1<arg1_type, mt_policy>::emit(a1); }
45 void repeat(base_type& s) { s.connect(this, &this_type::reemit); }
46 };
47
48 template<class arg1_type, class arg2_type,
49 class mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
50 class repeater2 : public signal2<arg1_type, arg2_type, mt_policy>,
51 public has_slots<mt_policy>
52 {
53 public:
54 typedef signal2<arg1_type, arg2_type, mt_policy> base_type;
55 typedef repeater2<arg1_type, arg2_type, mt_policy> this_type;
56
57 repeater2() { }
58 repeater2(const this_type& s) : base_type(s) { }
59
60 void reemit(arg1_type a1, arg2_type a2) {
61 signal2<arg1_type, arg2_type, mt_policy>::emit(a1, a2);
62 }
63 void repeat(base_type& s) { s.connect(this, &this_type::reemit); }
64 };
65
66 template<class arg1_type, class arg2_type, class arg3_type,
67 class mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
68 class repeater3 : public signal3<arg1_type, arg2_type, arg3_type, mt_policy>,
69 public has_slots<mt_policy>
70 {
71 public:
72 typedef signal3<arg1_type, arg2_type, arg3_type, mt_policy> base_type;
73 typedef repeater3<arg1_type, arg2_type, arg3_type, mt_policy> this_type;
74
75 repeater3() { }
76 repeater3(const this_type& s) : base_type(s) { }
77
78 void reemit(arg1_type a1, arg2_type a2, arg3_type a3) {
79 signal3<arg1_type, arg2_type, arg3_type, mt_policy>::emit(a1, a2, a3);
80 }
81 void repeat(base_type& s) { s.connect(this, &this_type::reemit); }
82 };
83
84 } // namespace sigslot
85
86 #endif // CHROME_BROWSER_SYNC_NOTIFIER_GAIA_AUTH_INET_ATON_H_SIGSLOTREPEATER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698