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

Unified Diff: src/opts/opts_check_x86.cpp

Issue 1322933005: Port uses of SkLazyPtr to SkOncePtr. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: name 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/lazy/SkDiscardableMemoryPool.cpp ('k') | src/pdf/SkPDFGraphicState.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/opts/opts_check_x86.cpp
diff --git a/src/opts/opts_check_x86.cpp b/src/opts/opts_check_x86.cpp
index d3450c1dfc5394237bfcc1730d5cda77275ba5d5..3c817e1f0a4e529c0d9cf1212b2ed257f439ed3b 100644
--- a/src/opts/opts_check_x86.cpp
+++ b/src/opts/opts_check_x86.cpp
@@ -13,7 +13,7 @@
#include "SkBlitRow.h"
#include "SkBlitRow_opts_SSE2.h"
#include "SkBlitRow_opts_SSE4.h"
-#include "SkLazyPtr.h"
+#include "SkOncePtr.h"
#include "SkRTConf.h"
#if defined(_MSC_VER) && defined(_WIN64)
@@ -71,8 +71,7 @@ static inline void getcpuid(int info_type, int info[4]) {
/* Fetch the SIMD level directly from the CPU, at run-time.
* Only checks the levels needed by the optimizations in this file.
*/
-namespace { // get_SIMD_level() technically must have external linkage, so no static.
-int* get_SIMD_level() {
+static int* get_SIMD_level() {
int cpu_info[4] = { 0, 0, 0, 0 };
getcpuid(1, cpu_info);
@@ -91,9 +90,8 @@ int* get_SIMD_level() {
}
return level;
}
-} // namespace
-SK_DECLARE_STATIC_LAZY_PTR(int, gSIMDLevel, get_SIMD_level);
+SK_DECLARE_STATIC_ONCE_PTR(int, gSIMDLevel);
/* Verify that the requested SIMD level is supported in the build.
* If not, check if the platform supports it.
@@ -114,7 +112,7 @@ static inline bool supports_simd(int minLevel) {
*/
return false;
#else
- return minLevel <= *gSIMDLevel.get();
+ return minLevel <= *gSIMDLevel.get(get_SIMD_level);
#endif
}
}
« no previous file with comments | « src/lazy/SkDiscardableMemoryPool.cpp ('k') | src/pdf/SkPDFGraphicState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698