aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@chromium.org>2016-04-18 08:09:11 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-04-18 08:09:11 -0700
commitd9dd4282118fc14eac735e6fa0b3ec53047b457f (patch)
treeb88bce11cbcec3100e428b713df49e1fcd83f8d2 /tools
parentf7142e71d7c0a7d8406679e207ff766085499d2e (diff)
Modernize and trim down SkOnce.
The API and implementation are very much simplified. You may not want to bother reading the diff. As is our trend, SkOnce now uses <atomic> directly. Member initialization means we don't need SK_DECLARE_STATIC_ONCE. SkSpinlock already works this same way. All uses of the old API taking an external bool* and Lock* were pessimal, so I have not carried this sort of API forward. It's simpler, faster, and more space-efficient to always use this single SkOnce class interface. SkOnce weighs 2 bytes: a done bool and an SkSpinlock, also a bool internally. This API refactoring opens up the opportunity to fuse those into a single three-state byte if we'd like. No public API changes. TBR=reed@google.com BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1894893002 Review URL: https://codereview.chromium.org/1894893002
Diffstat (limited to 'tools')
-rw-r--r--tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp b/tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp
index af0abc5853..850adaaf25 100644
--- a/tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp
+++ b/tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp
@@ -127,9 +127,9 @@ static GrGLFuncPtr command_buffer_get_gl_proc(void* ctx, const char name[]) {
return gfGetProcAddress(name);
}
-SK_DECLARE_STATIC_ONCE(loadCommandBufferOnce);
static void load_command_buffer_once() {
- SkOnce(&loadCommandBufferOnce, load_command_buffer_functions);
+ static SkOnce once;
+ once(load_command_buffer_functions);
}
static const GrGLInterface* create_command_buffer_interface() {