aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pdf/SkPDFStream.h
diff options
context:
space:
mode:
authorGravatar halcanary <halcanary@google.com>2016-07-27 11:12:23 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-07-27 11:12:23 -0700
commitac0e00dceca10dc7ce30c5be66001bd6960ebf5c (patch)
tree7c868c049d33e2d32f43e6793603fe7c96728bc3 /src/pdf/SkPDFStream.h
parentcb571e11480e929a1fa18c47ffa2c0ee22f87afb (diff)
SkPDF: SkPDFStream takes a unique_ptr
Diffstat (limited to 'src/pdf/SkPDFStream.h')
-rw-r--r--src/pdf/SkPDFStream.h11
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: