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 | 9 |
10 #include <list> | 10 #include <list> |
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 std::list<std::string> files; | 575 std::list<std::string> files; |
576 if (!ParseCommandLine(args, &options, &files)) { | 576 if (!ParseCommandLine(args, &options, &files)) { |
577 fprintf(stderr, "%s", usage_string); | 577 fprintf(stderr, "%s", usage_string); |
578 return 1; | 578 return 1; |
579 } | 579 } |
580 | 580 |
581 v8::V8::InitializeICU(); | 581 v8::V8::InitializeICU(); |
582 v8::Platform* platform = v8::platform::CreateDefaultPlatform(); | 582 v8::Platform* platform = v8::platform::CreateDefaultPlatform(); |
583 v8::V8::InitializePlatform(platform); | 583 v8::V8::InitializePlatform(platform); |
584 v8::V8::Initialize(); | 584 v8::V8::Initialize(); |
| 585 // By enabling predicatble mode, V8 won't post any background tasks. |
| 586 const char predictable_flag[] = "--predictable"; |
| 587 v8::V8::SetFlagsFromString(predictable_flag, strlen(predictable_flag)); |
585 | 588 |
586 #ifdef V8_USE_EXTERNAL_STARTUP_DATA | 589 #ifdef V8_USE_EXTERNAL_STARTUP_DATA |
587 v8::StartupData natives; | 590 v8::StartupData natives; |
588 v8::StartupData snapshot; | 591 v8::StartupData snapshot; |
589 if (!GetExternalData(options, "natives_blob.bin", &natives) || | 592 if (!GetExternalData(options, "natives_blob.bin", &natives) || |
590 !GetExternalData(options, "snapshot_blob.bin", &snapshot)) { | 593 !GetExternalData(options, "snapshot_blob.bin", &snapshot)) { |
591 return 1; | 594 return 1; |
592 } | 595 } |
593 v8::V8::SetNativesDataBlob(&natives); | 596 v8::V8::SetNativesDataBlob(&natives); |
594 v8::V8::SetSnapshotDataBlob(&snapshot); | 597 v8::V8::SetSnapshotDataBlob(&snapshot); |
(...skipping 18 matching lines...) Expand all Loading... |
613 RenderPdf(filename, file_contents, file_length, options); | 616 RenderPdf(filename, file_contents, file_length, options); |
614 free(file_contents); | 617 free(file_contents); |
615 } | 618 } |
616 | 619 |
617 FPDF_DestroyLibrary(); | 620 FPDF_DestroyLibrary(); |
618 v8::V8::ShutdownPlatform(); | 621 v8::V8::ShutdownPlatform(); |
619 delete platform; | 622 delete platform; |
620 | 623 |
621 return 0; | 624 return 0; |
622 } | 625 } |
OLD | NEW |