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

Unified Diff: src/pdf/SkPDFStream.h

Issue 387863005: Move SkPDFStream back to SkStream to save memory. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: make compiler happy Created 6 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/core/SkStreamPriv.h ('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 3a84068e3d4aaaa3f60a68441fea70739b13a8e9..f908fbf2f3200dbf1ecb0d3b5d9d65fd72f2db49 100644
--- a/src/pdf/SkPDFStream.h
+++ b/src/pdf/SkPDFStream.h
@@ -21,19 +21,20 @@ class SkPDFCatalog;
A stream object in a PDF. Note, all streams must be indirect objects (via
SkObjRef).
- TODO(vandebo): SkStream should be replaced by SkStreamRewindable when that
- is feasible.
*/
class SkPDFStream : public SkPDFDict {
SK_DECLARE_INST_COUNT(SkPDFStream)
public:
/** Create a PDF stream. A Length entry is automatically added to the
- * stream dictionary. The stream may be retained (stream->ref() may be
- * called) so its contents must not be changed after calling this.
- * @param data The data part of the stream.
+ * stream dictionary.
+ * @param data The data part of the stream. Will be ref()ed.
*/
explicit SkPDFStream(SkData* data);
- /** Deprecated constructor. */
+
+ /** Create a PDF stream. A Length entry is automatically added to the
+ * stream dictionary.
+ * @param stream The data part of the stream. Will be duplicate()d.
+ */
explicit SkPDFStream(SkStream* stream);
virtual ~SkPDFStream();
@@ -79,8 +80,6 @@ protected:
size_t dataSize() const;
- SkData* getData() const { return fData.get(); }
-
void setState(State state) {
fState = state;
}
@@ -93,10 +92,13 @@ private:
// Indicates what form (or if) the stream has been requested.
State fState;
- // Mutex guards fState, fData, and fSubstitute in public interface.
+ // Mutex guards fState, fDataStream, and fSubstitute in public interface.
SkMutex fMutex;
- SkAutoTUnref<SkData> fData;
+ SkMemoryStream fMemoryStream; // Used by fDataStream when
+ // fDataStream needs to be backed
+ // by SkData.
+ SkAutoTUnref<SkStreamRewindable> fDataStream;
SkAutoTUnref<SkPDFStream> fSubstitute;
typedef SkPDFDict INHERITED;
« no previous file with comments | « src/core/SkStreamPriv.h ('k') | src/pdf/SkPDFStream.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698