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

Unified Diff: src/core/SkTextBlob.cpp

Issue 1036613002: simple patch to always init SkTextBlob uniqueID (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« include/core/SkTextBlob.h ('K') | « include/core/SkTextBlob.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkTextBlob.cpp
diff --git a/src/core/SkTextBlob.cpp b/src/core/SkTextBlob.cpp
index bf620328d61a94eb2a4cc569f9b1e8a9396bc871..2cc39cce966d7a5741f40f7b085a168c85be8ef3 100644
--- a/src/core/SkTextBlob.cpp
+++ b/src/core/SkTextBlob.cpp
@@ -110,7 +110,14 @@ private:
SkTextBlob::SkTextBlob(int runCount, const SkRect& bounds)
: fRunCount(runCount)
- , fBounds(bounds) {
+ , fBounds(bounds)
+ , fUniqueID(SK_InvalidGenID) {
mtklein 2015/03/24 20:45:08 let's do static int32_t gNextID = 1; static int32
+ static int32_t gTextBlobGenerationID; // = 0;
+
+ // loop in case our global wraps around, as we never want SK_InvalidGenID uniqueID
+ while (SK_InvalidGenID == fUniqueID) {
+ fUniqueID = sk_atomic_inc(&gTextBlobGenerationID) + 1;
+ }
}
SkTextBlob::~SkTextBlob() {
@@ -123,17 +130,6 @@ SkTextBlob::~SkTextBlob() {
}
}
-uint32_t SkTextBlob::uniqueID() const {
- static int32_t gTextBlobGenerationID; // = 0;
-
- // loop in case our global wraps around, as we never want to return SK_InvalidGenID
- while (SK_InvalidGenID == fUniqueID) {
- fUniqueID = sk_atomic_inc(&gTextBlobGenerationID) + 1;
- }
-
- return fUniqueID;
-}
-
void SkTextBlob::flatten(SkWriteBuffer& buffer) const {
int runCount = fRunCount;
« include/core/SkTextBlob.h ('K') | « include/core/SkTextBlob.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698