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

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

Issue 2249713002: just add SkLiteDL::empty() (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 4 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/SkLiteDL.h ('k') | 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 2016 Google Inc. 2 * Copyright 2016 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 "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkData.h" 9 #include "SkData.h"
10 #include "SkImageFilter.h" 10 #include "SkImageFilter.h"
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 #undef M 748 #undef M
749 749
750 void SkLiteDL::onDraw (SkCanvas* canvas) { this->map(draw_fns, canvas); } 750 void SkLiteDL::onDraw (SkCanvas* canvas) { this->map(draw_fns, canvas); }
751 void SkLiteDL::optimizeFor (GrContext* ctx) { this->map(optimize_for_fns, ct x); } 751 void SkLiteDL::optimizeFor (GrContext* ctx) { this->map(optimize_for_fns, ct x); }
752 void SkLiteDL::makeThreadsafe() { this->map(make_threadsafe_fns) ; } 752 void SkLiteDL::makeThreadsafe() { this->map(make_threadsafe_fns) ; }
753 753
754 SkRect SkLiteDL::onGetBounds() { 754 SkRect SkLiteDL::onGetBounds() {
755 return fBounds; 755 return fBounds;
756 } 756 }
757 757
758 bool SkLiteDL::empty() const {
759 return fUsed == 0;
760 }
761
758 #if !defined(SK_LITEDL_USES) 762 #if !defined(SK_LITEDL_USES)
759 #define SK_LITEDL_USES 16 763 #define SK_LITEDL_USES 16
760 #endif 764 #endif
761 765
762 SkLiteDL:: SkLiteDL() : fUsed(0), fReserved(0), fUsesRemaining(SK_LITEDL_USES) { } 766 SkLiteDL:: SkLiteDL() : fUsed(0), fReserved(0), fUsesRemaining(SK_LITEDL_USES) { }
763 SkLiteDL::~SkLiteDL() {} 767 SkLiteDL::~SkLiteDL() {}
764 768
765 // If you're tempted to make this lock free, please don't forget about ABA. 769 // If you're tempted to make this lock free, please don't forget about ABA.
766 static SkSpinlock gFreeStackLock; 770 static SkSpinlock gFreeStackLock;
767 static SkLiteDL* gFreeStack = nullptr; 771 static SkLiteDL* gFreeStack = nullptr;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 } 809 }
806 810
807 void SkLiteDL::PurgeFreelist() { 811 void SkLiteDL::PurgeFreelist() {
808 SkAutoMutexAcquire lock(gFreeStackLock); 812 SkAutoMutexAcquire lock(gFreeStackLock);
809 while (gFreeStack) { 813 while (gFreeStack) {
810 SkLiteDL* top = gFreeStack; 814 SkLiteDL* top = gFreeStack;
811 gFreeStack = gFreeStack->fNext; 815 gFreeStack = gFreeStack->fNext;
812 delete top; // Calling unref() here would just put it back on the list ! 816 delete top; // Calling unref() here would just put it back on the list !
813 } 817 }
814 } 818 }
OLDNEW
« no previous file with comments | « src/core/SkLiteDL.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698