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

Unified Diff: src/pdf/SkPDFCanon.h

Issue 966863002: PDF: Canon now owns a reference to all interned objects (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-02-27 (Friday) 15:27:08 EST 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/SkPDFBitmap.cpp ('k') | src/pdf/SkPDFCanon.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pdf/SkPDFCanon.h
diff --git a/src/pdf/SkPDFCanon.h b/src/pdf/SkPDFCanon.h
index 369106ada4c2c6017b9129a01e7562ff9b691de2..d0bef27ed6ecb1ae99310fdaaca1f9557a564cb0 100644
--- a/src/pdf/SkPDFCanon.h
+++ b/src/pdf/SkPDFCanon.h
@@ -26,14 +26,18 @@ class SkPaint;
* The SkDocument_PDF class makes this happen by owning a single
* SkPDFCanon.
*
- * Note that this class does not create, delete, reference or
- * dereference the SkPDFObject objects that it indexes. It is up to
- * the caller to manage the lifetime of these objects.
+ * The addFoo() methods will ref the Foo; the canon's destructor will
+ * call foo->unref() on all of these objects.
+ *
+ * The findFoo() methods do not change the ref count of the Foo
+ * objects.
*/
class SkPDFCanon : SkNoncopyable {
public:
- SkPDFCanon();
- ~SkPDFCanon();
+ ~SkPDFCanon() { this->reset(); }
+
+ // reset to original setting, unrefs all objects.
+ void reset();
// Returns exact match if there is one. If not, it returns NULL.
// If there is no exact match, but there is a related font, we
@@ -42,36 +46,21 @@ public:
uint16_t glyphID,
SkPDFFont** relatedFont) const;
void addFont(SkPDFFont* font, uint32_t fontID, uint16_t fGlyphID);
- void removeFont(SkPDFFont*);
SkPDFFunctionShader* findFunctionShader(const SkPDFShader::State&) const;
void addFunctionShader(SkPDFFunctionShader*);
- void removeFunctionShader(SkPDFFunctionShader*);
SkPDFAlphaFunctionShader* findAlphaShader(const SkPDFShader::State&) const;
void addAlphaShader(SkPDFAlphaFunctionShader*);
- void removeAlphaShader(SkPDFAlphaFunctionShader*);
SkPDFImageShader* findImageShader(const SkPDFShader::State&) const;
void addImageShader(SkPDFImageShader*);
- void removeImageShader(SkPDFImageShader*);
SkPDFGraphicState* findGraphicState(const SkPaint&) const;
void addGraphicState(SkPDFGraphicState*);
- void removeGraphicState(SkPDFGraphicState*);
SkPDFBitmap* findBitmap(const SkBitmap&) const;
void addBitmap(SkPDFBitmap*);
- void removeBitmap(SkPDFBitmap*);
-
- void assertEmpty() const {
- SkASSERT(fFontRecords.isEmpty());
- SkASSERT(fFunctionShaderRecords.isEmpty());
- SkASSERT(fAlphaShaderRecords.isEmpty());
- SkASSERT(fImageShaderRecords.isEmpty());
- SkASSERT(fGraphicStateRecords.isEmpty());
- SkASSERT(fBitmapRecords.isEmpty());
- }
private:
struct FontRec {
« no previous file with comments | « src/pdf/SkPDFBitmap.cpp ('k') | src/pdf/SkPDFCanon.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698