From f71e8fd0c5d2da9795d00a5b81b716ae585be14a Mon Sep 17 00:00:00 2001 From: "commit-bot@chromium.org" Date: Sat, 31 May 2014 00:15:22 +0000 Subject: Revert of Port most uses of SkOnce to SkLazyPtr. (https://codereview.chromium.org/304383005/) Reason for revert: linux x86-64 release segfault in src/ports/SkFontHost_fontconfig.cpp:107 http://108.170.220.120:10117/builders/Test-Ubuntu12-ShuttleA-GTX660-x86_64-Release/builds/905/steps/RunTests/logs/stdio Original issue's description: > Port most uses of SkOnce to SkLazyPtr. > > BUG=skia: > > Committed: http://code.google.com/p/skia/source/detail?r=15006 > > Committed: http://code.google.com/p/skia/source/detail?r=15014 R=reed@google.com, mtklein@chromium.org TBR=mtklein@chromium.org, reed@google.com NOTREECHECKS=true NOTRY=true BUG=skia: Author: mtklein@google.com Review URL: https://codereview.chromium.org/306063004 git-svn-id: http://skia.googlecode.com/svn/trunk@15015 2bbb7eff-a529-9590-31e7-b0007b416f81 --- src/ports/SkFontConfigInterface_direct.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/ports/SkFontConfigInterface_direct.cpp') diff --git a/src/ports/SkFontConfigInterface_direct.cpp b/src/ports/SkFontConfigInterface_direct.cpp index bc3dede40d..80ee56e85c 100644 --- a/src/ports/SkFontConfigInterface_direct.cpp +++ b/src/ports/SkFontConfigInterface_direct.cpp @@ -15,7 +15,7 @@ #include "SkBuffer.h" #include "SkFontConfigInterface.h" -#include "SkLazyPtr.h" +#include "SkOnce.h" #include "SkStream.h" size_t SkFontConfigInterface::FontIdentity::writeToMemory(void* addr) const { @@ -124,13 +124,14 @@ private: SkMutex mutex_; }; -namespace { -SkFontConfigInterface* create_direct() { return SkNEW(SkFontConfigInterfaceDirect); } -} // namespace - +static void create_singleton_direct_interface(SkFontConfigInterface** singleton) { + *singleton = new SkFontConfigInterfaceDirect; +} SkFontConfigInterface* SkFontConfigInterface::GetSingletonDirectInterface() { - SK_DECLARE_STATIC_LAZY_PTR(SkFontConfigInterface, direct, create_direct); - return direct.get(); + static SkFontConfigInterface* gDirect; + SK_DECLARE_STATIC_ONCE(once); + SkOnce(&once, create_singleton_direct_interface, &gDirect); + return gDirect; } /////////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3