resubmit https://code.google.com/p/skia/source/detail?r=7883 (in the meantime we
added capability to collect minidump and callstack if buildbot fails with heap
coruption in windows, and a NPE bug was fixed in SkPDFDocument, when document was destroyed without ever beeing used and a field was NULL + a few minor conflicts have been resolved)
git-svn-id: http://skia.googlecode.com/svn/trunk@8487 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/pdf/SkPDFFormXObject.cpp b/src/pdf/SkPDFFormXObject.cpp
index c11a9a6..884e6db 100644
--- a/src/pdf/SkPDFFormXObject.cpp
+++ b/src/pdf/SkPDFFormXObject.cpp
@@ -20,12 +20,8 @@
// We don't want to keep around device because we'd have two copies
// of content, so reference or copy everything we need (content and
// resources).
- device->getResources(&fResources, false);
-
- // Fail fast if in the tree of resources a child references a parent.
- // If there is an issue, getResources will end up consuming all memory.
- // TODO: A better approach might be for all SkPDFObject to keep track
- // of possible cycles.
+ SkTSet<SkPDFObject*> emptySet;
+ device->getResources(emptySet, &fResources, false);
SkAutoTUnref<SkStream> content(device->content());
setData(content.get());
@@ -60,6 +56,10 @@
fResources.unrefAll();
}
-void SkPDFFormXObject::getResources(SkTDArray<SkPDFObject*>* resourceList) {
- GetResourcesHelper(&fResources, resourceList);
+void SkPDFFormXObject::getResources(
+ const SkTSet<SkPDFObject*>& knownResourceObjects,
+ SkTSet<SkPDFObject*>* newResourceObjects) {
+ GetResourcesHelper(&fResources.toArray(),
+ knownResourceObjects,
+ newResourceObjects);
}