OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 the V8 project authors. All rights reserved. | |
jochen (gone - plz use gerrit)
2015/02/10 15:05:56
2015
vogelheim
2015/02/10 15:15:20
Done.
| |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 | |
6 #ifndef V8_STARTUP_DATA_UTIL_H_ | |
7 #define V8_STARTUP_DATA_UTIL_H_ | |
8 | |
9 #include "include/v8.h" | |
10 | |
11 namespace v8 { | |
12 | |
13 #ifdef V8_USE_EXTERNAL_STARTUP_DATA | |
14 // Helper class to load the startup data files from disk. | |
15 // | |
16 // This is meant as a convenience for stand-alone binaries like d8, cctest, | |
17 // unittest. A V8 embedder would likely either handle startup data on their | |
18 // own or just disable the feature if they don't want to handle it at all, | |
19 // while tools like cctest need to work in either configuration. Hence this is | |
20 // not meant for inclusion in the general v8 library. | |
21 class StartupDataHandler { | |
22 public: | |
23 // Load startup data, and call the v8::V8::Set*DataBlob API functions. | |
24 // | |
25 // natives_blob and snapshot_blob will be loaded realitive to exec_path, | |
26 // which would usually be the equivalent of argv[0]. | |
27 StartupDataHandler(const char* exec_path, const char* natives_blob, | |
28 const char* snapshot_blob); | |
29 ~StartupDataHandler(); | |
30 | |
31 private: | |
32 static char* RelativePath(char** buffer, const char* exec_path, | |
33 const char* name); | |
34 | |
35 void LoadFromFiles(const char* natives_blob, const char* snapshot_blob); | |
36 | |
37 void Load(const char* blob_file, v8::StartupData* startup_data, | |
38 void (*setter_fn)(v8::StartupData*)); | |
39 | |
40 v8::StartupData natives_; | |
41 v8::StartupData snapshot_; | |
42 | |
43 // Disallow copy & assign. | |
44 StartupDataHandler(const StartupDataHandler& other); | |
45 void operator=(const StartupDataHandler& other); | |
46 }; | |
47 #endif // V8_USE_EXTERNAL_STARTUP_DATA | |
48 | |
49 } // namespace v8 | |
50 | |
51 #endif // V8_STARTUP_DATA_UTIL_H_ | |
OLD | NEW |