diff options
author | 2016-07-27 11:12:23 -0700 | |
---|---|---|
committer | 2016-07-27 11:12:23 -0700 | |
commit | ac0e00dceca10dc7ce30c5be66001bd6960ebf5c (patch) | |
tree | 7c868c049d33e2d32f43e6793603fe7c96728bc3 /src/pdf/SkPDFStream.h | |
parent | cb571e11480e929a1fa18c47ffa2c0ee22f87afb (diff) |
SkPDF: SkPDFStream takes a unique_ptr
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2188623004
Review-Url: https://codereview.chromium.org/2188623004
Diffstat (limited to 'src/pdf/SkPDFStream.h')
-rw-r--r-- | src/pdf/SkPDFStream.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/pdf/SkPDFStream.h b/src/pdf/SkPDFStream.h index f487dd296e..0cc2d4295e 100644 --- a/src/pdf/SkPDFStream.h +++ b/src/pdf/SkPDFStream.h @@ -28,9 +28,11 @@ public: /** Create a PDF stream. A Length entry is automatically added to the * stream dictionary. - * @param stream The data part of the stream. Will not take ownership. + * @param stream The data part of the stream. */ - explicit SkPDFStream(SkStreamAsset* stream) { this->setData(stream); } + explicit SkPDFStream(std::unique_ptr<SkStreamAsset> stream) { + this->setData(std::move(stream)); + } virtual ~SkPDFStream(); @@ -47,10 +49,9 @@ protected: SkPDFStream() {} /** Only call this function once. */ - void setData(SkStreamAsset* stream); + void setData(std::unique_ptr<SkStreamAsset> stream); void setData(SkData* data) { - SkMemoryStream memoryStream(data); - this->setData(&memoryStream); + this->setData(std::unique_ptr<SkStreamAsset>(new SkMemoryStream(data))); } private: |