Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Unified Diff: include/v8.h

Issue 2046423002: [snapshot] introduce SnapshotCreator API. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/v8.h
diff --git a/include/v8.h b/include/v8.h
index 07513aa820117b8442135e3b986c55d88192f3b3..a15a33c60cb95efffb9c3858ff47ce63b2758ce7 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 and enter an isolate, and set it 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);
+
+ ~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
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698