Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 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 Bind_h | |
| 6 #define Bind_h | |
| 7 | |
| 8 #include "base/bind.h" | |
| 9 | |
| 10 // This file provides limited access to base::Bind() function. base::Bind() | |
| 11 // could be dangerous if it's used across threads, so we don't want to allow | |
| 12 // general use of base::Bind(). | |
| 13 // See also "platform/ThreadSafeFunctional.h". | |
| 14 | |
| 15 namespace blink { | |
| 16 | |
| 17 // Binds an instance of a class to its member function. Does not bind anything | |
| 18 // else. | |
| 19 template<typename Class, typename ReturnType, typename... Args> | |
| 20 auto bindInstanceToMethod(ReturnType (Class::*method)(Args...), Class* instance) | |
|
dcheng
2016/01/27 02:50:01
Out of curiosity, why not base::Callback<ReturnTyp
Yuki
2016/01/27 04:29:45
The return type of base::Bind is
template <typena
tzik
2016/01/27 05:17:26
The result of the complex template is just to drop
Yuki
2016/01/27 05:31:08
Ah, I see. Good to know. Thanks.
| |
| 21 -> decltype(base::Bind(method, base::Unretained(instance))) | |
| 22 { | |
| 23 return base::Bind(method, base::Unretained(instance)); | |
| 24 } | |
| 25 | |
| 26 } // namespace blink | |
| 27 | |
| 28 #endif // Bind_h | |
| OLD | NEW |