#include "testing/v8_initializer.h"
#include <stdlib.h>
#include <cstring>
#include <vector>
#include "core/fxcrt/fx_memcpy_wrappers.h"
#include "core/fxcrt/numerics/safe_conversions.h"
#include "public/fpdfview.h"
#include "testing/utils/file_util.h"
#include "testing/utils/path_service.h"
#include "v8/include/libplatform/libplatform.h"
#include "v8/include/v8-initialization.h"
#include "v8/include/v8-snapshot.h"
#ifdef PDF_ENABLE_XFA
#include "v8/include/cppgc/platform.h"
#endif
namespace {
#ifdef V8_USE_EXTERNAL_STARTUP_DATA
std::string GetFullPathForSnapshotFile(const std::string& exe_path,
const std::string& bin_dir,
const std::string& filename) { … }
bool GetExternalData(const std::string& exe_path,
const std::string& bin_dir,
const std::string& filename,
v8::StartupData* result_data) { … }
#endif
std::unique_ptr<v8::Platform> InitializeV8Common(const std::string& exe_path,
const std::string& js_flags) { … }
}
#ifdef V8_USE_EXTERNAL_STARTUP_DATA
std::unique_ptr<v8::Platform> InitializeV8ForPDFiumWithStartupData(
const std::string& exe_path,
const std::string& js_flags,
const std::string& bin_dir,
v8::StartupData* snapshot_blob) { … }
#else
std::unique_ptr<v8::Platform> InitializeV8ForPDFium(
const std::string& exe_path,
const std::string& js_flags) {
return InitializeV8Common(exe_path, js_flags);
}
#endif
void ShutdownV8ForPDFium() { … }