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

Side by Side Diff: src/ports/SkFontHost_fontconfig.cpp

Issue 1875733002: Increase request cache size. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add comment for size. Created 4 years, 8 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 | « no previous file | no next file » | 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 2008 Google Inc. 2 * Copyright 2008 Google Inc.
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 "SkFontConfigInterface.h" 8 #include "SkFontConfigInterface.h"
9 #include "SkFontConfigTypeface.h" 9 #include "SkFontConfigTypeface.h"
10 #include "SkFontDescriptor.h" 10 #include "SkFontDescriptor.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 FontConfigTypeface* cachedFCTypeface = static_cast<FontConfigTypeface*>(cach edTypeface); 63 FontConfigTypeface* cachedFCTypeface = static_cast<FontConfigTypeface*>(cach edTypeface);
64 FontIdentity* identity = static_cast<FontIdentity*>(ctx); 64 FontIdentity* identity = static_cast<FontIdentity*>(ctx);
65 65
66 return cachedFCTypeface->getIdentity() == *identity; 66 return cachedFCTypeface->getIdentity() == *identity;
67 } 67 }
68 68
69 SK_DECLARE_STATIC_MUTEX(gSkFontHostRequestCacheMutex); 69 SK_DECLARE_STATIC_MUTEX(gSkFontHostRequestCacheMutex);
70 class SkFontHostRequestCache { 70 class SkFontHostRequestCache {
71 71
72 // The value of maxSize here is a compromise between cache hits and cache si ze. 72 // The value of maxSize here is a compromise between cache hits and cache si ze.
73 static const size_t gMaxSize = 1 << 12; 73 // See https://crbug.com/424082#63 for reason for current size.
74 static const size_t gMaxSize = 1 << 15;
74 75
75 static SkFontHostRequestCache& Get() { 76 static SkFontHostRequestCache& Get() {
76 gSkFontHostRequestCacheMutex.assertHeld(); 77 gSkFontHostRequestCacheMutex.assertHeld();
77 static SkFontHostRequestCache gCache(gMaxSize); 78 static SkFontHostRequestCache gCache(gMaxSize);
78 return gCache; 79 return gCache;
79 } 80 }
80 81
81 public: 82 public:
82 struct Request : public SkResourceCache::Key { 83 struct Request : public SkResourceCache::Key {
83 private: 84 private:
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 *familyName = fFamilyName; 228 *familyName = fFamilyName;
228 } 229 }
229 230
230 void FontConfigTypeface::onGetFontDescriptor(SkFontDescriptor* desc, 231 void FontConfigTypeface::onGetFontDescriptor(SkFontDescriptor* desc,
231 bool* isLocalStream) const { 232 bool* isLocalStream) const {
232 SkString name; 233 SkString name;
233 this->getFamilyName(&name); 234 this->getFamilyName(&name);
234 desc->setFamilyName(name.c_str()); 235 desc->setFamilyName(name.c_str());
235 *isLocalStream = SkToBool(this->getLocalStream()); 236 *isLocalStream = SkToBool(this->getLocalStream());
236 } 237 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698