OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2012 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 26 matching lines...) Expand all Loading... |
37 // } | 37 // } |
38 // | 38 // |
39 // Example usage of ref counted objects: | 39 // Example usage of ref counted objects: |
40 // struct Bar { | 40 // struct Bar { |
41 // int AddRef(); | 41 // int AddRef(); |
42 // int Release(); | 42 // int Release(); |
43 // | 43 // |
44 // void Test() {} | 44 // void Test() {} |
45 // void BindThis() { | 45 // void BindThis() { |
46 // // The functor passed to AsyncInvoke() will keep this object alive. | 46 // // The functor passed to AsyncInvoke() will keep this object alive. |
47 // invoker.AsyncInvoke(rtc::Bind(&Bar::Test, this)); | 47 // invoker.AsyncInvoke(RTC_FROM_HERE,rtc::Bind(&Bar::Test, this)); |
48 // } | 48 // } |
49 // }; | 49 // }; |
50 // | 50 // |
51 // int main() { | 51 // int main() { |
52 // rtc::scoped_refptr<Bar> bar = new rtc::RefCountedObject<Bar>(); | 52 // rtc::scoped_refptr<Bar> bar = new rtc::RefCountedObject<Bar>(); |
53 // auto functor = rtc::Bind(&Bar::Test, bar); | 53 // auto functor = rtc::Bind(&Bar::Test, bar); |
54 // bar = nullptr; | 54 // bar = nullptr; |
55 // // The functor stores an internal scoped_refptr<Bar>, so this is safe. | 55 // // The functor stores an internal scoped_refptr<Bar>, so this is safe. |
56 // functor(); | 56 // functor(); |
57 // } | 57 // } |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 | 217 |
218 #undef FP_T | 218 #undef FP_T |
219 | 219 |
220 ]] | 220 ]] |
221 | 221 |
222 } // namespace rtc | 222 } // namespace rtc |
223 | 223 |
224 #undef NONAME | 224 #undef NONAME |
225 | 225 |
226 #endif // WEBRTC_BASE_BIND_H_ | 226 #endif // WEBRTC_BASE_BIND_H_ |
OLD | NEW |