aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/opts
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@google.com>2015-09-09 07:10:42 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-09-09 07:10:42 -0700
commit2ac6793efc9b33f6104f9c39810bee5714bdc208 (patch)
tree9d7e8e1e89d3fae55e7f6eabc9139fa28989d561 /src/opts
parent62fb1ba1786863e545c89839b5706ad5151cec15 (diff)
Revert of Port uses of SkLazyPtr to SkOncePtr. (patchset #7 id:110001 of https://codereview.chromium.org/1322933005/ )
Reason for revert: Breaks Chrome roll. obj/skia/ext/skia_chrome.skia_memory_dump_provider.o does not have -I include/private on its include path, but transitively includes SkMessageBus.h. Original issue's description: > Port uses of SkLazyPtr to SkOncePtr. > > This gives SkOncePtr a non-trivial destructor that uses std::default_delete > by default. This is overrideable, as seen in SkColorTable. > > SK_DECLARE_STATIC_ONCE_PTR still just leaves its pointers hanging at EOP. > > BUG=skia: > > No public API changes. > TBR=reed@google.com > > Committed: https://skia.googlesource.com/skia/+/a1254acdb344174e761f5061c820559dab64a74c TBR=herb@google.com,mtklein@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review URL: https://codereview.chromium.org/1334523002
Diffstat (limited to 'src/opts')
-rw-r--r--src/opts/opts_check_x86.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/opts/opts_check_x86.cpp b/src/opts/opts_check_x86.cpp
index 3c817e1f0a..d3450c1dfc 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 "SkOncePtr.h"
+#include "SkLazyPtr.h"
#include "SkRTConf.h"
#if defined(_MSC_VER) && defined(_WIN64)
@@ -71,7 +71,8 @@ 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.
*/
-static int* get_SIMD_level() {
+namespace { // get_SIMD_level() technically must have external linkage, so no static.
+int* get_SIMD_level() {
int cpu_info[4] = { 0, 0, 0, 0 };
getcpuid(1, cpu_info);
@@ -90,8 +91,9 @@ static int* get_SIMD_level() {
}
return level;
}
+} // namespace
-SK_DECLARE_STATIC_ONCE_PTR(int, gSIMDLevel);
+SK_DECLARE_STATIC_LAZY_PTR(int, gSIMDLevel, get_SIMD_level);
/* Verify that the requested SIMD level is supported in the build.
* If not, check if the platform supports it.
@@ -112,7 +114,7 @@ static inline bool supports_simd(int minLevel) {
*/
return false;
#else
- return minLevel <= *gSIMDLevel.get(get_SIMD_level);
+ return minLevel <= *gSIMDLevel.get();
#endif
}
}