| Index: runtime/vm/dart_api_impl.cc
|
| ===================================================================
|
| --- runtime/vm/dart_api_impl.cc (revision 44745)
|
| +++ runtime/vm/dart_api_impl.cc (working copy)
|
| @@ -1200,6 +1200,7 @@
|
| }
|
|
|
| DART_EXPORT bool Dart_Initialize(
|
| + const uint8_t* vm_isolate_snapshot,
|
| Dart_IsolateCreateCallback create,
|
| Dart_IsolateInterruptCallback interrupt,
|
| Dart_IsolateUnhandledExceptionCallback unhandled,
|
| @@ -1209,7 +1210,8 @@
|
| Dart_FileWriteCallback file_write,
|
| Dart_FileCloseCallback file_close,
|
| Dart_EntropySource entropy_source) {
|
| - const char* err_msg = Dart::InitOnce(create, interrupt, unhandled, shutdown,
|
| + const char* err_msg = Dart::InitOnce(vm_isolate_snapshot,
|
| + create, interrupt, unhandled, shutdown,
|
| file_open, file_read, file_write,
|
| file_close, entropy_source);
|
| if (err_msg != NULL) {
|
| @@ -1408,17 +1410,26 @@
|
| }
|
|
|
|
|
| -DART_EXPORT Dart_Handle Dart_CreateSnapshot(uint8_t** buffer,
|
| - intptr_t* size) {
|
| +DART_EXPORT Dart_Handle Dart_CreateSnapshot(
|
| + uint8_t** vm_isolate_snapshot_buffer,
|
| + intptr_t* vm_isolate_snapshot_size,
|
| + uint8_t** isolate_snapshot_buffer,
|
| + intptr_t* isolate_snapshot_size) {
|
| Isolate* isolate = Isolate::Current();
|
| DARTSCOPE(isolate);
|
| TIMERSCOPE(isolate, time_creating_snapshot);
|
| - if (buffer == NULL) {
|
| - RETURN_NULL_ERROR(buffer);
|
| + if (vm_isolate_snapshot_buffer == NULL) {
|
| + RETURN_NULL_ERROR(vm_isolate_snapshot_buffer);
|
| }
|
| - if (size == NULL) {
|
| - RETURN_NULL_ERROR(size);
|
| + if (vm_isolate_snapshot_size == NULL) {
|
| + RETURN_NULL_ERROR(vm_isolate_snapshot_size);
|
| }
|
| + if (isolate_snapshot_buffer == NULL) {
|
| + RETURN_NULL_ERROR(isolate_snapshot_buffer);
|
| + }
|
| + if (isolate_snapshot_size == NULL) {
|
| + RETURN_NULL_ERROR(isolate_snapshot_size);
|
| + }
|
| // Finalize all classes if needed.
|
| Dart_Handle state = Api::CheckAndFinalizePendingClasses(isolate);
|
| if (::Dart_IsError(state)) {
|
| @@ -1426,9 +1437,12 @@
|
| }
|
| // Since this is only a snapshot the root library should not be set.
|
| isolate->object_store()->set_root_library(Library::Handle(isolate));
|
| - FullSnapshotWriter writer(buffer, ApiReallocate);
|
| + FullSnapshotWriter writer(vm_isolate_snapshot_buffer,
|
| + isolate_snapshot_buffer,
|
| + ApiReallocate);
|
| writer.WriteFullSnapshot();
|
| - *size = writer.BytesWritten();
|
| + *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize();
|
| + *isolate_snapshot_size = writer.IsolateSnapshotSize();
|
| return Api::Success();
|
| }
|
|
|
|
|