OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef GIN_V8_INITIALIZER_H_ | 5 #ifndef GIN_V8_INITIALIZER_H_ |
6 #define GIN_V8_INITIALIZER_H_ | 6 #define GIN_V8_INITIALIZER_H_ |
7 | 7 |
8 #include "base/files/file.h" | 8 #include "base/files/file.h" |
9 #include "gin/array_buffer.h" | 9 #include "gin/array_buffer.h" |
10 #include "gin/gin_export.h" | 10 #include "gin/gin_export.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 // and 0 for sizes. | 24 // and 0 for sizes. |
25 static void GetV8ExternalSnapshotData(const char** natives_data_out, | 25 static void GetV8ExternalSnapshotData(const char** natives_data_out, |
26 int* natives_size_out, | 26 int* natives_size_out, |
27 const char** snapshot_data_out, | 27 const char** snapshot_data_out, |
28 int* snapshot_size_out); | 28 int* snapshot_size_out); |
29 | 29 |
30 #if defined(V8_USE_EXTERNAL_STARTUP_DATA) | 30 #if defined(V8_USE_EXTERNAL_STARTUP_DATA) |
31 | 31 |
32 // Load V8 snapshot from user provided platform file descriptors. | 32 // Load V8 snapshot from user provided platform file descriptors. |
33 // The offset and size arguments, if non-zero, specify the portions | 33 // The offset and size arguments, if non-zero, specify the portions |
34 // of the files to be loaded. This methods returns true on success | 34 // of the files to be loaded. Since the VM can boot with or without |
35 // (or if snapshot is already loaded), false otherwise. | 35 // the snapshot, this function does not return a status. |
36 static bool LoadV8SnapshotFromFD(base::PlatformFile natives_fd, | 36 static void LoadV8SnapshotFromFD(base::PlatformFile snapshot_fd, |
37 int64 natives_offset, | |
38 int64 natives_size, | |
39 base::PlatformFile snapshot_fd, | |
40 int64 snapshot_offset, | 37 int64 snapshot_offset, |
41 int64 snapshot_size); | 38 int64 snapshot_size); |
| 39 // Similar to LoadV8SnapshotFromFD, but for the source of the natives. |
| 40 // Without the natives we cannot continue, so this function contains |
| 41 // release mode asserts and won't return if it fails. |
| 42 static void LoadV8NativesFromFD(base::PlatformFile natives_fd, |
| 43 int64 natives_offset, |
| 44 int64 natives_size); |
42 | 45 |
43 // Load V8 snapshot from default resources. Returns true on success or | 46 // Load V8 snapshot from default resources, if they are available. |
44 // snapshot is already loaded, false otherwise. | 47 static void LoadV8Snapshot(); |
45 static bool LoadV8Snapshot(); | 48 |
| 49 // Load V8 natives source from default resources. Contains asserts |
| 50 // so that it will not return if natives cannot be loaded. |
| 51 static void LoadV8Natives(); |
46 | 52 |
47 // Opens the V8 snapshot data files and returns open file descriptors to these | 53 // Opens the V8 snapshot data files and returns open file descriptors to these |
48 // files in |natives_fd_out| and |snapshot_fd_out|, which can be passed to | 54 // files in |natives_fd_out| and |snapshot_fd_out|, which can be passed to |
49 // child processes. | 55 // child processes. |
50 static bool OpenV8FilesForChildProcesses(base::PlatformFile* natives_fd_out, | 56 static bool OpenV8FilesForChildProcesses(base::PlatformFile* natives_fd_out, |
51 base::PlatformFile* snapshot_fd_out); | 57 base::PlatformFile* snapshot_fd_out) |
52 | 58 WARN_UNUSED_RESULT; |
53 #endif // V8_USE_EXTERNAL_STARTUP_DATA | 59 #endif // V8_USE_EXTERNAL_STARTUP_DATA |
54 }; | 60 }; |
55 | 61 |
56 } // namespace gin | 62 } // namespace gin |
57 | 63 |
58 #endif // GIN_V8_INITIALIZER_H_ | 64 #endif // GIN_V8_INITIALIZER_H_ |
OLD | NEW |