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: AnotherPatchSet Created 6 years, 6 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
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
11 #define SkPDFStream_DEFINED 11 #define SkPDFStream_DEFINED
12 12
13 #include "SkPDFTypes.h" 13 #include "SkPDFTypes.h"
14 #include "SkRefCnt.h" 14 #include "SkRefCnt.h"
15 #include "SkStream.h" 15 #include "SkStream.h"
16 #include "SkTemplates.h" 16 #include "SkTemplates.h"
17 17
18 class SkPDFCatalog; 18 class SkPDFCatalog;
19 19
20 /** \class SkPDFStream 20 /** \class SkPDFStream
21 21
22 A stream object in a PDF. Note, all streams must be indirect objects (via 22 A stream object in a PDF. Note, all streams must be indirect objects (via
23 SkObjRef). 23 SkObjRef).
24 TODO(vandebo): SkStream should be replaced by SkStreamRewindable when that 24 TODO(vandebo): SkStream should be replaced by SkStreamRewindable when that
25 is feasible. 25 is feasible.
26 */ 26 */
27 class SkPDFStream : public SkPDFDict { 27 class SkPDFStream : public SkPDFDict {
mtklein 2014/06/26 13:21:59 Now that there's a mutex involved, we need to docu
hal.canary 2014/06/26 18:42:02 nothing is const. I note that the emitObject and
28 SK_DECLARE_INST_COUNT(SkPDFStream) 28 SK_DECLARE_INST_COUNT(SkPDFStream)
29 public: 29 public:
30 /** Create a PDF stream. A Length entry is automatically added to the 30 /** Create a PDF stream. A Length entry is automatically added to the
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);
(...skipping 29 matching lines...) Expand all
67 fSubstitute.reset(stream); 67 fSubstitute.reset(stream);
68 } 68 }
69 69
70 SkPDFStream* getSubstitute() { 70 SkPDFStream* getSubstitute() {
71 return fSubstitute.get(); 71 return fSubstitute.get();
72 } 72 }
73 73
74 void setData(SkData* data); 74 void setData(SkData* data);
75 void setData(SkStream* stream); 75 void setData(SkStream* stream);
76 76
77 SkStream* getData() { 77 size_t dataSize();
78 return fData.get(); 78
79 } 79 SkData* getData() { return fData.get(); }
80 80
81 void setState(State state) { 81 void setState(State state) {
82 fState = state; 82 fState = state;
83 } 83 }
84 84
85 State getState() { 85 State getState() {
86 return fState; 86 return fState;
87 } 87 }
88 88
89 private: 89 private:
90 // Indicates what form (or if) the stream has been requested. 90 // Indicates what form (or if) the stream has been requested.
91 State fState; 91 State fState;
92 92
93 // TODO(vandebo): Use SkData (after removing deprecated constructor). 93 SkMutex fMutex;
mtklein 2014/06/26 13:21:59 It's nice to note which fields this guards. // Gu
hal.canary 2014/06/26 18:42:02 Done.
94 SkAutoTUnref<SkStream> fData; 94
95 SkAutoTUnref<SkData> fData;
95 SkAutoTUnref<SkPDFStream> fSubstitute; 96 SkAutoTUnref<SkPDFStream> fSubstitute;
96 97
97 typedef SkPDFDict INHERITED; 98 typedef SkPDFDict INHERITED;
98 }; 99 };
99 100
100 #endif 101 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698