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

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

Issue 651723003: Require SK_DECLARE_STATIC_LAZY_PTR is used in global scope. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: safe unref Created 6 years, 2 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/SkFontHost.cpp ('k') | src/core/SkImageFilter.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 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkGlyphCache.h" 10 #include "SkGlyphCache.h"
(...skipping 11 matching lines...) Expand all
22 //#define RECORD_HASH_EFFICIENCY 22 //#define RECORD_HASH_EFFICIENCY
23 23
24 namespace { 24 namespace {
25 25
26 SkGlyphCache_Globals* create_globals() { 26 SkGlyphCache_Globals* create_globals() {
27 return SkNEW_ARGS(SkGlyphCache_Globals, (SkGlyphCache_Globals::kYes_UseMutex )); 27 return SkNEW_ARGS(SkGlyphCache_Globals, (SkGlyphCache_Globals::kYes_UseMutex ));
28 } 28 }
29 29
30 } // namespace 30 } // namespace
31 31
32 SK_DECLARE_STATIC_LAZY_PTR(SkGlyphCache_Globals, globals, create_globals);
33
32 // Returns the shared globals 34 // Returns the shared globals
33 static SkGlyphCache_Globals& getSharedGlobals() { 35 static SkGlyphCache_Globals& getSharedGlobals() {
34 SK_DECLARE_STATIC_LAZY_PTR(SkGlyphCache_Globals, globals, create_globals);
35 return *globals.get(); 36 return *globals.get();
36 } 37 }
37 38
38 // Returns the TLS globals (if set), or the shared globals 39 // Returns the TLS globals (if set), or the shared globals
39 static SkGlyphCache_Globals& getGlobals() { 40 static SkGlyphCache_Globals& getGlobals() {
40 SkGlyphCache_Globals* tls = SkGlyphCache_Globals::FindTLS(); 41 SkGlyphCache_Globals* tls = SkGlyphCache_Globals::FindTLS();
41 return tls ? *tls : getSharedGlobals(); 42 return tls ? *tls : getSharedGlobals();
42 } 43 }
43 44
44 /////////////////////////////////////////////////////////////////////////////// 45 ///////////////////////////////////////////////////////////////////////////////
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 return tls ? tls->getCacheSizeLimit() : 0; 741 return tls ? tls->getCacheSizeLimit() : 0;
741 } 742 }
742 743
743 void SkGraphics::SetTLSFontCacheLimit(size_t bytes) { 744 void SkGraphics::SetTLSFontCacheLimit(size_t bytes) {
744 if (0 == bytes) { 745 if (0 == bytes) {
745 SkGlyphCache_Globals::DeleteTLS(); 746 SkGlyphCache_Globals::DeleteTLS();
746 } else { 747 } else {
747 SkGlyphCache_Globals::GetTLS().setCacheSizeLimit(bytes); 748 SkGlyphCache_Globals::GetTLS().setCacheSizeLimit(bytes);
748 } 749 }
749 } 750 }
OLDNEW
« no previous file with comments | « src/core/SkFontHost.cpp ('k') | src/core/SkImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698