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

Unified Diff: experimental/PdfViewer/pdfparser/native/SkPdfNativeObject.h

Issue 23258004: pdfviewer: code cleanup - remove STL usage (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 4 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: experimental/PdfViewer/pdfparser/native/SkPdfNativeObject.h
===================================================================
--- experimental/PdfViewer/pdfparser/native/SkPdfNativeObject.h (revision 10721)
+++ experimental/PdfViewer/pdfparser/native/SkPdfNativeObject.h (working copy)
@@ -3,7 +3,7 @@
#include <stdint.h>
#include <string.h>
-#include <string>
+#include "SkString.h"
#include "SkTDArray.h"
#include "SkTDict.h"
#include "SkRect.h"
@@ -59,6 +59,11 @@
};
private:
+ // TODO(edisonn): assert reset operations while in rendering!
+ uint32_t fInRendering : 1;
+ uint32_t fUnused : 31;
+
+
struct Reference {
unsigned int fId;
unsigned int fGen;
@@ -93,8 +98,11 @@
public:
- SkPdfNativeObject() : fObjectType(kInvalid_PdfObjectType), fMap(NULL), fData(NULL), fDataType(kEmpty_Data) {}
+ SkPdfNativeObject() : fInRendering(0), fObjectType(kInvalid_PdfObjectType), fMap(NULL), fData(NULL), fDataType(kEmpty_Data) {}
+ bool inRendering() const { return fInRendering != 0; }
+ void startRendering() {fInRendering = 1;}
+ void doneRendering() {fInRendering = 0;}
inline bool hasData(DataType type) {
return type == fDataType;
@@ -722,24 +730,24 @@
// TODO(edisonn): nameValue2 and stringValue2 are used to make code generation easy,
// but it is not a performat way to do it, since it will create an extra copy
// remove these functions and make code generated faster
- inline std::string nameValue2() const {
+ inline SkString nameValue2() const {
SkASSERT(fObjectType == kName_PdfObjectType);
if (fObjectType != kName_PdfObjectType) {
// TODO(edisonn): log err
- return "";
+ return SkString();
}
- return std::string((const char*)fStr.fBuffer, fStr.fBytes);
+ return SkString((const char*)fStr.fBuffer, fStr.fBytes);
}
- inline std::string stringValue2() const {
+ inline SkString stringValue2() const {
SkASSERT(fObjectType == kString_PdfObjectType || fObjectType == kHexString_PdfObjectType);
if (fObjectType != kString_PdfObjectType && fObjectType != kHexString_PdfObjectType) {
// TODO(edisonn): log err
- return "";
+ return SkString();
}
- return std::string((const char*)fStr.fBuffer, fStr.fBytes);
+ return SkString((const char*)fStr.fBuffer, fStr.fBytes);
}
inline bool boolValue() const {
« no previous file with comments | « experimental/PdfViewer/generate_code.py ('k') | experimental/PdfViewer/pdfparser/native/SkPdfNativeObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698