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

Side by Side Diff: experimental/PdfViewer/pdfparser/native/SkPdfObject.h

Issue 18435007: pdf viewer: refactor and fix a bug (SkPdfobject should not reset on destruct) (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « experimental/PdfViewer/pdfparser/native/SkPdfNativeTokenizer.cpp ('k') | gyp/pdfviewer.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #ifndef EXPERIMENTAL_PDFVIEWER_PDFPARSER_NATIVE_SKPDFOBJECT_H_ 1 #ifndef EXPERIMENTAL_PDFVIEWER_PDFPARSER_NATIVE_SKPDFOBJECT_H_
2 #define EXPERIMENTAL_PDFVIEWER_PDFPARSER_NATIVE_SKPDFOBJECT_H_ 2 #define EXPERIMENTAL_PDFVIEWER_PDFPARSER_NATIVE_SKPDFOBJECT_H_
3 3
4 #include <stdint.h> 4 #include <stdint.h>
5 #include <string.h> 5 #include <string.h>
6 #include <string> 6 #include <string>
7 #include "SkTDArray.h" 7 #include "SkTDArray.h"
8 #include "SkTDict.h" 8 #include "SkTDict.h"
9 #include "SkRect.h" 9 #include "SkRect.h"
10 #include "SkMatrix.h" 10 #include "SkMatrix.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 // TODO(edisonn): make sure the foorprint of fArray and fMap is small, o therwise, use pointers, or classes with up to 8 bytes in footprint 79 // TODO(edisonn): make sure the foorprint of fArray and fMap is small, o therwise, use pointers, or classes with up to 8 bytes in footprint
80 SkTDArray<SkPdfObject*>* fArray; 80 SkTDArray<SkPdfObject*>* fArray;
81 Reference fRef; 81 Reference fRef;
82 }; 82 };
83 SkTDict<SkPdfObject*>* fMap; 83 SkTDict<SkPdfObject*>* fMap;
84 void* fData; 84 void* fData;
85 85
86 86
87 public: 87 public:
88 88
89 SkPdfObject() : fObjectType(kInvalid_PdfObjectType), fData(NULL) {} 89 SkPdfObject() : fObjectType(kInvalid_PdfObjectType), fMap(NULL), fData(NULL) {}
90 90
91 inline void* data() { 91 inline void* data() {
92 return fData; 92 return fData;
93 } 93 }
94 94
95 inline void setData(void* data) { 95 inline void setData(void* data) {
96 fData = data; 96 fData = data;
97 } 97 }
98 98
99 ~SkPdfObject() { 99 // ~SkPdfObject() {
100 reset(); 100 // //reset(); must be called manually!
101 } 101 // }
102 102
103 void reset() { 103 void reset() {
104 switch (fObjectType) { 104 switch (fObjectType) {
105 case kArray_PdfObjectType: 105 case kArray_PdfObjectType:
106 delete fArray; 106 delete fArray;
107 break; 107 break;
108 108
109 case kDictionary_PdfObjectType: 109 case kDictionary_PdfObjectType:
110 delete fMap; 110 delete fMap;
111 break; 111 break;
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after
857 857
858 class SkPdfStream : public SkPdfObject {}; 858 class SkPdfStream : public SkPdfObject {};
859 class SkPdfArray : public SkPdfObject {}; 859 class SkPdfArray : public SkPdfObject {};
860 class SkPdfString : public SkPdfObject {}; 860 class SkPdfString : public SkPdfObject {};
861 class SkPdfHexString : public SkPdfObject {}; 861 class SkPdfHexString : public SkPdfObject {};
862 class SkPdfInteger : public SkPdfObject {}; 862 class SkPdfInteger : public SkPdfObject {};
863 class SkPdfReal : public SkPdfObject {}; 863 class SkPdfReal : public SkPdfObject {};
864 class SkPdfNumber : public SkPdfObject {}; 864 class SkPdfNumber : public SkPdfObject {};
865 865
866 #endif // EXPERIMENTAL_PDFVIEWER_PDFPARSER_NATIVE_SKPDFOBJECT_H_ 866 #endif // EXPERIMENTAL_PDFVIEWER_PDFPARSER_NATIVE_SKPDFOBJECT_H_
OLDNEW
« no previous file with comments | « experimental/PdfViewer/pdfparser/native/SkPdfNativeTokenizer.cpp ('k') | gyp/pdfviewer.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698