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

Side by Side Diff: src/pdf/SkPDFShader.cpp

Issue 419113002: Fix thread unsafe mutex initialization. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 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
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkPDFShader.h" 10 #include "SkPDFShader.h"
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 SkNEW_ARGS(State, (shader, matrix, surfaceBBox))); 657 SkNEW_ARGS(State, (shader, matrix, surfaceBBox)));
658 } 658 }
659 659
660 // static 660 // static
661 SkTDArray<SkPDFShader::ShaderCanonicalEntry>& SkPDFShader::CanonicalShaders() { 661 SkTDArray<SkPDFShader::ShaderCanonicalEntry>& SkPDFShader::CanonicalShaders() {
662 SkPDFShader::CanonicalShadersMutex().assertHeld(); 662 SkPDFShader::CanonicalShadersMutex().assertHeld();
663 static SkTDArray<ShaderCanonicalEntry> gCanonicalShaders; 663 static SkTDArray<ShaderCanonicalEntry> gCanonicalShaders;
664 return gCanonicalShaders; 664 return gCanonicalShaders;
665 } 665 }
666 666
667 SK_DECLARE_STATIC_MUTEX(gCanonicalShadersMutex);
667 // static 668 // static
668 SkBaseMutex& SkPDFShader::CanonicalShadersMutex() { 669 SkBaseMutex& SkPDFShader::CanonicalShadersMutex() {
669 SK_DECLARE_STATIC_MUTEX(gCanonicalShadersMutex);
670 return gCanonicalShadersMutex; 670 return gCanonicalShadersMutex;
671 } 671 }
672 672
673 // static 673 // static
674 SkPDFObject* SkPDFFunctionShader::RangeObject() { 674 SkPDFObject* SkPDFFunctionShader::RangeObject() {
675 SkPDFShader::CanonicalShadersMutex().assertHeld(); 675 SkPDFShader::CanonicalShadersMutex().assertHeld();
676 static SkPDFArray* range = NULL; 676 static SkPDFArray* range = NULL;
677 // This method is only used with CanonicalShadersMutex, so it's safe to 677 // This method is only used with CanonicalShadersMutex, so it's safe to
678 // populate domain. 678 // populate domain.
679 if (range == NULL) { 679 if (range == NULL) {
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after
1337 return false; 1337 return false;
1338 } 1338 }
1339 1339
1340 void SkPDFShader::State::AllocateGradientInfoStorage() { 1340 void SkPDFShader::State::AllocateGradientInfoStorage() {
1341 fColorData.set(sk_malloc_throw( 1341 fColorData.set(sk_malloc_throw(
1342 fInfo.fColorCount * (sizeof(SkColor) + sizeof(SkScalar)))); 1342 fInfo.fColorCount * (sizeof(SkColor) + sizeof(SkScalar))));
1343 fInfo.fColors = reinterpret_cast<SkColor*>(fColorData.get()); 1343 fInfo.fColors = reinterpret_cast<SkColor*>(fColorData.get());
1344 fInfo.fColorOffsets = 1344 fInfo.fColorOffsets =
1345 reinterpret_cast<SkScalar*>(fInfo.fColors + fInfo.fColorCount); 1345 reinterpret_cast<SkScalar*>(fInfo.fColors + fInfo.fColorCount);
1346 } 1346 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698