OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <limits.h> | 5 #include <limits.h> |
6 #include <stdio.h> | 6 #include <stdio.h> |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 #include <string.h> | 8 #include <string.h> |
9 #include <wchar.h> | 9 #include <wchar.h> |
10 | 10 |
11 #include <list> | 11 #include <list> |
12 #include <sstream> | 12 #include <sstream> |
13 #include <string> | 13 #include <string> |
14 #include <utility> | 14 #include <utility> |
15 #include <vector> | 15 #include <vector> |
16 | 16 |
17 #include "../fpdfsdk/include/fpdf_dataavail.h" | 17 #include "../fpdfsdk/include/fpdf_dataavail.h" |
18 #include "../fpdfsdk/include/fpdf_ext.h" | 18 #include "../fpdfsdk/include/fpdf_ext.h" |
19 #include "../fpdfsdk/include/fpdfformfill.h" | 19 #include "../fpdfsdk/include/fpdfformfill.h" |
20 #include "../fpdfsdk/include/fpdftext.h" | 20 #include "../fpdfsdk/include/fpdftext.h" |
21 #include "../fpdfsdk/include/fpdfview.h" | 21 #include "../fpdfsdk/include/fpdfview.h" |
22 #include "../core/include/fxcrt/fx_system.h" | 22 #include "../core/include/fxcrt/fx_system.h" |
23 #include "v8/include/v8.h" | 23 #include "v8/include/v8.h" |
| 24 #include "v8/include/libplatform/libplatform.h" |
24 | 25 |
25 #ifdef _WIN32 | 26 #ifdef _WIN32 |
26 #define snprintf _snprintf | 27 #define snprintf _snprintf |
27 #define PATH_SEPARATOR '\\' | 28 #define PATH_SEPARATOR '\\' |
28 #else | 29 #else |
29 #define PATH_SEPARATOR '/' | 30 #define PATH_SEPARATOR '/' |
30 #endif | 31 #endif |
31 | 32 |
32 enum OutputFormat { | 33 enum OutputFormat { |
33 OUTPUT_NONE, | 34 OUTPUT_NONE, |
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 printf("--scale=<number> - scale output size by number (e.g. 0.5)\n"); | 508 printf("--scale=<number> - scale output size by number (e.g. 0.5)\n"); |
508 printf("--ppm - write page images <pdf-name>.<page-number>.ppm\n"); | 509 printf("--ppm - write page images <pdf-name>.<page-number>.ppm\n"); |
509 #ifdef _WIN32 | 510 #ifdef _WIN32 |
510 printf("--bmp - write page images <pdf-name>.<page-number>.bmp\n"); | 511 printf("--bmp - write page images <pdf-name>.<page-number>.bmp\n"); |
511 printf("--emf - write page meta files <pdf-name>.<page-number>.emf\n"); | 512 printf("--emf - write page meta files <pdf-name>.<page-number>.emf\n"); |
512 #endif | 513 #endif |
513 return 1; | 514 return 1; |
514 } | 515 } |
515 | 516 |
516 v8::V8::InitializeICU(); | 517 v8::V8::InitializeICU(); |
| 518 v8::Platform* platform = v8::platform::CreateDefaultPlatform(); |
| 519 v8::V8::InitializePlatform(platform); |
| 520 v8::V8::Initialize(); |
517 | 521 |
518 #ifdef V8_USE_EXTERNAL_STARTUP_DATA | 522 #ifdef V8_USE_EXTERNAL_STARTUP_DATA |
519 v8::StartupData natives; | 523 v8::StartupData natives; |
520 v8::StartupData snapshot; | 524 v8::StartupData snapshot; |
521 if (!GetExternalData(options, "natives_blob.bin", &natives) || | 525 if (!GetExternalData(options, "natives_blob.bin", &natives) || |
522 !GetExternalData(options, "snapshot_blob.bin", &snapshot)) { | 526 !GetExternalData(options, "snapshot_blob.bin", &snapshot)) { |
523 return 1; | 527 return 1; |
524 } | 528 } |
525 v8::V8::SetNativesDataBlob(&natives); | 529 v8::V8::SetNativesDataBlob(&natives); |
526 v8::V8::SetSnapshotDataBlob(&snapshot); | 530 v8::V8::SetSnapshotDataBlob(&snapshot); |
(...skipping 13 matching lines...) Expand all Loading... |
540 files.pop_front(); | 544 files.pop_front(); |
541 size_t file_length = 0; | 545 size_t file_length = 0; |
542 char* file_contents = GetFileContents(filename.c_str(), &file_length); | 546 char* file_contents = GetFileContents(filename.c_str(), &file_length); |
543 if (!file_contents) | 547 if (!file_contents) |
544 continue; | 548 continue; |
545 RenderPdf(filename, file_contents, file_length, options); | 549 RenderPdf(filename, file_contents, file_length, options); |
546 free(file_contents); | 550 free(file_contents); |
547 } | 551 } |
548 | 552 |
549 FPDF_DestroyLibrary(); | 553 FPDF_DestroyLibrary(); |
| 554 v8::V8::ShutdownPlatform(); |
| 555 delete platform; |
550 | 556 |
551 return 0; | 557 return 0; |
552 } | 558 } |
OLD | NEW |