Index: gin/v8_initializer.h |
diff --git a/gin/v8_initializer.h b/gin/v8_initializer.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..445bb0951b0698a8e63640957cc045231f09821d |
--- /dev/null |
+++ b/gin/v8_initializer.h |
@@ -0,0 +1,55 @@ |
+// Copyright 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef GIN_V8_INITIALIZER_H_ |
+#define GIN_V8_INITIALIZER_H_ |
+ |
+#include "base/files/file.h" |
+#include "gin/array_buffer.h" |
+#include "gin/gin_export.h" |
+#include "gin/public/v8_platform.h" |
+#include "v8/include/v8.h" |
+ |
+namespace gin { |
+ |
+class GIN_EXPORT V8Initializer { |
+ public: |
+ // Controls whether or not V8 should only accept strict mode scripts. |
+ enum ScriptMode { kNonStrictMode, kStrictMode }; |
rmcilroy
2015/03/30 10:29:22
note for future cleanup (or now if it's easy) we s
oth
2015/03/30 15:55:19
Yes, good point. In the near term, the code now ju
|
+ |
+ static const int kV8SnapshotBasePathKey; |
+ static const char kNativesFileName[]; |
+ static const char kSnapshotFileName[]; |
+ |
+ // Should be invoked once before creating IsolateHolder instances to |
+ // initialize V8 and Gin. In case V8_USE_EXTERNAL_STARTUP_DATA is defined, |
+ // V8's initial snapshot should be loaded (by calling LoadV8Snapshot or |
+ // LoadV8SnapshotFd) before calling Initialize. |
rmcilroy
2015/03/30 10:29:22
update "LoadV8SnapshotFd" in comment with name cho
oth
2015/03/30 15:55:19
Done and comment moved to IsolateHolder.h for now.
|
+ static void Initialize(ScriptMode mode, |
+ v8::ArrayBuffer::Allocator* allocator); |
+ |
+ static v8::ArrayBuffer::Allocator* GetArrayBufferAllocator(); |
+ |
+ static void GetV8ExternalSnapshotData(const char** natives_data_out, |
rmcilroy
2015/03/30 10:29:22
Could you document these methods please (you can c
oth
2015/03/30 15:55:19
Done.
oth
2015/03/30 15:55:19
Done.
|
+ int* natives_size_out, |
+ const char** snapshot_data_out, |
+ int* snapshot_size_out); |
+ |
+#if defined(V8_USE_EXTERNAL_STARTUP_DATA) |
+ |
+ static bool LoadV8SnapshotFromFile(base::PlatformFile natives_fd, |
rmcilroy
2015/03/30 10:29:22
Both this and LoadV8Snapshot load it from a file,
oth
2015/03/30 15:55:19
Done.
|
+ int64 natives_offset, |
+ int64 natives_size, |
+ base::PlatformFile snapshot_fd, |
+ int64 snapshot_offset, |
+ int64 snapshot_size); |
+ |
+ static bool LoadV8Snapshot(); |
+ |
+#endif // V8_USE_EXTERNAL_STARTUP_DATA |
+}; |
+ |
+} // namespace gin |
+ |
+#endif // GIN_V8_INITIALIZER_H_ |