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

Unified Diff: src/pdf/SkPDFStream.h

Issue 2188623004: SkPDF: SkPDFStream takes a unique_ptr (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 5 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/SkPDFShader.cpp ('k') | src/pdf/SkPDFStream.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pdf/SkPDFStream.h
diff --git a/src/pdf/SkPDFStream.h b/src/pdf/SkPDFStream.h
index f487dd296ea5dcf60fc1393c5aeda6d32d8b212e..0cc2d4295e68fd1df4ed4d1dabfc096562acf808 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:
« no previous file with comments | « src/pdf/SkPDFShader.cpp ('k') | src/pdf/SkPDFStream.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698