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

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

Issue 1945293004: Revert of SkOncePtr -> SkOnce (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « src/core/SkFontMgr.cpp ('k') | src/core/SkImageFilterCache.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
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 "SkGlyphCache.h" 8 #include "SkGlyphCache.h"
9 #include "SkGlyphCache_Globals.h" 9 #include "SkGlyphCache_Globals.h"
10 #include "SkGraphics.h" 10 #include "SkGraphics.h"
11 #include "SkOnce.h" 11 #include "SkOncePtr.h"
12 #include "SkPath.h" 12 #include "SkPath.h"
13 #include "SkTemplates.h" 13 #include "SkTemplates.h"
14 #include "SkTraceMemoryDump.h" 14 #include "SkTraceMemoryDump.h"
15 #include "SkTypeface.h" 15 #include "SkTypeface.h"
16 16
17 #include <cctype> 17 #include <cctype>
18 18
19 //#define SPEW_PURGE_STATUS 19 //#define SPEW_PURGE_STATUS
20 20
21 namespace { 21 namespace {
22 const char gGlyphCacheDumpName[] = "skia/sk_glyph_cache"; 22 const char gGlyphCacheDumpName[] = "skia/sk_glyph_cache";
23 } // namespace 23 } // namespace
24 24
25 // Returns the shared globals 25 // Returns the shared globals
26 SK_DECLARE_STATIC_ONCE_PTR(SkGlyphCache_Globals, globals);
26 static SkGlyphCache_Globals& get_globals() { 27 static SkGlyphCache_Globals& get_globals() {
27 static SkOnce once; 28 return *globals.get([]{ return new SkGlyphCache_Globals; });
28 static SkGlyphCache_Globals* globals;
29
30 once([]{ globals = new SkGlyphCache_Globals; });
31 return *globals;
32 } 29 }
33 30
34 /////////////////////////////////////////////////////////////////////////////// 31 ///////////////////////////////////////////////////////////////////////////////
35 32
36 // so we don't grow our arrays a lot 33 // so we don't grow our arrays a lot
37 #define kMinGlyphCount 16 34 #define kMinGlyphCount 16
38 #define kMinGlyphImageSize (16*2) 35 #define kMinGlyphImageSize (16*2)
39 #define kMinAllocAmount ((sizeof(SkGlyph) + kMinGlyphImageSize) * kMinGlyphC ount) 36 #define kMinAllocAmount ((sizeof(SkGlyph) + kMinGlyphImageSize) * kMinGlyphC ount)
40 37
41 SkGlyphCache::SkGlyphCache(SkTypeface* typeface, const SkDescriptor* desc, SkSca lerContext* ctx) 38 SkGlyphCache::SkGlyphCache(SkTypeface* typeface, const SkDescriptor* desc, SkSca lerContext* ctx)
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 } 814 }
818 815
819 void SkGraphics::PurgeFontCache() { 816 void SkGraphics::PurgeFontCache() {
820 get_globals().purgeAll(); 817 get_globals().purgeAll();
821 SkTypefaceCache::PurgeAll(); 818 SkTypefaceCache::PurgeAll();
822 } 819 }
823 820
824 // TODO(herb): clean up TLS apis. 821 // TODO(herb): clean up TLS apis.
825 size_t SkGraphics::GetTLSFontCacheLimit() { return 0; } 822 size_t SkGraphics::GetTLSFontCacheLimit() { return 0; }
826 void SkGraphics::SetTLSFontCacheLimit(size_t bytes) { } 823 void SkGraphics::SetTLSFontCacheLimit(size_t bytes) { }
OLDNEW
« no previous file with comments | « src/core/SkFontMgr.cpp ('k') | src/core/SkImageFilterCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698