From 66bedbb02dbd252f46c1fad862d0561a0bb3f94b Mon Sep 17 00:00:00 2001 From: "edisonn@google.com" Date: Tue, 19 Mar 2013 17:19:05 +0000 Subject: 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. a few minor conflicts have been resolved) Review URL: https://codereview.chromium.org/12840004 git-svn-id: http://skia.googlecode.com/svn/trunk@8233 2bbb7eff-a529-9590-31e7-b0007b416f81 --- src/pdf/SkPDFTypes.h | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) (limited to 'src/pdf/SkPDFTypes.h') diff --git a/src/pdf/SkPDFTypes.h b/src/pdf/SkPDFTypes.h index 98223aeb56..5ed6386bdd 100644 --- a/src/pdf/SkPDFTypes.h +++ b/src/pdf/SkPDFTypes.h @@ -14,6 +14,7 @@ #include "SkScalar.h" #include "SkString.h" #include "SkTDArray.h" +#include "SkTSet.h" #include "SkTypes.h" class SkPDFCatalog; @@ -38,13 +39,16 @@ public: virtual size_t getOutputSize(SkPDFCatalog* catalog, bool indirect); /** For non-primitive objects (i.e. objects defined outside this file), - * this method will add to resourceList any objects that this method - * depends on. This operates recursively so if this object depends on - * another object and that object depends on two more, all three objects - * will be added. - * @param resourceList The list to append dependant resources to. + * this method will add to newResourceObjects any objects that this method + * depends on, but not already in knownResourceObjects. This operates + * recursively so if this object depends on another object and that object + * depends on two more, all three objects will be added. + * + * @param knownResourceObjects The set of resources to be ignored. + * @param newResourceObjects The set to append dependant resources to. */ - virtual void getResources(SkTDArray* resourceList); + virtual void getResources(const SkTSet& knownResourceObjects, + SkTSet* newResourceObjects); /** Emit this object unless the catalog has a substitute object, in which * case emit that. @@ -74,10 +78,16 @@ public: /** Static helper function to copy and reference the resources (and all * their subresources) into a new list. * @param resources The resource list. - * @param result The list to add to. - */ - static void GetResourcesHelper(SkTDArray* resources, - SkTDArray* result); + * @param newResourceObjects All the resource objects (recursively) used on + * the page are added to this array. This gives + * the caller a chance to deduplicate resources + * across pages. + * @param knownResourceObjects The set of resources to be ignored. + */ + static void GetResourcesHelper( + const SkTDArray* resources, + const SkTSet& knownResourceObjects, + SkTSet* newResourceObjects); protected: /** Subclasses must implement this method to print the object to the -- cgit v1.2.3