Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 | 8 |
| 9 #include "GrCacheable.h" | 9 #include "GrCacheable.h" |
| 10 | 10 |
| 11 uint32_t GrCacheable::getGenerationID() const { | 11 uint32_t GrCacheable::CreateInstanceID() { |
| 12 static int32_t gPathRefGenerationID; | 12 static int32_t gCacheableID; |
|
jvanverth1
2014/07/08 19:35:43
Since 0 means 'no entry' in fHWBoundRenderTargetIn
bsalomon
2014/07/08 19:39:12
It is! All static POD types are initialized to 0.
| |
| 13 while (!fGenID) { | 13 uint32_t id; |
| 14 fGenID = static_cast<uint32_t>(sk_atomic_inc(&gPathRefGenerationID) + 1) ; | 14 do { |
| 15 } | 15 id = static_cast<uint32_t>(sk_atomic_inc(&gCacheableID) + 1); |
| 16 return fGenID; | 16 } while (!id); |
| 17 return id; | |
| 17 } | 18 } |
| OLD | NEW |