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

Unified Diff: src/core/SkFunction.h

Issue 1052663004: Implicit constructors for SkFunction are much more readable. (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Created 5 years, 9 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 | « no previous file | tests/FunctionTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkFunction.h
diff --git a/src/core/SkFunction.h b/src/core/SkFunction.h
index 98ae789cae2c70d8f29bd542034e0ecf397af691..43438dd9e29970f1ea619cc3e6067fcf4abc11a2 100644
--- a/src/core/SkFunction.h
+++ b/src/core/SkFunction.h
@@ -18,20 +18,20 @@ template <typename> class SkFunction;
template <typename R, typename... Args>
class SkFunction<R(Args...)> : SkNoncopyable {
public:
- explicit SkFunction(R (*fn)(Args...)) : fVTable(GetFunctionPointerVTable()) {
+ SkFunction(R (*fn)(Args...)) : fVTable(GetFunctionPointerVTable()) {
// We've been passed a function pointer. We'll just store it.
fFunction = reinterpret_cast<void*>(fn);
}
template <typename Fn>
- explicit SkFunction(Fn fn, SK_WHEN_C((sizeof(Fn) > sizeof(void*)), void*) = nullptr)
+ SkFunction(Fn fn, SK_WHEN_C((sizeof(Fn) > sizeof(void*)), void*) = nullptr)
: fVTable(GetOutlineVTable<Fn>()) {
// We've got a functor larger than a pointer. We've go to copy it onto the heap.
fFunction = SkNEW_ARGS(Fn, (Forward(fn)));
}
template <typename Fn>
- explicit SkFunction(Fn fn, SK_WHEN_C((sizeof(Fn) <= sizeof(void*)), void*) = nullptr)
+ SkFunction(Fn fn, SK_WHEN_C((sizeof(Fn) <= sizeof(void*)), void*) = nullptr)
: fVTable(GetInlineVTable<Fn>()) {
// We've got a functor that fits in a pointer. We copy it right inline.
fFunction = NULL; // Quiets a (spurious) warning that fFunction might be uninitialized.
@@ -96,7 +96,6 @@ private:
// TODO:
// - is it worth moving fCall out of the VTable into SkFunction itself to avoid the indirection?
-// - should constructors be implicit?
// - make SkFunction copyable
#endif//SkFunction_DEFINED
« no previous file with comments | « no previous file | tests/FunctionTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698