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

Side by Side Diff: experimental/PdfViewer/pdfparser/native/SkPdfNativeDoc.cpp

Issue 26700002: remove tracking code, as it polutes the code readability. Should be added back, in a less eficient … (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 2 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
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkPdfNativeDoc.h" 8 #include "SkPdfNativeDoc.h"
9 #include "SkPdfNativeTokenizer.h" 9 #include "SkPdfNativeTokenizer.h"
10 #include "SkPdfNativeObject.h" 10 #include "SkPdfNativeObject.h"
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 // and resolve references?... or not ... 168 // and resolve references?... or not ...
169 } 169 }
170 170
171 void SkPdfNativeDoc::loadWithoutXRef() { 171 void SkPdfNativeDoc::loadWithoutXRef() {
172 const unsigned char* current = fFileContent; 172 const unsigned char* current = fFileContent;
173 const unsigned char* end = fFileContent + fContentLength; 173 const unsigned char* end = fFileContent + fContentLength;
174 174
175 // TODO(edisonn): read pdf version 175 // TODO(edisonn): read pdf version
176 current = ignoreLine(current, end); 176 current = ignoreLine(current, end);
177 177
178 current = skipPdfWhiteSpaces(0, current, end); 178 current = skipPdfWhiteSpaces(current, end);
179 while (current < end) { 179 while (current < end) {
180 SkPdfNativeObject token; 180 SkPdfNativeObject token;
181 current = nextObject(0, current, end, &token, NULL, NULL PUT_TRACK_STREA M_ARGS_EXPL2(0, fFileContent)); 181 current = nextObject(current, end, &token, NULL, NULL);
182 if (token.isInteger()) { 182 if (token.isInteger()) {
183 int id = (int)token.intValue(); 183 int id = (int)token.intValue();
184 184
185 token.reset(); 185 token.reset();
186 current = nextObject(0, current, end, &token, NULL, NULL PUT_TRACK_S TREAM_ARGS_EXPL2(0, fFileContent)); 186 current = nextObject(current, end, &token, NULL, NULL);
187 // int generation = (int)token.intValue(); // TODO(edisonn): ignore d for now 187 // int generation = (int)token.intValue(); // TODO(edisonn): ignore d for now
188 188
189 token.reset(); 189 token.reset();
190 current = nextObject(0, current, end, &token, NULL, NULL PUT_TRACK_S TREAM_ARGS_EXPL2(0, fFileContent)); 190 current = nextObject(current, end, &token, NULL, NULL);
191 // TODO(edisonn): must be obj, return error if not? ignore ? 191 // TODO(edisonn): must be obj, return error if not? ignore ?
192 if (!token.isKeyword("obj")) { 192 if (!token.isKeyword("obj")) {
193 SkPdfReport(kWarning_SkPdfIssueSeverity, kMissingToken_SkPdfIssu e, "Could not find obj", NULL, NULL); 193 SkPdfReport(kWarning_SkPdfIssueSeverity, kMissingToken_SkPdfIssu e, "Could not find obj", NULL, NULL);
194 continue; 194 continue;
195 } 195 }
196 196
197 while (fObjects.count() < id + 1) { 197 while (fObjects.count() < id + 1) {
198 reset(fObjects.append()); 198 reset(fObjects.append());
199 } 199 }
200 200
201 fObjects[id].fOffset = current - fFileContent; 201 fObjects[id].fOffset = current - fFileContent;
202 202
203 SkPdfNativeObject* obj = fAllocator->allocObject(); 203 SkPdfNativeObject* obj = fAllocator->allocObject();
204 current = nextObject(0, current, end, obj, fAllocator, this PUT_TRAC K_STREAM_ARGS_EXPL2(0, fFileContent)); 204 current = nextObject(current, end, obj, fAllocator, this);
205 205
206 fObjects[id].fResolvedReference = obj; 206 fObjects[id].fResolvedReference = obj;
207 fObjects[id].fObj = obj; 207 fObjects[id].fObj = obj;
208 fObjects[id].fIsReferenceResolved = true; 208 fObjects[id].fIsReferenceResolved = true;
209 209
210 210
211 // set objects 211 // set objects
212 } else if (token.isKeyword("trailer")) { 212 } else if (token.isKeyword("trailer")) {
213 long dummy; 213 long dummy;
214 current = readTrailer(current, end, true, &dummy, true); 214 current = readTrailer(current, end, true, &dummy, true);
215 } else if (token.isKeyword("startxref")) { 215 } else if (token.isKeyword("startxref")) {
216 token.reset(); 216 token.reset();
217 current = nextObject(0, current, end, &token, NULL, NULL PUT_TRACK_S TREAM_ARGS_EXPL2(0, fFileContent)); // ignore 217 current = nextObject(current, end, &token, NULL, NULL); // ignore
218 } 218 }
219 219
220 current = skipPdfWhiteSpaces(0, current, end); 220 current = skipPdfWhiteSpaces(current, end);
221 } 221 }
222 222
223 // TODO(edisonn): hack, detect root catalog - we need to implement liniarize d support, and remove this hack. 223 // TODO(edisonn): hack, detect root catalog - we need to implement liniarize d support, and remove this hack.
224 if (!fRootCatalogRef) { 224 if (!fRootCatalogRef) {
225 for (unsigned int i = 0 ; i < objects(); i++) { 225 for (unsigned int i = 0 ; i < objects(); i++) {
226 SkPdfNativeObject* obj = object(i); 226 SkPdfNativeObject* obj = object(i);
227 SkPdfNativeObject* root = (obj && obj->isDictionary()) ? obj->get("R oot") : NULL; 227 SkPdfNativeObject* root = (obj && obj->isDictionary()) ? obj->get("R oot") : NULL;
228 if (root && root->isReference()) { 228 if (root && root->isReference()) {
229 fRootCatalogRef = root; 229 fRootCatalogRef = root;
230 } 230 }
(...skipping 14 matching lines...) Expand all
245 } 245 }
246 246
247 // TODO(edisonn): NYI 247 // TODO(edisonn): NYI
248 SkPdfNativeDoc::~SkPdfNativeDoc() { 248 SkPdfNativeDoc::~SkPdfNativeDoc() {
249 sk_free((void*)fFileContent); 249 sk_free((void*)fFileContent);
250 delete fAllocator; 250 delete fAllocator;
251 } 251 }
252 252
253 const unsigned char* SkPdfNativeDoc::readCrossReferenceSection(const unsigned ch ar* xrefStart, const unsigned char* trailerEnd) { 253 const unsigned char* SkPdfNativeDoc::readCrossReferenceSection(const unsigned ch ar* xrefStart, const unsigned char* trailerEnd) {
254 SkPdfNativeObject xref; 254 SkPdfNativeObject xref;
255 const unsigned char* current = nextObject(0, xrefStart, trailerEnd, &xref, N ULL, NULL PUT_TRACK_STREAM_ARGS_EXPL2(0, fFileContent)); 255 const unsigned char* current = nextObject(xrefStart, trailerEnd, &xref, NULL , NULL);
256 256
257 if (!xref.isKeyword("xref")) { 257 if (!xref.isKeyword("xref")) {
258 SkPdfReport(kWarning_SkPdfIssueSeverity, kMissingToken_SkPdfIssue, "Coul d not find sref", NULL, NULL); 258 SkPdfReport(kWarning_SkPdfIssueSeverity, kMissingToken_SkPdfIssue, "Coul d not find sref", NULL, NULL);
259 return trailerEnd; 259 return trailerEnd;
260 } 260 }
261 261
262 SkPdfNativeObject token; 262 SkPdfNativeObject token;
263 while (current < trailerEnd) { 263 while (current < trailerEnd) {
264 token.reset(); 264 token.reset();
265 const unsigned char* previous = current; 265 const unsigned char* previous = current;
266 current = nextObject(0, current, trailerEnd, &token, NULL, NULL PUT_TRAC K_STREAM_ARGS_EXPL2(0, fFileContent)); 266 current = nextObject(current, trailerEnd, &token, NULL, NULL);
267 if (!token.isInteger()) { 267 if (!token.isInteger()) {
268 SkPdfReport(kInfo_SkPdfIssueSeverity, kNoIssue_SkPdfIssue, "Done rea dCrossReferenceSection", NULL, NULL); 268 SkPdfReport(kInfo_SkPdfIssueSeverity, kNoIssue_SkPdfIssue, "Done rea dCrossReferenceSection", NULL, NULL);
269 return previous; 269 return previous;
270 } 270 }
271 271
272 int startId = (int)token.intValue(); 272 int startId = (int)token.intValue();
273 token.reset(); 273 token.reset();
274 current = nextObject(0, current, trailerEnd, &token, NULL, NULL PUT_TRAC K_STREAM_ARGS_EXPL2(0, fFileContent)); 274 current = nextObject(current, trailerEnd, &token, NULL, NULL);
275 275
276 if (!token.isInteger()) { 276 if (!token.isInteger()) {
277 SkPdfReportUnexpectedType(kIgnoreError_SkPdfIssueSeverity, "readCros sReferenceSection", &token, SkPdfNativeObject::kInteger_PdfObjectType, NULL); 277 SkPdfReportUnexpectedType(kIgnoreError_SkPdfIssueSeverity, "readCros sReferenceSection", &token, SkPdfNativeObject::kInteger_PdfObjectType, NULL);
278 return current; 278 return current;
279 } 279 }
280 280
281 int entries = (int)token.intValue(); 281 int entries = (int)token.intValue();
282 282
283 for (int i = 0; i < entries; i++) { 283 for (int i = 0; i < entries; i++) {
284 token.reset(); 284 token.reset();
285 current = nextObject(0, current, trailerEnd, &token, NULL, NULL PUT_ TRACK_STREAM_ARGS_EXPL2(0, fFileContent)); 285 current = nextObject(current, trailerEnd, &token, NULL, NULL);
286 if (!token.isInteger()) { 286 if (!token.isInteger()) {
287 SkPdfReportUnexpectedType(kIgnoreError_SkPdfIssueSeverity, "read CrossReferenceSection", &token, SkPdfNativeObject::kInteger_PdfObjectType, NULL) ; 287 SkPdfReportUnexpectedType(kIgnoreError_SkPdfIssueSeverity, "read CrossReferenceSection", &token, SkPdfNativeObject::kInteger_PdfObjectType, NULL) ;
288 return current; 288 return current;
289 } 289 }
290 int offset = (int)token.intValue(); 290 int offset = (int)token.intValue();
291 291
292 token.reset(); 292 token.reset();
293 current = nextObject(0, current, trailerEnd, &token, NULL, NULL PUT_ TRACK_STREAM_ARGS_EXPL2(0, fFileContent)); 293 current = nextObject(current, trailerEnd, &token, NULL, NULL);
294 if (!token.isInteger()) { 294 if (!token.isInteger()) {
295 SkPdfReportUnexpectedType(kIgnoreError_SkPdfIssueSeverity, "read CrossReferenceSection", &token, SkPdfNativeObject::kInteger_PdfObjectType, NULL) ; 295 SkPdfReportUnexpectedType(kIgnoreError_SkPdfIssueSeverity, "read CrossReferenceSection", &token, SkPdfNativeObject::kInteger_PdfObjectType, NULL) ;
296 return current; 296 return current;
297 } 297 }
298 int generation = (int)token.intValue(); 298 int generation = (int)token.intValue();
299 299
300 token.reset(); 300 token.reset();
301 current = nextObject(0, current, trailerEnd, &token, NULL, NULL PUT_ TRACK_STREAM_ARGS_EXPL2(0, fFileContent)); 301 current = nextObject(current, trailerEnd, &token, NULL, NULL);
302 if (!token.isKeyword() || token.lenstr() != 1 || (*token.c_str() != 'f' && *token.c_str() != 'n')) { 302 if (!token.isKeyword() || token.lenstr() != 1 || (*token.c_str() != 'f' && *token.c_str() != 'n')) {
303 SkPdfReportUnexpectedType(kIgnoreError_SkPdfIssueSeverity, "read CrossReferenceSection: f or n expected", &token, SkPdfNativeObject::kKeyword_Pdf ObjectType, NULL); 303 SkPdfReportUnexpectedType(kIgnoreError_SkPdfIssueSeverity, "read CrossReferenceSection: f or n expected", &token, SkPdfNativeObject::kKeyword_Pdf ObjectType, NULL);
304 return current; 304 return current;
305 } 305 }
306 306
307 addCrossSectionInfo(startId + i, generation, offset, *token.c_str() == 'f'); 307 addCrossSectionInfo(startId + i, generation, offset, *token.c_str() == 'f');
308 } 308 }
309 } 309 }
310 SkPdfReport(kInfo_SkPdfIssueSeverity, kNoIssue_SkPdfIssue, "Unexpected end o f readCrossReferenceSection", NULL, NULL); 310 SkPdfReport(kInfo_SkPdfIssueSeverity, kNoIssue_SkPdfIssue, "Unexpected end o f readCrossReferenceSection", NULL, NULL);
311 return current; 311 return current;
312 } 312 }
313 313
314 const unsigned char* SkPdfNativeDoc::readTrailer(const unsigned char* trailerSta rt, const unsigned char* trailerEnd, bool storeCatalog, long* prev, bool skipKey word) { 314 const unsigned char* SkPdfNativeDoc::readTrailer(const unsigned char* trailerSta rt, const unsigned char* trailerEnd, bool storeCatalog, long* prev, bool skipKey word) {
315 *prev = -1; 315 *prev = -1;
316 316
317 const unsigned char* current = trailerStart; 317 const unsigned char* current = trailerStart;
318 if (!skipKeyword) { 318 if (!skipKeyword) {
319 SkPdfNativeObject trailerKeyword; 319 SkPdfNativeObject trailerKeyword;
320 // TODO(edisonn): use null allocator, and let it just fail if memory 320 // TODO(edisonn): use null allocator, and let it just fail if memory
321 // needs allocated (but no crash)! 321 // needs allocated (but no crash)!
322 current = nextObject(0, current, trailerEnd, &trailerKeyword, NULL, NULL PUT_TRACK_STREAM_ARGS_EXPL2(0, fFileContent)); 322 current = nextObject(current, trailerEnd, &trailerKeyword, NULL, NULL);
323 323
324 if (!trailerKeyword.isKeyword() || strlen("trailer") != trailerKeyword.l enstr() || 324 if (!trailerKeyword.isKeyword() || strlen("trailer") != trailerKeyword.l enstr() ||
325 strncmp(trailerKeyword.c_str(), "trailer", strlen("trailer")) != 0) { 325 strncmp(trailerKeyword.c_str(), "trailer", strlen("trailer")) != 0) {
326 // TODO(edisonn): report warning, rebuild trailer from objects. 326 // TODO(edisonn): report warning, rebuild trailer from objects.
327 SkPdfReportUnexpectedType(kIgnoreError_SkPdfIssueSeverity, "readTrai ler: trailer keyword expected", &trailerKeyword, SkPdfNativeObject::kKeyword_Pdf ObjectType, NULL); 327 SkPdfReportUnexpectedType(kIgnoreError_SkPdfIssueSeverity, "readTrai ler: trailer keyword expected", &trailerKeyword, SkPdfNativeObject::kKeyword_Pdf ObjectType, NULL);
328 return current; 328 return current;
329 } 329 }
330 } 330 }
331 331
332 SkPdfNativeObject token; 332 SkPdfNativeObject token;
333 current = nextObject(0, current, trailerEnd, &token, fAllocator, NULL PUT_TR ACK_STREAM_ARGS_EXPL2(0, fFileContent)); 333 current = nextObject(current, trailerEnd, &token, fAllocator, NULL);
334 if (!token.isDictionary()) { 334 if (!token.isDictionary()) {
335 return current; 335 return current;
336 } 336 }
337 SkPdfFileTrailerDictionary* trailer = (SkPdfFileTrailerDictionary*)&token; 337 SkPdfFileTrailerDictionary* trailer = (SkPdfFileTrailerDictionary*)&token;
338 if (!trailer->valid()) { 338 if (!trailer->valid()) {
339 return current; 339 return current;
340 } 340 }
341 341
342 if (storeCatalog) { 342 if (storeCatalog) {
343 SkPdfNativeObject* ref = trailer->Root(NULL); 343 SkPdfNativeObject* ref = trailer->Root(NULL);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 const unsigned char* current = fFileContent + startOffset; 378 const unsigned char* current = fFileContent + startOffset;
379 const unsigned char* end = fFileContent + fContentLength; 379 const unsigned char* end = fFileContent + fContentLength;
380 380
381 SkPdfNativeTokenizer tokenizer(current, end - current, fAllocator, this); 381 SkPdfNativeTokenizer tokenizer(current, end - current, fAllocator, this);
382 382
383 SkPdfNativeObject idObj; 383 SkPdfNativeObject idObj;
384 SkPdfNativeObject generationObj; 384 SkPdfNativeObject generationObj;
385 SkPdfNativeObject objKeyword; 385 SkPdfNativeObject objKeyword;
386 SkPdfNativeObject* dict = fAllocator->allocObject(); 386 SkPdfNativeObject* dict = fAllocator->allocObject();
387 387
388 current = nextObject(0, current, end, &idObj, NULL, NULL PUT_TRACK_STREAM_AR GS_EXPL2(0, fFileContent)); 388 current = nextObject(current, end, &idObj, NULL, NULL);
389 if (current >= end) { 389 if (current >= end) {
390 SkPdfReport(kIgnoreError_SkPdfIssueSeverity, kReadStreamError_SkPdfIssue , "reading id", NULL, NULL); 390 SkPdfReport(kIgnoreError_SkPdfIssueSeverity, kReadStreamError_SkPdfIssue , "reading id", NULL, NULL);
391 return NULL; 391 return NULL;
392 } 392 }
393 393
394 current = nextObject(0, current, end, &generationObj, NULL, NULL PUT_TRACK_S TREAM_ARGS_EXPL2(0, fFileContent)); 394 current = nextObject(current, end, &generationObj, NULL, NULL);
395 if (current >= end) { 395 if (current >= end) {
396 SkPdfReport(kIgnoreError_SkPdfIssueSeverity, kReadStreamError_SkPdfIssue , "reading generation", NULL, NULL); 396 SkPdfReport(kIgnoreError_SkPdfIssueSeverity, kReadStreamError_SkPdfIssue , "reading generation", NULL, NULL);
397 return NULL; 397 return NULL;
398 } 398 }
399 399
400 current = nextObject(0, current, end, &objKeyword, NULL, NULL PUT_TRACK_STRE AM_ARGS_EXPL2(0, fFileContent)); 400 current = nextObject(current, end, &objKeyword, NULL, NULL);
401 if (current >= end) { 401 if (current >= end) {
402 SkPdfReport(kIgnoreError_SkPdfIssueSeverity, kReadStreamError_SkPdfIssue , "reading keyword obj", NULL, NULL); 402 SkPdfReport(kIgnoreError_SkPdfIssueSeverity, kReadStreamError_SkPdfIssue , "reading keyword obj", NULL, NULL);
403 return NULL; 403 return NULL;
404 } 404 }
405 405
406 if (!idObj.isInteger() || id != idObj.intValue()) { 406 if (!idObj.isInteger() || id != idObj.intValue()) {
407 SkPdfReportUnexpectedType(kIgnoreError_SkPdfIssueSeverity, "readObject: unexpected id", &idObj, SkPdfNativeObject::kInteger_PdfObjectType, NULL); 407 SkPdfReportUnexpectedType(kIgnoreError_SkPdfIssueSeverity, "readObject: unexpected id", &idObj, SkPdfNativeObject::kInteger_PdfObjectType, NULL);
408 } 408 }
409 409
410 // TODO(edisonn): verify that the generation is the right one 410 // TODO(edisonn): verify that the generation is the right one
411 if (!generationObj.isInteger() /* || generation != generationObj.intValue()* /) { 411 if (!generationObj.isInteger() /* || generation != generationObj.intValue()* /) {
412 SkPdfReportUnexpectedType(kIgnoreError_SkPdfIssueSeverity, "readObject: unexpected generation", &generationObj, SkPdfNativeObject::kInteger_PdfObjectTyp e, NULL); 412 SkPdfReportUnexpectedType(kIgnoreError_SkPdfIssueSeverity, "readObject: unexpected generation", &generationObj, SkPdfNativeObject::kInteger_PdfObjectTyp e, NULL);
413 } 413 }
414 414
415 if (!objKeyword.isKeyword() || strcmp(objKeyword.c_str(), "obj") != 0) { 415 if (!objKeyword.isKeyword() || strcmp(objKeyword.c_str(), "obj") != 0) {
416 SkPdfReportUnexpectedType(kIgnoreError_SkPdfIssueSeverity, "readObject: unexpected obj keyword", &objKeyword, SkPdfNativeObject::kKeyword_PdfObjectType, NULL); 416 SkPdfReportUnexpectedType(kIgnoreError_SkPdfIssueSeverity, "readObject: unexpected obj keyword", &objKeyword, SkPdfNativeObject::kKeyword_PdfObjectType, NULL);
417 } 417 }
418 418
419 current = nextObject(1, current, end, dict, fAllocator, this PUT_TRACK_STREA M_ARGS_EXPL2(0, fFileContent)); 419 current = nextObject(current, end, dict, fAllocator, this);
420 420
421 // TODO(edisonn): report warning/error - verify last token is endobj 421 // TODO(edisonn): report warning/error - verify last token is endobj
422 422
423 return dict; 423 return dict;
424 } 424 }
425 425
426 void SkPdfNativeDoc::fillPages(SkPdfPageTreeNodeDictionary* tree) { 426 void SkPdfNativeDoc::fillPages(SkPdfPageTreeNodeDictionary* tree) {
427 SkPdfArray* kids = tree->Kids(this); 427 SkPdfArray* kids = tree->Kids(this);
428 if (kids == NULL) { 428 if (kids == NULL) {
429 *fPages.append() = (SkPdfPageObjectDictionary*)tree; 429 *fPages.append() = (SkPdfPageObjectDictionary*)tree;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 517
518 return fObjects[i].fObj; 518 return fObjects[i].fObj;
519 } 519 }
520 520
521 const SkPdfMapper* SkPdfNativeDoc::mapper() const { 521 const SkPdfMapper* SkPdfNativeDoc::mapper() const {
522 return fMapper; 522 return fMapper;
523 } 523 }
524 524
525 SkPdfReal* SkPdfNativeDoc::createReal(double value) const { 525 SkPdfReal* SkPdfNativeDoc::createReal(double value) const {
526 SkPdfNativeObject* obj = fAllocator->allocObject(); 526 SkPdfNativeObject* obj = fAllocator->allocObject();
527 SkPdfNativeObject::makeReal(value, obj PUT_TRACK_PARAMETERS_SRC); 527 SkPdfNativeObject::makeReal(value, obj);
528 // TODO(edisonn): TRACK_FROM_CODE(obj);
528 return (SkPdfReal*)obj; 529 return (SkPdfReal*)obj;
529 } 530 }
530 531
531 SkPdfInteger* SkPdfNativeDoc::createInteger(int value) const { 532 SkPdfInteger* SkPdfNativeDoc::createInteger(int value) const {
532 SkPdfNativeObject* obj = fAllocator->allocObject(); 533 SkPdfNativeObject* obj = fAllocator->allocObject();
533 SkPdfNativeObject::makeInteger(value, obj PUT_TRACK_PARAMETERS_SRC); 534 SkPdfNativeObject::makeInteger(value, obj);
535 // TODO(edisonn): TRACK_FROM_CODE(obj);
534 return (SkPdfInteger*)obj; 536 return (SkPdfInteger*)obj;
535 } 537 }
536 538
537 SkPdfString* SkPdfNativeDoc::createString(const unsigned char* sz, size_t len) c onst { 539 SkPdfString* SkPdfNativeDoc::createString(const unsigned char* sz, size_t len) c onst {
538 SkPdfNativeObject* obj = fAllocator->allocObject(); 540 SkPdfNativeObject* obj = fAllocator->allocObject();
539 SkPdfNativeObject::makeString(sz, len, obj PUT_TRACK_PARAMETERS_SRC); 541 SkPdfNativeObject::makeString(sz, len, obj);
542 // TODO(edisonn): TRACK_FROM_CODE(obj);
540 return (SkPdfString*)obj; 543 return (SkPdfString*)obj;
541 } 544 }
542 545
543 SkPdfAllocator* SkPdfNativeDoc::allocator() const { 546 SkPdfAllocator* SkPdfNativeDoc::allocator() const {
544 return fAllocator; 547 return fAllocator;
545 } 548 }
546 549
547 // TODO(edisonn): fix infinite loop if ref to itself! 550 // TODO(edisonn): fix infinite loop if ref to itself!
548 // TODO(edisonn): perf, fix refs at load, and resolve will simply return fResolv edReference? 551 // TODO(edisonn): perf, fix refs at load, and resolve will simply return fResolv edReference?
549 SkPdfNativeObject* SkPdfNativeDoc::resolveReference(SkPdfNativeObject* ref) { 552 SkPdfNativeObject* SkPdfNativeDoc::resolveReference(SkPdfNativeObject* ref) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 return (SkPdfNativeObject*)ref; 599 return (SkPdfNativeObject*)ref;
597 } 600 }
598 601
599 size_t SkPdfNativeDoc::bytesUsed() const { 602 size_t SkPdfNativeDoc::bytesUsed() const {
600 return fAllocator->bytesUsed() + 603 return fAllocator->bytesUsed() +
601 fContentLength + 604 fContentLength +
602 fObjects.count() * sizeof(PublicObjectEntry) + 605 fObjects.count() * sizeof(PublicObjectEntry) +
603 fPages.count() * sizeof(SkPdfPageObjectDictionary*) + 606 fPages.count() * sizeof(SkPdfPageObjectDictionary*) +
604 sizeof(*this); 607 sizeof(*this);
605 } 608 }
OLDNEW
« no previous file with comments | « experimental/PdfViewer/pdf_viewer_main.cpp ('k') | experimental/PdfViewer/pdfparser/native/SkPdfNativeObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698