summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--samples/pdfium_test.cc4
-rw-r--r--testing/embedder_test_main.cpp8
-rw-r--r--testing/test_support.cpp15
-rw-r--r--testing/test_support.h5
4 files changed, 16 insertions, 16 deletions
diff --git a/samples/pdfium_test.cc b/samples/pdfium_test.cc
index 37e36d322d..707fbb1028 100644
--- a/samples/pdfium_test.cc
+++ b/samples/pdfium_test.cc
@@ -1568,8 +1568,8 @@ int main(int argc, const char* argv[]) {
#ifdef V8_USE_EXTERNAL_STARTUP_DATA
v8::StartupData natives;
v8::StartupData snapshot;
- platform = InitializeV8ForPDFium(options.exe_path, options.bin_directory,
- &natives, &snapshot);
+ platform = InitializeV8ForPDFiumWithStartupData(
+ options.exe_path, options.bin_directory, &natives, &snapshot);
#else // V8_USE_EXTERNAL_STARTUP_DATA
platform = InitializeV8ForPDFium(options.exe_path);
#endif // V8_USE_EXTERNAL_STARTUP_DATA
diff --git a/testing/embedder_test_main.cpp b/testing/embedder_test_main.cpp
index 03c192b08a..0c3ceb60ce 100644
--- a/testing/embedder_test_main.cpp
+++ b/testing/embedder_test_main.cpp
@@ -34,13 +34,13 @@ class Environment : public testing::Environment {
#ifdef PDF_ENABLE_V8
#ifdef V8_USE_EXTERNAL_STARTUP_DATA
if (g_v8_natives && g_v8_snapshot) {
- platform_ =
- InitializeV8ForPDFium(g_exe_path, std::string(), nullptr, nullptr);
+ platform_ = InitializeV8ForPDFiumWithStartupData(
+ g_exe_path, std::string(), nullptr, nullptr);
} else {
g_v8_natives = new v8::StartupData;
g_v8_snapshot = new v8::StartupData;
- platform_ = InitializeV8ForPDFium(g_exe_path, std::string(), g_v8_natives,
- g_v8_snapshot);
+ platform_ = InitializeV8ForPDFiumWithStartupData(
+ g_exe_path, std::string(), g_v8_natives, g_v8_snapshot);
}
#else
platform_ = InitializeV8ForPDFium(g_exe_path);
diff --git a/testing/test_support.cpp b/testing/test_support.cpp
index f682451c27..2b6f436c32 100644
--- a/testing/test_support.cpp
+++ b/testing/test_support.cpp
@@ -60,8 +60,8 @@ bool GetExternalData(const std::string& exe_path,
}
#endif // V8_USE_EXTERNAL_STARTUP_DATA
-std::unique_ptr<v8::Platform> InitializeV8Common(const char* exe_path) {
- v8::V8::InitializeICUDefaultLocation(exe_path);
+std::unique_ptr<v8::Platform> InitializeV8Common(const std::string& exe_path) {
+ v8::V8::InitializeICUDefaultLocation(exe_path.c_str());
std::unique_ptr<v8::Platform> platform = v8::platform::NewDefaultPlatform();
v8::V8::InitializePlatform(platform.get());
@@ -178,12 +178,12 @@ std::string GenerateMD5Base16(const uint8_t* data, uint32_t size) {
#ifdef PDF_ENABLE_V8
#ifdef V8_USE_EXTERNAL_STARTUP_DATA
-std::unique_ptr<v8::Platform> InitializeV8ForPDFium(
+std::unique_ptr<v8::Platform> InitializeV8ForPDFiumWithStartupData(
const std::string& exe_path,
const std::string& bin_dir,
v8::StartupData* natives_blob,
v8::StartupData* snapshot_blob) {
- std::unique_ptr<v8::Platform> platform = InitializeV8Common(exe_path.c_str());
+ std::unique_ptr<v8::Platform> platform = InitializeV8Common(exe_path);
if (natives_blob && snapshot_blob) {
if (!GetExternalData(exe_path, bin_dir, "natives_blob.bin", natives_blob))
return nullptr;
@@ -196,11 +196,8 @@ std::unique_ptr<v8::Platform> InitializeV8ForPDFium(
}
#else // V8_USE_EXTERNAL_STARTUP_DATA
std::unique_ptr<v8::Platform> InitializeV8ForPDFium(
- const std::string& exe_path,
- std::unique_ptr<v8::Platform>* platform) {
- std::unique_ptr<v8::Platform> platform =
- InitializeV8Common(exe_path.c_str(), platform);
- return platform;
+ const std::string& exe_path) {
+ return InitializeV8Common(exe_path);
}
#endif // V8_USE_EXTERNAL_STARTUP_DATA
#endif // PDF_ENABLE_V8
diff --git a/testing/test_support.h b/testing/test_support.h
index 1b7692c3ed..f26e161544 100644
--- a/testing/test_support.h
+++ b/testing/test_support.h
@@ -91,7 +91,10 @@ class Platform;
namespace v8 {
class StartupData;
}
-std::unique_ptr<v8::Platform> InitializeV8ForPDFium(
+
+// |natives_blob| and |snapshot_blob| are optional out parameters. They should
+// either both be valid or both be nullptrs.
+std::unique_ptr<v8::Platform> InitializeV8ForPDFiumWithStartupData(
const std::string& exe_path,
const std::string& bin_dir,
v8::StartupData* natives_blob,