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

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

Issue 1214603003: Revert of Remove SkThread.h, include SkMutex.h or SkAtomics.h as appropriate. (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Created 5 years, 5 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/SkDrawable.cpp ('k') | src/core/SkGlyphCache_Globals.h » ('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 "SkLazyPtr.h" 11 #include "SkLazyPtr.h"
12 #include "SkMutex.h"
13 #include "SkPaint.h" 12 #include "SkPaint.h"
14 #include "SkPath.h" 13 #include "SkPath.h"
14 #include "SkTemplates.h"
15 #include "SkTLS.h" 15 #include "SkTLS.h"
16 #include "SkTemplates.h"
17 #include "SkTypeface.h" 16 #include "SkTypeface.h"
18 17
19 //#define SPEW_PURGE_STATUS 18 //#define SPEW_PURGE_STATUS
20 19
21 namespace { 20 namespace {
22 21
23 SkGlyphCache_Globals* create_globals() { 22 SkGlyphCache_Globals* create_globals() {
24 return SkNEW_ARGS(SkGlyphCache_Globals, (SkGlyphCache_Globals::kYes_UseMutex )); 23 return SkNEW_ARGS(SkGlyphCache_Globals, (SkGlyphCache_Globals::kYes_UseMutex ));
25 } 24 }
26 25
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 rec->fProc(rec->fData); 410 rec->fProc(rec->fData);
412 AuxProcRec* next = rec->fNext; 411 AuxProcRec* next = rec->fNext;
413 SkDELETE(rec); 412 SkDELETE(rec);
414 rec = next; 413 rec = next;
415 } 414 }
416 } 415 }
417 416
418 /////////////////////////////////////////////////////////////////////////////// 417 ///////////////////////////////////////////////////////////////////////////////
419 /////////////////////////////////////////////////////////////////////////////// 418 ///////////////////////////////////////////////////////////////////////////////
420 419
420 #include "SkThread.h"
421
421 size_t SkGlyphCache_Globals::setCacheSizeLimit(size_t newLimit) { 422 size_t SkGlyphCache_Globals::setCacheSizeLimit(size_t newLimit) {
422 static const size_t minLimit = 256 * 1024; 423 static const size_t minLimit = 256 * 1024;
423 if (newLimit < minLimit) { 424 if (newLimit < minLimit) {
424 newLimit = minLimit; 425 newLimit = minLimit;
425 } 426 }
426 427
427 SkAutoMutexAcquire ac(fMutex); 428 SkAutoMutexAcquire ac(fMutex);
428 429
429 size_t prevLimit = fCacheSizeLimit; 430 size_t prevLimit = fCacheSizeLimit;
430 fCacheSizeLimit = newLimit; 431 fCacheSizeLimit = newLimit;
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 return tls ? tls->getCacheSizeLimit() : 0; 727 return tls ? tls->getCacheSizeLimit() : 0;
727 } 728 }
728 729
729 void SkGraphics::SetTLSFontCacheLimit(size_t bytes) { 730 void SkGraphics::SetTLSFontCacheLimit(size_t bytes) {
730 if (0 == bytes) { 731 if (0 == bytes) {
731 SkGlyphCache_Globals::DeleteTLS(); 732 SkGlyphCache_Globals::DeleteTLS();
732 } else { 733 } else {
733 SkGlyphCache_Globals::GetTLS().setCacheSizeLimit(bytes); 734 SkGlyphCache_Globals::GetTLS().setCacheSizeLimit(bytes);
734 } 735 }
735 } 736 }
OLDNEW
« no previous file with comments | « src/core/SkDrawable.cpp ('k') | src/core/SkGlyphCache_Globals.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698