xref: /aosp_15_r20/external/pdfium/testing/v8_initializer.h (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
1 // Copyright 2019 The PDFium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef TESTING_V8_INITIALIZER_H_
6 #define TESTING_V8_INITIALIZER_H_
7 
8 #include <memory>
9 #include <string>
10 
11 #ifndef PDF_ENABLE_V8
12 #error "V8 must be enabled"
13 #endif
14 
15 namespace v8 {
16 class Platform;
17 #ifdef V8_USE_EXTERNAL_STARTUP_DATA
18 class StartupData;
19 #endif
20 }  // namespace v8
21 
22 #ifdef V8_USE_EXTERNAL_STARTUP_DATA
23 // |snapshot_blob| is an optional out parameter.
24 std::unique_ptr<v8::Platform> InitializeV8ForPDFiumWithStartupData(
25     const std::string& exe_path,
26     const std::string& js_flags,
27     const std::string& bin_dir,
28     v8::StartupData* snapshot_blob);
29 #else
30 std::unique_ptr<v8::Platform> InitializeV8ForPDFium(
31     const std::string& js_flags,
32     const std::string& exe_path);
33 #endif
34 void ShutdownV8ForPDFium();
35 #endif  // TESTING_V8_INITIALIZER_H_
36