Chromium Code Reviews| 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; |