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

Side by Side Diff: include/core/SkFlattenable.h

Issue 1580873002: reorg global initialization, separating core from optional (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add dox to _core method Created 4 years, 11 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
« no previous file with comments | « gyp/core.gypi ('k') | src/core/SkGlobalInitialization_core.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkFlattenable_DEFINED 8 #ifndef SkFlattenable_DEFINED
9 #define SkFlattenable_DEFINED 9 #define SkFlattenable_DEFINED
10 10
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #define SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END \ 42 #define SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END \
43 } 43 }
44 44
45 #define SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(flattenable) \ 45 #define SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(flattenable) \
46 SkFlattenable::Register(#flattenable, flattenable::CreateProc, \ 46 SkFlattenable::Register(#flattenable, flattenable::CreateProc, \
47 flattenable::GetFlattenableType()); 47 flattenable::GetFlattenableType());
48 48
49 #define SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(flattenable) \ 49 #define SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(flattenable) \
50 private: \ 50 private: \
51 static SkFlattenable* CreateProc(SkReadBuffer&); \ 51 static SkFlattenable* CreateProc(SkReadBuffer&); \
52 friend class ::SkPrivateEffectInitializer; \ 52 friend class SkFlattenable::PrivateInitializer; \
53 public: \ 53 public: \
54 Factory getFactory() const override { return CreateProc; } 54 Factory getFactory() const override { return CreateProc; }
55 55
56 /** For SkFlattenable derived objects with a valid type 56 /** For SkFlattenable derived objects with a valid type
57 This macro should only be used in base class objects in core 57 This macro should only be used in base class objects in core
58 */ 58 */
59 #define SK_DEFINE_FLATTENABLE_TYPE(flattenable) \ 59 #define SK_DEFINE_FLATTENABLE_TYPE(flattenable) \
60 static Type GetFlattenableType() { \ 60 static Type GetFlattenableType() { \
61 return k##flattenable##_Type; \ 61 return k##flattenable##_Type; \
62 } 62 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 static bool NameToType(const char name[], Type* type); 101 static bool NameToType(const char name[], Type* type);
102 102
103 static void Register(const char name[], Factory, Type); 103 static void Register(const char name[], Factory, Type);
104 104
105 /** 105 /**
106 * Override this if your subclass needs to record data that it will need to recreate itself 106 * Override this if your subclass needs to record data that it will need to recreate itself
107 * from its CreateProc (returned by getFactory()). 107 * from its CreateProc (returned by getFactory()).
108 */ 108 */
109 virtual void flatten(SkWriteBuffer&) const {} 109 virtual void flatten(SkWriteBuffer&) const {}
110 110
111 protected:
112 class PrivateInitializer {
113 public:
114 static void InitCore();
115 static void InitEffects();
116 };
117
111 private: 118 private:
112 static void InitializeFlattenablesIfNeeded(); 119 static void InitializeFlattenablesIfNeeded();
113 120
114 friend class SkGraphics; 121 friend class SkGraphics;
115 122
116 typedef SkRefCnt INHERITED; 123 typedef SkRefCnt INHERITED;
117 }; 124 };
118 125
119 #endif 126 #endif
OLDNEW
« no previous file with comments | « gyp/core.gypi ('k') | src/core/SkGlobalInitialization_core.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698