summaryrefslogtreecommitdiff
path: root/samples
diff options
context:
space:
mode:
authorJohn Abd-El-Malek <jam@chromium.org>2015-02-04 16:04:05 -0800
committerJohn Abd-El-Malek <jam@chromium.org>2015-02-04 16:04:05 -0800
commit1be20344622b3da0fa49d511254928c786154f6b (patch)
tree4067f7559a5b481c090df24e03db31f127222a3c /samples
parent62120b79bbaca7430a8fc7ba0846b0a84f40542d (diff)
downloadpdfium-1be20344622b3da0fa49d511254928c786154f6b.tar.xz
Initialize V8 outside of PDFium.
This is similar to how we initialize ICU for V8 inside PDFium. BUG=455399 R=wfh@chromium.org Review URL: https://codereview.chromium.org/897973002
Diffstat (limited to 'samples')
-rw-r--r--samples/pdfium_test.cc6
-rw-r--r--samples/samples.gyp7
2 files changed, 12 insertions, 1 deletions
diff --git a/samples/pdfium_test.cc b/samples/pdfium_test.cc
index debe033369..7ba85ef308 100644
--- a/samples/pdfium_test.cc
+++ b/samples/pdfium_test.cc
@@ -20,6 +20,7 @@
#include "../fpdfsdk/include/fpdfview.h"
#include "../core/include/fxcrt/fx_system.h"
#include "v8/include/v8.h"
+#include "v8/include/libplatform/libplatform.h"
#ifdef _WIN32
#define snprintf _snprintf
@@ -497,6 +498,9 @@ int main(int argc, const char* argv[]) {
}
v8::V8::InitializeICU();
+ v8::Platform* platform = v8::platform::CreateDefaultPlatform();
+ v8::V8::InitializePlatform(platform);
+ v8::V8::Initialize();
#ifdef V8_USE_EXTERNAL_STARTUP_DATA
v8::StartupData natives;
@@ -530,6 +534,8 @@ int main(int argc, const char* argv[]) {
}
FPDF_DestroyLibrary();
+ v8::V8::ShutdownPlatform();
+ delete platform;
return 0;
}
diff --git a/samples/samples.gyp b/samples/samples.gyp
index 0c8ee93661..607a5b9169 100644
--- a/samples/samples.gyp
+++ b/samples/samples.gyp
@@ -7,8 +7,13 @@
'type': 'executable',
'dependencies': [
'../pdfium.gyp:pdfium',
+ '<(DEPTH)/v8/tools/gyp/v8.gyp:v8_libplatform',
+ ],
+ 'include_dirs': [
+ '<(DEPTH)',
+ '<(DEPTH)/v8',
+ '<(DEPTH)/v8/include',
],
- 'include_dirs': ['<(DEPTH)'],
},
'targets': [
{