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

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: Simpler changes 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
Index: src/pdf/SkPDFStream.h
diff --git a/src/pdf/SkPDFStream.h b/src/pdf/SkPDFStream.h
index 3a84068e3d4aaaa3f60a68441fea70739b13a8e9..02bd91bfb568b87cea1346ae92fa1e80b3cebb26 100644
--- a/src/pdf/SkPDFStream.h
+++ b/src/pdf/SkPDFStream.h
@@ -21,19 +21,16 @@ 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 stream The data part of the stream. Will be duplicate()d.
bungeman-skia 2014/07/11 21:43:38 This seems to want to go with the constructor belo
hal.canary 2014/07/12 00:58:49 Done.
+ * @param data The data part of the stream. Will be ref()ed.
*/
explicit SkPDFStream(SkData* data);
- /** Deprecated constructor. */
explicit SkPDFStream(SkStream* stream);
virtual ~SkPDFStream();
@@ -79,8 +76,6 @@ protected:
size_t dataSize() const;
- SkData* getData() const { return fData.get(); }
-
void setState(State state) {
fState = state;
}
@@ -93,10 +88,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;
« src/core/SkStream.cpp ('K') | « src/core/SkStreamPriv.h ('k') | src/pdf/SkPDFStream.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698