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

Side by Side Diff: include/private/SkOncePtr.h

Issue 1369333004: Move SkAtomics.h to private. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 2 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/private/SkAtomics.h ('k') | include/private/SkSemaphore.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 2015 Google Inc. 2 * Copyright 2015 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 SkOncePtr_DEFINED 8 #ifndef SkOncePtr_DEFINED
9 #define SkOncePtr_DEFINED 9 #define SkOncePtr_DEFINED
10 10
11 #include "SkAtomics.h" 11 #include "../private/SkAtomics.h"
12 #include "SkUniquePtr.h" 12 #include "SkUniquePtr.h"
13 13
14 template <typename T> class SkBaseOncePtr; 14 template <typename T> class SkBaseOncePtr;
15 15
16 // Use this to create a global static pointer that's intialized exactly once whe n you call get(). 16 // Use this to create a global static pointer that's intialized exactly once whe n you call get().
17 #define SK_DECLARE_STATIC_ONCE_PTR(type, name) namespace {} static SkBaseOncePtr <type> name; 17 #define SK_DECLARE_STATIC_ONCE_PTR(type, name) namespace {} static SkBaseOncePtr <type> name;
18 18
19 // Use this for a local or member pointer that's initialized exactly once when y ou call get(). 19 // Use this for a local or member pointer that's initialized exactly once when y ou call get().
20 template <typename T, typename Delete = skstd::default_delete<T>> 20 template <typename T, typename Delete = skstd::default_delete<T>>
21 class SkOncePtr : SkNoncopyable { 21 class SkOncePtr : SkNoncopyable {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 // TODO: If state == 1 spin until it's not? 97 // TODO: If state == 1 spin until it's not?
98 } 98 }
99 99
100 // fState == 0 --> we have not created our ptr yet 100 // fState == 0 --> we have not created our ptr yet
101 // fState == 1 --> someone is in the middle of creating our ptr 101 // fState == 1 --> someone is in the middle of creating our ptr
102 // else --> (T*)fState is our ptr 102 // else --> (T*)fState is our ptr
103 mutable uintptr_t fState; 103 mutable uintptr_t fState;
104 }; 104 };
105 105
106 #endif//SkOncePtr_DEFINED 106 #endif//SkOncePtr_DEFINED
OLDNEW
« no previous file with comments | « include/private/SkAtomics.h ('k') | include/private/SkSemaphore.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698