| Index: include/core/SkTRegistry.h
|
| diff --git a/include/core/SkTRegistry.h b/include/core/SkTRegistry.h
|
| index 34fcffd5c51374cd422395fa7e547c287666a3b7..0994c990dccbe8625d59f06c705925ff2889cb21 100644
|
| --- a/include/core/SkTRegistry.h
|
| +++ b/include/core/SkTRegistry.h
|
| @@ -16,11 +16,11 @@
|
| and provides a function-pointer. This can be used to auto-register a set of
|
| services, e.g. a set of image codecs.
|
| */
|
| -template <typename T, typename P> class SkTRegistry : SkNoncopyable {
|
| +template <typename T> class SkTRegistry : SkNoncopyable {
|
| public:
|
| - typedef T (*Factory)(P);
|
| + typedef T Factory;
|
|
|
| - SkTRegistry(Factory fact) {
|
| + explicit SkTRegistry(T fact) : fFact(fact) {
|
| #ifdef SK_BUILD_FOR_ANDROID
|
| // work-around for double-initialization bug
|
| {
|
| @@ -33,15 +33,14 @@ public:
|
| }
|
| }
|
| #endif
|
| - fFact = fact;
|
| fChain = gHead;
|
| - gHead = this;
|
| + gHead = this;
|
| }
|
|
|
| static const SkTRegistry* Head() { return gHead; }
|
|
|
| const SkTRegistry* next() const { return fChain; }
|
| - Factory factory() const { return fFact; }
|
| + const Factory& factory() const { return fFact; }
|
|
|
| private:
|
| Factory fFact;
|
| @@ -51,6 +50,6 @@ private:
|
| };
|
|
|
| // The caller still needs to declare an instance of this somewhere
|
| -template <typename T, typename P> SkTRegistry<T, P>* SkTRegistry<T, P>::gHead;
|
| +template <typename T> SkTRegistry<T>* SkTRegistry<T>::gHead;
|
|
|
| #endif
|
|
|