OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
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 GIN_V8_INITIALIZER_H_ | |
6 #define GIN_V8_INITIALIZER_H_ | |
7 | |
8 #include "base/files/file.h" | |
9 #include "gin/array_buffer.h" | |
10 #include "gin/gin_export.h" | |
11 #include "gin/public/isolate_holder.h" | |
12 #include "gin/public/v8_platform.h" | |
13 #include "v8/include/v8.h" | |
14 | |
15 namespace gin { | |
16 | |
17 class GIN_EXPORT V8Initializer { | |
18 public: | |
19 static const int kV8SnapshotBasePathKey; | |
20 static const char kNativesFileName[]; | |
21 static const char kSnapshotFileName[]; | |
22 | |
23 // This should be called by IsolateHolder::Initialize(). | |
24 static void Initialize(gin::IsolateHolder::ScriptMode mode, | |
25 v8::ArrayBuffer::Allocator* allocator); | |
rmcilroy
2015/03/30 17:44:18
It would be good if we could avoid exposing this m
| |
26 | |
27 // Get address and size information for currently loaded snapshot. | |
28 // If no snapshot is loaded, the return values are null for addresses | |
29 // and 0 for sizes. | |
30 static void GetV8ExternalSnapshotData(const char** natives_data_out, | |
31 int* natives_size_out, | |
32 const char** snapshot_data_out, | |
33 int* snapshot_size_out); | |
34 | |
35 #if defined(V8_USE_EXTERNAL_STARTUP_DATA) | |
36 | |
37 // Load V8 snapshot from user provided platform file descriptors. | |
38 // The offset and size arguments, if non-zero, specify the portions | |
39 // of the files to be loaded. This methods returns true on success | |
40 // (or if snapshot is already loaded), false otherwise. | |
41 static bool LoadV8SnapshotFromFD(base::PlatformFile natives_fd, | |
42 int64 natives_offset, | |
43 int64 natives_size, | |
44 base::PlatformFile snapshot_fd, | |
45 int64 snapshot_offset, | |
46 int64 snapshot_size); | |
47 | |
48 // Load V8 snapshot from default resources. Returns true on success or | |
49 // snapshot is already loaded, false otherwise. | |
50 static bool LoadV8Snapshot(); | |
51 | |
52 #endif // V8_USE_EXTERNAL_STARTUP_DATA | |
53 }; | |
54 | |
55 } // namespace gin | |
56 | |
57 #endif // GIN_V8_INITIALIZER_H_ | |
OLD | NEW |