Index: include/v8.h |
diff --git a/include/v8.h b/include/v8.h |
index 255ac0e90cf1b41480ab7d9feb3d66bb7d8a7857..4cb6cb54d82d322efe33986ef9ca8db78ad00837 100644 |
--- a/include/v8.h |
+++ b/include/v8.h |
@@ -6492,6 +6492,46 @@ class V8_EXPORT V8 { |
const char* warmup_source); |
/** |
+ * Helper class to create a snapshot data blob. |
+ */ |
+ class SnapshotCreator { |
jochen (gone - plz use gerrit)
2016/06/08 13:06:48
I'd not make this a subclass of V8 but a top-level
Yang
2016/06/08 13:30:29
Done.
|
+ public: |
+ enum FunctionCodeHandling { CLEAR_FUNCTION_CODE, KEEP_FUNCTION_CODE }; |
jochen (gone - plz use gerrit)
2016/06/08 13:06:48
what about using an enum class { kClear, kKeep}
Yang
2016/06/08 13:30:29
Done.
|
+ |
+ /** |
+ * Create an enter an isolate, which is correctly set up for serialization. |
+ * 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); |
jochen (gone - plz use gerrit)
2016/06/08 13:06:48
can you explain why the existing snapshot is neede
Yang
2016/06/08 13:30:29
As discussed, this is for creating warmed up snaps
|
+ |
+ ~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 { NULL, 0 } on failure, and a startup snapshot on success. The |
jochen (gone - plz use gerrit)
2016/06/08 13:06:48
nullptr?
Yang
2016/06/08 13:30:29
Done.
|
+ * caller acquires ownership of the data array in the return value. |
+ */ |
+ StartupData CreateBlob( |
+ FunctionCodeHandling function_code_handling = CLEAR_FUNCTION_CODE); |
jochen (gone - plz use gerrit)
2016/06/08 13:06:48
I don't think the default arg is needed
Yang
2016/06/08 13:30:29
Done.
|
+ |
+ private: |
+ void* data_; |
+ }; |
jochen (gone - plz use gerrit)
2016/06/08 13:06:48
do we have some DISALLOW_COPY_AND_ASSING in the AP
Yang
2016/06/08 13:30:29
We don't have it as a macro, but override the copy
|
+ |
+ /** |
* Adds a message listener. |
* |
* The same message listener can be added more than once and in that |