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

Side by Side Diff: runtime/vm/dart_api_impl.cc

Issue 350923005: Defer marking libraries as ‘loaded’ (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/vm/isolate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "include/dart_api.h" 5 #include "include/dart_api.h"
6 #include "include/dart_mirrors_api.h" 6 #include "include/dart_mirrors_api.h"
7 #include "include/dart_native_api.h" 7 #include "include/dart_native_api.h"
8 8
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "vm/bigint_operations.h" 10 #include "vm/bigint_operations.h"
(...skipping 4730 matching lines...) Expand 10 before | Expand all | Expand 10 after
4741 Dart_Handle* result) { 4741 Dart_Handle* result) {
4742 bool update_lib_status = (script.kind() == RawScript::kScriptTag || 4742 bool update_lib_status = (script.kind() == RawScript::kScriptTag ||
4743 script.kind() == RawScript::kLibraryTag); 4743 script.kind() == RawScript::kLibraryTag);
4744 if (update_lib_status) { 4744 if (update_lib_status) {
4745 lib.SetLoadInProgress(); 4745 lib.SetLoadInProgress();
4746 } 4746 }
4747 ASSERT(isolate != NULL); 4747 ASSERT(isolate != NULL);
4748 const Error& error = Error::Handle(isolate, Compiler::Compile(lib, script)); 4748 const Error& error = Error::Handle(isolate, Compiler::Compile(lib, script));
4749 if (error.IsNull()) { 4749 if (error.IsNull()) {
4750 *result = Api::NewHandle(isolate, lib.raw()); 4750 *result = Api::NewHandle(isolate, lib.raw());
4751 if (update_lib_status) {
4752 lib.SetLoaded();
4753 }
4754 } else { 4751 } else {
4755 *result = Api::NewHandle(isolate, error.raw()); 4752 *result = Api::NewHandle(isolate, error.raw());
4756 if (update_lib_status) { 4753 lib.SetLoadError();
4757 lib.SetLoadError();
4758 }
4759 } 4754 }
4760 } 4755 }
4761 4756
4762 4757
4763 DART_EXPORT Dart_Handle Dart_LoadScript(Dart_Handle url, 4758 DART_EXPORT Dart_Handle Dart_LoadScript(Dart_Handle url,
4764 Dart_Handle source, 4759 Dart_Handle source,
4765 intptr_t line_offset, 4760 intptr_t line_offset,
4766 intptr_t col_offset) { 4761 intptr_t col_offset) {
4767 Isolate* isolate = Isolate::Current(); 4762 Isolate* isolate = Isolate::Current();
4768 DARTSCOPE(isolate); 4763 DARTSCOPE(isolate);
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
5144 } 5139 }
5145 5140
5146 5141
5147 // Finalizes classes and invokes Dart core library function that completes 5142 // Finalizes classes and invokes Dart core library function that completes
5148 // futures of loadLibrary calls (deferred library loading). 5143 // futures of loadLibrary calls (deferred library loading).
5149 DART_EXPORT Dart_Handle Dart_FinalizeLoading() { 5144 DART_EXPORT Dart_Handle Dart_FinalizeLoading() {
5150 Isolate* isolate = Isolate::Current(); 5145 Isolate* isolate = Isolate::Current();
5151 DARTSCOPE(isolate); 5146 DARTSCOPE(isolate);
5152 CHECK_CALLBACK_STATE(isolate); 5147 CHECK_CALLBACK_STATE(isolate);
5153 5148
5149 isolate->DoneLoading();
5150
5151 // TODO(hausner): move the remaining code below (finalization and
5152 // invoing of _completeDeferredLoads) into Isolate::DoneLoading().
5153
5154 // Finalize all classes if needed. 5154 // Finalize all classes if needed.
5155 Dart_Handle state = Api::CheckIsolateState(isolate); 5155 Dart_Handle state = Api::CheckIsolateState(isolate);
5156 if (::Dart_IsError(state)) { 5156 if (::Dart_IsError(state)) {
5157 return state; 5157 return state;
5158 } 5158 }
5159 5159
5160 const Library& corelib = Library::Handle(isolate, Library::CoreLibrary()); 5160 const Library& corelib = Library::Handle(isolate, Library::CoreLibrary());
5161 const String& function_name = 5161 const String& function_name =
5162 String::Handle(isolate, String::New("_completeDeferredLoads")); 5162 String::Handle(isolate, String::New("_completeDeferredLoads"));
5163 const Function& function = 5163 const Function& function =
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
5257 5257
5258 5258
5259 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( 5259 DART_EXPORT void Dart_RegisterRootServiceRequestCallback(
5260 const char* name, 5260 const char* name,
5261 Dart_ServiceRequestCallback callback, 5261 Dart_ServiceRequestCallback callback,
5262 void* user_data) { 5262 void* user_data) {
5263 Service::RegisterRootEmbedderCallback(name, callback, user_data); 5263 Service::RegisterRootEmbedderCallback(name, callback, user_data);
5264 } 5264 }
5265 5265
5266 } // namespace dart 5266 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698