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

Side by Side Diff: src/core/SkTLS.h

Issue 1316233002: Style Change: NULL->nullptr (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-27 (Thursday) 10:25:06 EDT Created 5 years, 3 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 | « src/core/SkTLList.h ('k') | src/core/SkTLS.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 2012 Google Inc. 2 * Copyright 2012 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 SkTLS_DEFINED 8 #ifndef SkTLS_DEFINED
9 #define SkTLS_DEFINED 9 #define SkTLS_DEFINED
10 10
11 #include "SkTypes.h" 11 #include "SkTypes.h"
12 12
13 /** 13 /**
14 * Maintains a per-thread cache, using a CreateProc as the key into that cache. 14 * Maintains a per-thread cache, using a CreateProc as the key into that cache.
15 */ 15 */
16 class SkTLS { 16 class SkTLS {
17 public: 17 public:
18 typedef void* (*CreateProc)(); 18 typedef void* (*CreateProc)();
19 typedef void (*DeleteProc)(void*); 19 typedef void (*DeleteProc)(void*);
20 20
21 /** 21 /**
22 * If Get() has previously been called with this CreateProc, then this 22 * If Get() has previously been called with this CreateProc, then this
23 * returns its cached data, otherwise it returns NULL. The CreateProc is 23 * returns its cached data, otherwise it returns nullptr. The CreateProc is
24 * never invoked in Find, it is only used as a key for searching the 24 * never invoked in Find, it is only used as a key for searching the
25 * cache. 25 * cache.
26 */ 26 */
27 static void* Find(CreateProc); 27 static void* Find(CreateProc);
28 28
29 /** 29 /**
30 * Return the cached data that was returned by the CreateProc. This proc 30 * Return the cached data that was returned by the CreateProc. This proc
31 * is only called the first time Get is called, and there after it is 31 * is only called the first time Get is called, and there after it is
32 * cached (per-thread), using the CreateProc as a key to look it up. 32 * cached (per-thread), using the CreateProc as a key to look it up.
33 * 33 *
(...skipping 11 matching lines...) Expand all
45 static void Delete(CreateProc); 45 static void Delete(CreateProc);
46 46
47 private: 47 private:
48 // Our implementation requires only 1 TLS slot, as we manage multiple values 48 // Our implementation requires only 1 TLS slot, as we manage multiple values
49 // ourselves in a list, with the platform specific value as our head. 49 // ourselves in a list, with the platform specific value as our head.
50 50
51 /** 51 /**
52 * Implemented by the platform, to return the value of our (one) slot per-t hread 52 * Implemented by the platform, to return the value of our (one) slot per-t hread
53 * 53 *
54 * If forceCreateTheSlot is true, then we must have created the "slot" for 54 * If forceCreateTheSlot is true, then we must have created the "slot" for
55 * our TLS, even though we know that the return value will be NULL in that 55 * our TLS, even though we know that the return value will be nullptr in th at
56 * case (i.e. no-slot and first-time-slot both return NULL). This ensures 56 * case (i.e. no-slot and first-time-slot both return nullptr). This ensure s
57 * that after calling GetSpecific, we know that we can legally call 57 * that after calling GetSpecific, we know that we can legally call
58 * SetSpecific. 58 * SetSpecific.
59 * 59 *
60 * If forceCreateTheSlot is false, then the impl can either create the 60 * If forceCreateTheSlot is false, then the impl can either create the
61 * slot or not. 61 * slot or not.
62 */ 62 */
63 static void* PlatformGetSpecific(bool forceCreateTheSlot); 63 static void* PlatformGetSpecific(bool forceCreateTheSlot);
64 64
65 /** 65 /**
66 * Implemented by the platform, to set the value for our (one) slot per-thr ead 66 * Implemented by the platform, to set the value for our (one) slot per-thr ead
67 * 67 *
68 * The implementation can rely on GetSpecific(true) having been previously 68 * The implementation can rely on GetSpecific(true) having been previously
69 * called before SetSpecific is called. 69 * called before SetSpecific is called.
70 */ 70 */
71 static void PlatformSetSpecific(void*); 71 static void PlatformSetSpecific(void*);
72 72
73 public: 73 public:
74 /** 74 /**
75 * Will delete our internal list. To be called by the platform if/when its 75 * Will delete our internal list. To be called by the platform if/when its
76 * TLS slot is deleted (often at thread shutdown). 76 * TLS slot is deleted (often at thread shutdown).
77 * 77 *
78 * Public *only* for the platform's use, not to be called by a client. 78 * Public *only* for the platform's use, not to be called by a client.
79 */ 79 */
80 static void Destructor(void* ptr); 80 static void Destructor(void* ptr);
81 }; 81 };
82 82
83 #endif 83 #endif
OLDNEW
« no previous file with comments | « src/core/SkTLList.h ('k') | src/core/SkTLS.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698