| Index: runtime/bin/loader.cc
|
| diff --git a/runtime/bin/loader.cc b/runtime/bin/loader.cc
|
| index 35a09357fdfec0bed534daf554b46b3c47f154b7..f43cf30056225291aa737c67d9a5b46e6d4d8145 100644
|
| --- a/runtime/bin/loader.cc
|
| +++ b/runtime/bin/loader.cc
|
| @@ -37,11 +37,13 @@ Loader::Loader(IsolateData* isolate_data)
|
|
|
|
|
| Loader::~Loader() {
|
| - monitor_->Enter();
|
| ASSERT(port_ != ILLEGAL_PORT);
|
| + // Enter the monitor while we close the Dart port. After the Dart port is
|
| + // closed, no more results can be queued.
|
| + monitor_->Enter();
|
| Dart_CloseNativePort(port_);
|
| - RemoveLoader(port_);
|
| monitor_->Exit();
|
| + RemoveLoader(port_);
|
| port_ = ILLEGAL_PORT;
|
| isolate_data_->set_loader(NULL);
|
| isolate_data_ = NULL;
|
| @@ -318,6 +320,23 @@ static bool IsWindowsHost() {
|
| }
|
|
|
|
|
| +void Loader::InitForSnapshot(const char* snapshot_uri) {
|
| + IsolateData* isolate_data =
|
| + reinterpret_cast<IsolateData*>(Dart_CurrentIsolateData());
|
| + ASSERT(isolate_data != NULL);
|
| + ASSERT(!isolate_data->HasLoader());
|
| + // Setup a loader. The constructor does a bunch of leg work.
|
| + Loader* loader = new Loader(isolate_data);
|
| + // Send the init message.
|
| + loader->Init(isolate_data->package_root,
|
| + isolate_data->packages_file,
|
| + DartUtils::original_working_directory,
|
| + snapshot_uri);
|
| + // Destroy the loader. The destructor does a bunch of leg work.
|
| + delete loader;
|
| +}
|
| +
|
| +
|
| Dart_Handle Loader::LibraryTagHandler(Dart_LibraryTag tag,
|
| Dart_Handle library,
|
| Dart_Handle url) {
|
|
|