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

Unified Diff: include/dart_api.h

Issue 8772061: First step towards generation of application script snapshots (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: '' Created 9 years 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 | lib/isolate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/dart_api.h
===================================================================
--- include/dart_api.h (revision 2103)
+++ include/dart_api.h (working copy)
@@ -344,11 +344,47 @@
// "pure" dart isolate. Implement and document.
/**
- * Creates a snapshot of the state of the current isolate.
+ * Creates a full snapshot of the current isolate heap.
+ *
+ * A full snapshot is a compact representation of the dart heap state and
+ * can be used for fast initialization of an isolate. A Snapshot of the heap
+ * can only be created before any dart code has executed.
+ *
+ * Requires there to be a current isolate.
+ *
+ * \param buffer Returns a pointer to a buffer containing the
+ * snapshot. This buffer is scope allocated and is only valid
+ * until the next call to Dart_ExitScope.
+ * \param size Returns the size of the buffer.
+ *
+ * \return A valid handle if no error occurs during the operation.
*/
-DART_EXPORT Dart_Handle Dart_CreateSnapshot(uint8_t** snaphot_buffer,
- intptr_t* snapshot_size);
+DART_EXPORT Dart_Handle Dart_CreateSnapshot(uint8_t** buffer,
+ intptr_t* size);
+/**
+ * Creates a snapshot of the specified application script.
+ *
+ * A script snapshot can be used for implementing fast startup of applications
+ * (skips the script tokenizing and parsing process). A Snapshot of the script
+ * can only be created before any dart code has executed.
+ *
+ * Requires there to be a current isolate.
+ *
+ * \param library An application script for which a snapshot is to be
+ * created.
+ * \param buffer Returns a pointer to a buffer containing
+ * the snapshot. This buffer is scope allocated and is only valid
+ * until the next call to Dart_ExitScope.
+ * \param size Returns the size of the buffer.
+ *
+ * \return A valid handle if no error occurs during the operation.
+ */
+DART_EXPORT Dart_Handle Dart_CreateScriptSnapshot(Dart_Handle library,
+ uint8_t** buffer,
+ intptr_t* size);
+
+
// --- Messages and Ports ---
/**
@@ -1224,6 +1260,16 @@
Dart_LibraryTagHandler handler);
/**
+ * Loads the root script for current isolate from a snapshot.
+ *
+ * \param buffer A buffer which contains a snapshot of the script.
+ *
+ * \return If no error occurs, the Library object corresponding to the root
+ * script is returned. Otherwise an error handle is returned.
+ **/
+DART_EXPORT Dart_Handle Dart_LoadScriptFromSnapshot(const uint8_t* buffer);
+
+/**
* Forces all loaded classes and functions to be compiled eagerly in
* the current isolate..
*
« no previous file with comments | « no previous file | lib/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698