pdfviewer: (part 1) store the offset of the location of object in file/stream. In order to use the feature, enable the macro defined in SkPdfConfig.h

Review URL: https://codereview.chromium.org/23456022

git-svn-id: http://skia.googlecode.com/svn/trunk@11117 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/experimental/PdfViewer/pdfparser/native/SkPdfNativeDoc.cpp b/experimental/PdfViewer/pdfparser/native/SkPdfNativeDoc.cpp
index ebc27ad..f278ea1 100644
--- a/experimental/PdfViewer/pdfparser/native/SkPdfNativeDoc.cpp
+++ b/experimental/PdfViewer/pdfparser/native/SkPdfNativeDoc.cpp
@@ -177,16 +177,16 @@
     current = skipPdfWhiteSpaces(0, current, end);
     while (current < end) {
         SkPdfNativeObject token;
-        current = nextObject(0, current, end, &token, NULL, NULL);
+        current = nextObject(0, current, end, &token, NULL, NULL PUT_TRACK_STREAM_ARGS_EXPL2(0, fFileContent));
         if (token.isInteger()) {
             int id = (int)token.intValue();
 
             token.reset();
-            current = nextObject(0, current, end, &token, NULL, NULL);
+            current = nextObject(0, current, end, &token, NULL, NULL PUT_TRACK_STREAM_ARGS_EXPL2(0, fFileContent));
             // int generation = (int)token.intValue();  // TODO(edisonn): ignored for now
 
             token.reset();
-            current = nextObject(0, current, end, &token, NULL, NULL);
+            current = nextObject(0, current, end, &token, NULL, NULL PUT_TRACK_STREAM_ARGS_EXPL2(0, fFileContent));
             // TODO(edisonn): must be obj, return error if not? ignore ?
             if (!token.isKeyword("obj")) {
                 continue;
@@ -199,7 +199,7 @@
             fObjects[id].fOffset = current - fFileContent;
 
             SkPdfNativeObject* obj = fAllocator->allocObject();
-            current = nextObject(0, current, end, obj, fAllocator, this);
+            current = nextObject(0, current, end, obj, fAllocator, this PUT_TRACK_STREAM_ARGS_EXPL2(0, fFileContent));
 
             fObjects[id].fResolvedReference = obj;
             fObjects[id].fObj = obj;
@@ -210,7 +210,7 @@
             current = readTrailer(current, end, true, &dummy, true);
         } else if (token.isKeyword("startxref")) {
             token.reset();
-            current = nextObject(0, current, end, &token, NULL, NULL);  // ignore
+            current = nextObject(0, current, end, &token, NULL, NULL PUT_TRACK_STREAM_ARGS_EXPL2(0, fFileContent));  // ignore
         }
 
         current = skipPdfWhiteSpaces(0, current, end);
@@ -249,7 +249,7 @@
 
 const unsigned char* SkPdfNativeDoc::readCrossReferenceSection(const unsigned char* xrefStart, const unsigned char* trailerEnd) {
     SkPdfNativeObject xref;
-    const unsigned char* current = nextObject(0, xrefStart, trailerEnd, &xref, NULL, NULL);
+    const unsigned char* current = nextObject(0, xrefStart, trailerEnd, &xref, NULL, NULL PUT_TRACK_STREAM_ARGS_EXPL2(0, fFileContent));
 
     if (!xref.isKeyword("xref")) {
         return trailerEnd;
@@ -259,14 +259,14 @@
     while (current < trailerEnd) {
         token.reset();
         const unsigned char* previous = current;
-        current = nextObject(0, current, trailerEnd, &token, NULL, NULL);
+        current = nextObject(0, current, trailerEnd, &token, NULL, NULL PUT_TRACK_STREAM_ARGS_EXPL2(0, fFileContent));
         if (!token.isInteger()) {
             return previous;
         }
 
         int startId = (int)token.intValue();
         token.reset();
-        current = nextObject(0, current, trailerEnd, &token, NULL, NULL);
+        current = nextObject(0, current, trailerEnd, &token, NULL, NULL PUT_TRACK_STREAM_ARGS_EXPL2(0, fFileContent));
 
         if (!token.isInteger()) {
             // TODO(edisonn): report/warning
@@ -277,7 +277,7 @@
 
         for (int i = 0; i < entries; i++) {
             token.reset();
-            current = nextObject(0, current, trailerEnd, &token, NULL, NULL);
+            current = nextObject(0, current, trailerEnd, &token, NULL, NULL PUT_TRACK_STREAM_ARGS_EXPL2(0, fFileContent));
             if (!token.isInteger()) {
                 // TODO(edisonn): report/warning
                 return current;
@@ -285,7 +285,7 @@
             int offset = (int)token.intValue();
 
             token.reset();
-            current = nextObject(0, current, trailerEnd, &token, NULL, NULL);
+            current = nextObject(0, current, trailerEnd, &token, NULL, NULL PUT_TRACK_STREAM_ARGS_EXPL2(0, fFileContent));
             if (!token.isInteger()) {
                 // TODO(edisonn): report/warning
                 return current;
@@ -293,7 +293,7 @@
             int generation = (int)token.intValue();
 
             token.reset();
-            current = nextObject(0, current, trailerEnd, &token, NULL, NULL);
+            current = nextObject(0, current, trailerEnd, &token, NULL, NULL PUT_TRACK_STREAM_ARGS_EXPL2(0, fFileContent));
             if (!token.isKeyword() || token.lenstr() != 1 || (*token.c_str() != 'f' && *token.c_str() != 'n')) {
                 // TODO(edisonn): report/warning
                 return current;
@@ -314,7 +314,7 @@
         SkPdfNativeObject trailerKeyword;
         // TODO(edisonn): use null allocator, and let it just fail if memory
         // needs allocated (but no crash)!
-        current = nextObject(0, current, trailerEnd, &trailerKeyword, NULL, NULL);
+        current = nextObject(0, current, trailerEnd, &trailerKeyword, NULL, NULL PUT_TRACK_STREAM_ARGS_EXPL2(0, fFileContent));
 
         if (!trailerKeyword.isKeyword() || strlen("trailer") != trailerKeyword.lenstr() ||
             strncmp(trailerKeyword.c_str(), "trailer", strlen("trailer")) != 0) {
@@ -324,7 +324,7 @@
     }
 
     SkPdfNativeObject token;
-    current = nextObject(0, current, trailerEnd, &token, fAllocator, NULL);
+    current = nextObject(0, current, trailerEnd, &token, fAllocator, NULL PUT_TRACK_STREAM_ARGS_EXPL2(0, fFileContent));
     if (!token.isDictionary()) {
         return current;
     }
@@ -379,19 +379,19 @@
     SkPdfNativeObject objKeyword;
     SkPdfNativeObject* dict = fAllocator->allocObject();
 
-    current = nextObject(0, current, end, &idObj, NULL, NULL);
+    current = nextObject(0, current, end, &idObj, NULL, NULL PUT_TRACK_STREAM_ARGS_EXPL2(0, fFileContent));
     if (current >= end) {
         // TODO(edisonn): report warning/error
         return NULL;
     }
 
-    current = nextObject(0, current, end, &generationObj, NULL, NULL);
+    current = nextObject(0, current, end, &generationObj, NULL, NULL PUT_TRACK_STREAM_ARGS_EXPL2(0, fFileContent));
     if (current >= end) {
         // TODO(edisonn): report warning/error
         return NULL;
     }
 
-    current = nextObject(0, current, end, &objKeyword, NULL, NULL);
+    current = nextObject(0, current, end, &objKeyword, NULL, NULL PUT_TRACK_STREAM_ARGS_EXPL2(0, fFileContent));
     if (current >= end) {
         // TODO(edisonn): report warning/error
         return NULL;
@@ -405,7 +405,7 @@
         // TODO(edisonn): report warning/error
     }
 
-    current = nextObject(1, current, end, dict, fAllocator, this);
+    current = nextObject(1, current, end, dict, fAllocator, this PUT_TRACK_STREAM_ARGS_EXPL2(0, fFileContent));
 
     // TODO(edisonn): report warning/error - verify last token is endobj
 
@@ -513,19 +513,19 @@
 
 SkPdfReal* SkPdfNativeDoc::createReal(double value) const {
     SkPdfNativeObject* obj = fAllocator->allocObject();
-    SkPdfNativeObject::makeReal(value, obj);
+    SkPdfNativeObject::makeReal(value, obj PUT_TRACK_PARAMETERS_SRC);
     return (SkPdfReal*)obj;
 }
 
 SkPdfInteger* SkPdfNativeDoc::createInteger(int value) const {
     SkPdfNativeObject* obj = fAllocator->allocObject();
-    SkPdfNativeObject::makeInteger(value, obj);
+    SkPdfNativeObject::makeInteger(value, obj PUT_TRACK_PARAMETERS_SRC);
     return (SkPdfInteger*)obj;
 }
 
 SkPdfString* SkPdfNativeDoc::createString(const unsigned char* sz, size_t len) const {
     SkPdfNativeObject* obj = fAllocator->allocObject();
-    SkPdfNativeObject::makeString(sz, len, obj);
+    SkPdfNativeObject::makeString(sz, len, obj PUT_TRACK_PARAMETERS_SRC);
     return (SkPdfString*)obj;
 }