Chromium Code Reviews| Index: runtime/vm/object.cc |
| =================================================================== |
| --- runtime/vm/object.cc (revision 38636) |
| +++ runtime/vm/object.cc (working copy) |
| @@ -8545,13 +8545,35 @@ |
| } |
| -void Library::SetLoadError() const { |
| +void Library::SetLoadError(const Object& error) const { |
| // Should not be already successfully loaded or just allocated. |
| - ASSERT(LoadInProgress() || LoadRequested() || LoadError()); |
| + ASSERT(LoadInProgress() || LoadRequested() || LoadFailed()); |
| raw_ptr()->load_state_ = RawLibrary::kLoadError; |
| + StorePointer(&raw_ptr()->load_error_, error.raw()); |
| } |
| +RawObject* Library::TransitiveLoadError() const { |
| + if (LoadError() != Error::null()) { |
| + return LoadError(); |
| + } |
| + intptr_t num_imp = num_imports(); |
| + Library& lib = Library::Handle(); |
| + Object& error = Object::Handle(); |
| + for (intptr_t i = 0; i < num_imp; i++) { |
| + lib = ImportLibraryAt(i); |
| + // Break potential import cycles while recursing through imports. |
| + set_num_imports(0); |
| + error = lib.TransitiveLoadError(); |
| + set_num_imports(num_imp); |
| + if (!error.IsNull()) { |
| + break; |
| + } |
| + } |
| + return error.raw(); |
| +} |
| + |
| + |
| static RawString* MakeClassMetaName(const Class& cls) { |
| String& cname = String::Handle(cls.Name()); |
| return String::Concat(Symbols::At(), cname); |
| @@ -9351,6 +9373,7 @@ |
| result.raw_ptr()->imports_ = Object::empty_array().raw(); |
| result.raw_ptr()->exports_ = Object::empty_array().raw(); |
| result.raw_ptr()->loaded_scripts_ = Array::null(); |
| + result.raw_ptr()->load_error_ = Object::null(); |
| result.set_native_entry_resolver(NULL); |
| result.set_native_entry_symbol_resolver(NULL); |
| result.raw_ptr()->corelib_imported_ = true; |
| @@ -9727,13 +9750,28 @@ |
| } |
| +RawObject* LibraryPrefix::LoadError() const { |
| + Library& lib = Library::Handle(); |
| + Object& error = Object::Handle(); |
| + for (int32_t i = 0; i < num_imports(); i++) { |
| + lib = GetLibrary(i); |
| + ASSERT(!lib.IsNull()); |
| + error = lib.TransitiveLoadError(); |
| + if (!error.IsNull()) { |
| + return error.raw(); |
| + } |
| + } |
| + return Object::null(); |
| +} |
| + |
| + |
| bool LibraryPrefix::ContainsLibrary(const Library& library) const { |
| - intptr_t num_current_imports = num_imports(); |
| + int32_t num_current_imports = num_imports(); |
| if (num_current_imports > 0) { |
| Library& lib = Library::Handle(); |
| const String& url = String::Handle(library.url()); |
| String& lib_url = String::Handle(); |
| - for (intptr_t i = 0; i < num_current_imports; i++) { |
| + for (int32_t i = 0; i < num_current_imports; i++) { |
| lib = GetLibrary(i); |
| ASSERT(!lib.IsNull()); |
| lib_url = lib.url(); |
| @@ -9844,6 +9882,10 @@ |
| Isolate* isolate = Isolate::Current(); |
| Api::Scope api_scope(isolate); |
| deferred_lib.SetLoadRequested(); |
| + const GrowableObjectArray& pending_deferred_loads = |
| + GrowableObjectArray::Handle( |
| + isolate->object_store()->pending_deferred_loads()); |
| + pending_deferred_loads.Add(deferred_lib); |
|
Ivan Posva
2014/07/31 18:29:04
Please make sure this is reset when the loads are
hausner
2014/07/31 21:12:45
Added to Dart_FinalizeLoading()
|
| const String& lib_url = String::Handle(isolate, deferred_lib.url()); |
| Dart_LibraryTagHandler handler = isolate->library_tag_handler(); |
| handler(Dart_kImportTag, |