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

Side by Side Diff: src/pdf/SkPDFStream.h

Issue 340783013: Switch SkPDFStream's internal storage from SkStream to SkData (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase 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 unified diff | Download patch
« no previous file with comments | « src/pdf/SkPDFPage.cpp ('k') | src/pdf/SkPDFStream.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2010 Google Inc. 3 * Copyright 2010 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #ifndef SkPDFStream_DEFINED 10 #ifndef SkPDFStream_DEFINED
(...skipping 20 matching lines...) Expand all
31 * stream dictionary. The stream may be retained (stream->ref() may be 31 * stream dictionary. The stream may be retained (stream->ref() may be
32 * called) so its contents must not be changed after calling this. 32 * called) so its contents must not be changed after calling this.
33 * @param data The data part of the stream. 33 * @param data The data part of the stream.
34 */ 34 */
35 explicit SkPDFStream(SkData* data); 35 explicit SkPDFStream(SkData* data);
36 /** Deprecated constructor. */ 36 /** Deprecated constructor. */
37 explicit SkPDFStream(SkStream* stream); 37 explicit SkPDFStream(SkStream* stream);
38 38
39 virtual ~SkPDFStream(); 39 virtual ~SkPDFStream();
40 40
41 // The SkPDFObject interface. 41 // The SkPDFObject interface. These two methods use a mutex to
42 // allow multiple threads to call at the same time.
42 virtual void emitObject(SkWStream* stream, SkPDFCatalog* catalog, 43 virtual void emitObject(SkWStream* stream, SkPDFCatalog* catalog,
43 bool indirect); 44 bool indirect);
44 virtual size_t getOutputSize(SkPDFCatalog* catalog, bool indirect); 45 virtual size_t getOutputSize(SkPDFCatalog* catalog, bool indirect);
45 46
46 protected: 47 protected:
47 enum State { 48 enum State {
48 kUnused_State, //!< The stream hasn't been requested yet. 49 kUnused_State, //!< The stream hasn't been requested yet.
49 kNoCompression_State, //!< The stream's been requested in an 50 kNoCompression_State, //!< The stream's been requested in an
50 // uncompressed form. 51 // uncompressed form.
51 kCompressed_State, //!< The stream's already been compressed. 52 kCompressed_State, //!< The stream's already been compressed.
(...skipping 10 matching lines...) Expand all
62 SkPDFStream(); 63 SkPDFStream();
63 64
64 // Populate the stream dictionary. This method returns false if 65 // Populate the stream dictionary. This method returns false if
65 // fSubstitute should be used. 66 // fSubstitute should be used.
66 virtual bool populate(SkPDFCatalog* catalog); 67 virtual bool populate(SkPDFCatalog* catalog);
67 68
68 void setSubstitute(SkPDFStream* stream) { 69 void setSubstitute(SkPDFStream* stream) {
69 fSubstitute.reset(stream); 70 fSubstitute.reset(stream);
70 } 71 }
71 72
72 SkPDFStream* getSubstitute() { 73 SkPDFStream* getSubstitute() const {
73 return fSubstitute.get(); 74 return fSubstitute.get();
74 } 75 }
75 76
76 void setData(SkData* data); 77 void setData(SkData* data);
77 void setData(SkStream* stream); 78 void setData(SkStream* stream);
78 79
79 SkStream* getData() { 80 size_t dataSize() const;
80 return fData.get(); 81
81 } 82 SkData* getData() const { return fData.get(); }
82 83
83 void setState(State state) { 84 void setState(State state) {
84 fState = state; 85 fState = state;
85 } 86 }
86 87
87 State getState() { 88 State getState() const {
88 return fState; 89 return fState;
89 } 90 }
90 91
91 private: 92 private:
92 // Indicates what form (or if) the stream has been requested. 93 // Indicates what form (or if) the stream has been requested.
93 State fState; 94 State fState;
94 95
95 // TODO(vandebo): Use SkData (after removing deprecated constructor). 96 // Mutex guards fState, fData, and fSubstitute in public interface.
96 SkAutoTUnref<SkStream> fData; 97 SkMutex fMutex;
98
99 SkAutoTUnref<SkData> fData;
97 SkAutoTUnref<SkPDFStream> fSubstitute; 100 SkAutoTUnref<SkPDFStream> fSubstitute;
98 101
99 typedef SkPDFDict INHERITED; 102 typedef SkPDFDict INHERITED;
100 }; 103 };
101 104
102 #endif 105 #endif
OLDNEW
« no previous file with comments | « src/pdf/SkPDFPage.cpp ('k') | src/pdf/SkPDFStream.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698