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

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

Issue 348113002: Use SkMutex::assertHeld in SkPDFFont and SkPDFShader. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: AnotherPatchSet Created 6 years, 6 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 | « no previous file | src/pdf/SkPDFShader.cpp » ('j') | 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 2011 Google Inc. 2 * Copyright 2011 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 <ctype.h> 8 #include <ctype.h>
9 9
10 #include "SkData.h" 10 #include "SkData.h"
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 CanonicalFonts().push(newEntry); 865 CanonicalFonts().push(newEntry);
866 return font; // Return the reference new SkPDFFont() created. 866 return font; // Return the reference new SkPDFFont() created.
867 } 867 }
868 868
869 SkPDFFont* SkPDFFont::getFontSubset(const SkPDFGlyphSet*) { 869 SkPDFFont* SkPDFFont::getFontSubset(const SkPDFGlyphSet*) {
870 return NULL; // Default: no support. 870 return NULL; // Default: no support.
871 } 871 }
872 872
873 // static 873 // static
874 SkTDArray<SkPDFFont::FontRec>& SkPDFFont::CanonicalFonts() { 874 SkTDArray<SkPDFFont::FontRec>& SkPDFFont::CanonicalFonts() {
875 // This initialization is only thread safe with gcc. 875 SkPDFFont::CanonicalFontsMutex().assertHeld();
876 static SkTDArray<FontRec> gCanonicalFonts; 876 static SkTDArray<FontRec> gCanonicalFonts;
877 return gCanonicalFonts; 877 return gCanonicalFonts;
878 } 878 }
879 879
880 // static 880 // static
881 SkBaseMutex& SkPDFFont::CanonicalFontsMutex() { 881 SkBaseMutex& SkPDFFont::CanonicalFontsMutex() {
882 // This initialization is only thread safe with gcc, or when
883 // POD-style mutex initialization is used.
884 SK_DECLARE_STATIC_MUTEX(gCanonicalFontsMutex); 882 SK_DECLARE_STATIC_MUTEX(gCanonicalFontsMutex);
885 return gCanonicalFontsMutex; 883 return gCanonicalFontsMutex;
886 } 884 }
887 885
888 // static 886 // static
889 bool SkPDFFont::Find(uint32_t fontID, uint16_t glyphID, int* index) { 887 bool SkPDFFont::Find(uint32_t fontID, uint16_t glyphID, int* index) {
890 // TODO(vandebo): Optimize this, do only one search? 888 // TODO(vandebo): Optimize this, do only one search?
891 FontRec search(NULL, fontID, glyphID); 889 FontRec search(NULL, fontID, glyphID);
892 *index = CanonicalFonts().find(search); 890 *index = CanonicalFonts().find(search);
893 if (*index >= 0) { 891 if (*index >= 0) {
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
1475 1473
1476 insert("FontBBox", makeFontBBox(bbox, 1000))->unref(); 1474 insert("FontBBox", makeFontBBox(bbox, 1000))->unref();
1477 insertInt("FirstChar", 1); 1475 insertInt("FirstChar", 1);
1478 insertInt("LastChar", lastGlyphID() - firstGlyphID() + 1); 1476 insertInt("LastChar", lastGlyphID() - firstGlyphID() + 1);
1479 insert("Widths", widthArray.get()); 1477 insert("Widths", widthArray.get());
1480 insertName("CIDToGIDMap", "Identity"); 1478 insertName("CIDToGIDMap", "Identity");
1481 1479
1482 populateToUnicodeTable(NULL); 1480 populateToUnicodeTable(NULL);
1483 return true; 1481 return true;
1484 } 1482 }
OLDNEW
« no previous file with comments | « no previous file | src/pdf/SkPDFShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698