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

Unified Diff: src/pdf/SkPDFFont.cpp

Issue 870333002: Simplify reference management in SkPDF (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: make Created 5 years, 10 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
« no previous file with comments | « src/pdf/SkPDFFont.h ('k') | src/pdf/SkPDFFormXObject.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pdf/SkPDFFont.cpp
diff --git a/src/pdf/SkPDFFont.cpp b/src/pdf/SkPDFFont.cpp
index de61326f6034172dfd3821005962e57d611a0906..3b35b56a9285ee7b011d89f3cc24493a3a71c328 100644
--- a/src/pdf/SkPDFFont.cpp
+++ b/src/pdf/SkPDFFont.cpp
@@ -746,12 +746,6 @@ SkPDFFont::~SkPDFFont() {
SkAutoMutexAcquire lock(SkPDFCanon::GetFontMutex());
SkPDFCanon::GetCanon().removeFont(this);
}
- fResources.unrefAll();
-}
-
-void SkPDFFont::getResources(const SkTSet<SkPDFObject*>& knownResourceObjects,
- SkTSet<SkPDFObject*>* newResourceObjects) {
- GetResourcesHelper(&fResources, knownResourceObjects, newResourceObjects);
}
SkTypeface* SkPDFFont::typeface() {
@@ -940,12 +934,6 @@ void SkPDFFont::setLastGlyphID(uint16_t glyphID) {
fLastGlyphID = glyphID;
}
-void SkPDFFont::addResource(SkPDFObject* object) {
- SkASSERT(object != NULL);
- fResources.push(object);
- object->ref();
-}
-
SkPDFDict* SkPDFFont::getFontDescriptor() {
return fDescriptor.get();
}
@@ -1000,7 +988,6 @@ void SkPDFFont::populateToUnicodeTable(const SkPDFGlyphSet* subset) {
generate_tounicode_cmap(fFontInfo->fGlyphToUnicode, subset,
multiByteGlyphs(), firstGlyphID(),
lastGlyphID()));
- addResource(pdfCmap.get());
insert("ToUnicode", new SkPDFObjRef(pdfCmap.get()))->unref();
}
@@ -1042,7 +1029,6 @@ bool SkPDFType0Font::populate(const SkPDFGlyphSet* subset) {
SkAutoTUnref<SkPDFCIDFont> newCIDFont(
new SkPDFCIDFont(fontInfo(), typeface(), subset));
- addResource(newCIDFont.get());
SkAutoTUnref<SkPDFArray> descendantFonts(new SkPDFArray());
descendantFonts->append(new SkPDFObjRef(newCIDFont.get()))->unref();
insert("DescendantFonts", descendantFonts.get());
@@ -1069,7 +1055,6 @@ bool SkPDFCIDFont::addFontDescriptor(int16_t defaultWidth,
const SkTDArray<uint32_t>* subset) {
SkAutoTUnref<SkPDFDict> descriptor(new SkPDFDict("FontDescriptor"));
setFontDescriptor(descriptor.get());
- addResource(descriptor.get());
insert("FontDescriptor", new SkPDFObjRef(descriptor.get()))->unref();
if (!addCommonFontDescriptorEntries(defaultWidth)) {
return false;
@@ -1098,7 +1083,6 @@ bool SkPDFCIDFont::addFontDescriptor(int16_t defaultWidth,
}
SkASSERT(fontSize);
SkASSERT(fontStream.get());
- addResource(fontStream.get());
fontStream->insertInt("Length1", fontSize);
descriptor->insert("FontFile2",
@@ -1111,7 +1095,6 @@ bool SkPDFCIDFont::addFontDescriptor(int16_t defaultWidth,
SkAutoTDelete<SkStream> fontData(typeface()->openStream(&ttcIndex));
SkAutoTUnref<SkPDFStream> fontStream(
new SkPDFStream(fontData.get()));
- addResource(fontStream.get());
if (getType() == SkAdvancedTypefaceMetrics::kCFF_Font) {
fontStream->insertName("Subtype", "Type1C");
@@ -1226,7 +1209,6 @@ SkPDFType1Font::~SkPDFType1Font() {}
bool SkPDFType1Font::addFontDescriptor(int16_t defaultWidth) {
if (getFontDescriptor() != NULL) {
SkPDFDict* descriptor = getFontDescriptor();
- addResource(descriptor);
insert("FontDescriptor", new SkPDFObjRef(descriptor))->unref();
return true;
}
@@ -1246,7 +1228,6 @@ bool SkPDFType1Font::addFontDescriptor(int16_t defaultWidth) {
}
if (canEmbed()) {
SkAutoTUnref<SkPDFStream> fontStream(new SkPDFStream(fontData.get()));
- addResource(fontStream.get());
fontStream->insertInt("Length1", header);
fontStream->insertInt("Length2", data);
fontStream->insertInt("Length3", trailer);
@@ -1254,7 +1235,6 @@ bool SkPDFType1Font::addFontDescriptor(int16_t defaultWidth) {
new SkPDFObjRef(fontStream.get()))->unref();
}
- addResource(descriptor.get());
insert("FontDescriptor", new SkPDFObjRef(descriptor.get()))->unref();
return addCommonFontDescriptorEntries(defaultWidth);
@@ -1410,7 +1390,6 @@ bool SkPDFType3Font::populate(uint16_t glyphID) {
SkAutoTUnref<SkPDFStream> glyphDescription(
new SkPDFStream(glyphStream.get()));
- addResource(glyphDescription.get());
charProcs->insert(characterName.c_str(),
new SkPDFObjRef(glyphDescription.get()))->unref();
}
« no previous file with comments | « src/pdf/SkPDFFont.h ('k') | src/pdf/SkPDFFormXObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698