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

Side by Side Diff: src/core/SkOpts.cpp

Issue 1894893002: Modernize and trim down SkOnce. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: might as well class Created 4 years, 8 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
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 #include "SkHalf.h" 8 #include "SkHalf.h"
9 #include "SkOnce.h" 9 #include "SkOnce.h"
10 #include "SkOpts.h" 10 #include "SkOpts.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 } 130 }
131 131
132 #elif !defined(SK_ARM_HAS_NEON) && \ 132 #elif !defined(SK_ARM_HAS_NEON) && \
133 defined(SK_CPU_ARM32) && \ 133 defined(SK_CPU_ARM32) && \
134 defined(SK_BUILD_FOR_ANDROID) && \ 134 defined(SK_BUILD_FOR_ANDROID) && \
135 !defined(SK_BUILD_FOR_ANDROID_FRAMEWORK) 135 !defined(SK_BUILD_FOR_ANDROID_FRAMEWORK)
136 if (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) { Init_neon (); } 136 if (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) { Init_neon (); }
137 #endif 137 #endif
138 } 138 }
139 139
140 SK_DECLARE_STATIC_ONCE(gInitOnce); 140 void Init() {
141 void Init() { SkOnce(&gInitOnce, init); } 141 static SkOnce once;
142 once(init);
143 }
142 144
143 #if SK_ALLOW_STATIC_GLOBAL_INITIALIZERS 145 #if SK_ALLOW_STATIC_GLOBAL_INITIALIZERS
144 static struct AutoInit { 146 static struct AutoInit {
145 AutoInit() { Init(); } 147 AutoInit() { Init(); }
146 } gAutoInit; 148 } gAutoInit;
147 #endif 149 #endif
148 } 150 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698