Use SkMutex::assertHeld in SkPDFFont and SkPDFShader.

R=mtklein@google.com

Author: halcanary@google.com

Review URL: https://codereview.chromium.org/348113002
This commit is contained in:
halcanary 2014-06-20 11:28:37 -07:00 committed by Commit bot
parent 9e64b78ff6
commit 24480bc71e
2 changed files with 3 additions and 7 deletions

View File

@ -872,15 +872,13 @@ SkPDFFont* SkPDFFont::getFontSubset(const SkPDFGlyphSet*) {
// static
SkTDArray<SkPDFFont::FontRec>& SkPDFFont::CanonicalFonts() {
// This initialization is only thread safe with gcc.
SkPDFFont::CanonicalFontsMutex().assertHeld();
static SkTDArray<FontRec> gCanonicalFonts;
return gCanonicalFonts;
}
// static
SkBaseMutex& SkPDFFont::CanonicalFontsMutex() {
// This initialization is only thread safe with gcc, or when
// POD-style mutex initialization is used.
SK_DECLARE_STATIC_MUTEX(gCanonicalFontsMutex);
return gCanonicalFontsMutex;
}

View File

@ -659,22 +659,20 @@ SkPDFObject* SkPDFShader::GetPDFShader(const SkShader& shader,
// static
SkTDArray<SkPDFShader::ShaderCanonicalEntry>& SkPDFShader::CanonicalShaders() {
// This initialization is only thread safe with gcc.
SkPDFShader::CanonicalShadersMutex().assertHeld();
static SkTDArray<ShaderCanonicalEntry> gCanonicalShaders;
return gCanonicalShaders;
}
// static
SkBaseMutex& SkPDFShader::CanonicalShadersMutex() {
// This initialization is only thread safe with gcc or when
// POD-style mutex initialization is used.
SK_DECLARE_STATIC_MUTEX(gCanonicalShadersMutex);
return gCanonicalShadersMutex;
}
// static
SkPDFObject* SkPDFFunctionShader::RangeObject() {
// This initialization is only thread safe with gcc.
SkPDFShader::CanonicalShadersMutex().assertHeld();
static SkPDFArray* range = NULL;
// This method is only used with CanonicalShadersMutex, so it's safe to
// populate domain.