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

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

Issue 303463009: Remove SkThread.h from public API. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rest Created 6 years, 6 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 | « include/core/SkInstCnt.h ('k') | include/core/SkRefCnt.h » ('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 2013 Google Inc. 2 * Copyright 2013 Google Inc.
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 SkOnce_DEFINED 8 #ifndef SkOnce_DEFINED
9 #define SkOnce_DEFINED 9 #define SkOnce_DEFINED
10 10
(...skipping 11 matching lines...) Expand all
22 // SkOnce(&once, set_up_my_singleton, &singleton); 22 // SkOnce(&once, set_up_my_singleton, &singleton);
23 // SkASSERT(NULL != singleton); 23 // SkASSERT(NULL != singleton);
24 // return *singleton; 24 // return *singleton;
25 // } 25 // }
26 // 26 //
27 // OnceTest.cpp also should serve as a few other simple examples. 27 // OnceTest.cpp also should serve as a few other simple examples.
28 // 28 //
29 // You may optionally pass SkOnce a second function to be called at exit for cle anup. 29 // You may optionally pass SkOnce a second function to be called at exit for cle anup.
30 30
31 #include "SkDynamicAnnotations.h" 31 #include "SkDynamicAnnotations.h"
32 #include "SkThread.h"
33 #include "SkTypes.h" 32 #include "SkTypes.h"
34 33
34 #include "../../src/core/SkThread.h"
35
35 #define SK_ONCE_INIT { false, { 0, SkDEBUGCODE(0) } } 36 #define SK_ONCE_INIT { false, { 0, SkDEBUGCODE(0) } }
36 #define SK_DECLARE_STATIC_ONCE(name) static SkOnceFlag name = SK_ONCE_INIT 37 #define SK_DECLARE_STATIC_ONCE(name) static SkOnceFlag name = SK_ONCE_INIT
37 38
38 struct SkOnceFlag; // If manually created, initialize with SkOnceFlag once = SK _ONCE_INIT 39 struct SkOnceFlag; // If manually created, initialize with SkOnceFlag once = SK _ONCE_INIT
39 40
40 template <typename Func, typename Arg> 41 template <typename Func, typename Arg>
41 inline void SkOnce(SkOnceFlag* once, Func f, Arg arg, void(*atExit)() = NULL); 42 inline void SkOnce(SkOnceFlag* once, Func f, Arg arg, void(*atExit)() = NULL);
42 43
43 // If you've already got a lock and a flag to use, this variant lets you avoid a n extra SkOnceFlag. 44 // If you've already got a lock and a flag to use, this variant lets you avoid a n extra SkOnceFlag.
44 template <typename Lock, typename Func, typename Arg> 45 template <typename Lock, typename Func, typename Arg>
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 } 169 }
169 170
170 template <typename Func, typename Arg> 171 template <typename Func, typename Arg>
171 inline void SkOnce(SkOnceFlag* once, Func f, Arg arg, void(*atExit)()) { 172 inline void SkOnce(SkOnceFlag* once, Func f, Arg arg, void(*atExit)()) {
172 return SkOnce(&once->done, &once->lock, f, arg, atExit); 173 return SkOnce(&once->done, &once->lock, f, arg, atExit);
173 } 174 }
174 175
175 #undef SK_ANNOTATE_BENIGN_RACE 176 #undef SK_ANNOTATE_BENIGN_RACE
176 177
177 #endif // SkOnce_DEFINED 178 #endif // SkOnce_DEFINED
OLDNEW
« no previous file with comments | « include/core/SkInstCnt.h ('k') | include/core/SkRefCnt.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698