Chromium Code Reviews| Index: include/v8.h |
| diff --git a/include/v8.h b/include/v8.h |
| index 07513aa820117b8442135e3b986c55d88192f3b3..9ad716f37ad7f0487264b7abb909881996083b5b 100644 |
| --- a/include/v8.h |
| +++ b/include/v8.h |
| @@ -6769,6 +6769,48 @@ class V8_EXPORT V8 { |
| friend class Context; |
| }; |
| +/** |
| + * Helper class to create a snapshot data blob. |
| + */ |
| +class SnapshotCreator { |
| + public: |
| + enum class FunctionCodeHandling { kClear, kKeep }; |
| + |
| + /** |
| + * Create an enter an isolate, which is correctly set up for serialization. |
|
vogelheim
2016/06/09 13:42:07
language nitpicks:
"Create an enter" => "Create a
|
| + * The isolate is either created from scratch or from an existing snapshot. |
| + * The caller keeps ownership of the argument snapshot. |
| + */ |
| + explicit SnapshotCreator(StartupData* existing_blob = nullptr); |
| + |
| + ~SnapshotCreator(); |
| + |
| + /** |
| + * \returns the isolate prepared by the snapshot creator. |
| + */ |
| + Isolate* GetIsolate(); |
| + |
| + /** |
| + * Add a context to be included in the snapshot blob. |
| + */ |
| + void AddContext(Local<Context> context); |
| + |
| + /** |
| + * Created a snapshot data blob. |
| + * \param function_code_handling whether to include compiled function code |
| + * in the snapshot. |
| + * \returns { nullptr, 0 } on failure, and a startup snapshot on success. The |
| + * caller acquires ownership of the data array in the return value. |
| + */ |
| + StartupData CreateBlob(FunctionCodeHandling function_code_handling); |
| + |
| + private: |
| + void* data_; |
| + |
| + // Disallow copying and assigning. |
| + SnapshotCreator(const SnapshotCreator&); |
| + void operator=(const SnapshotCreator&); |
| +}; |
| /** |
| * A simple Maybe type, representing an object which may or may not have a |