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

Unified Diff: runtime/vm/dart_api_impl.cc

Issue 17503002: Stop unwanted class finalization when using dart:io HttpClient from builtin.dart (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/vm/isolate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart_api_impl.cc
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
index 38dccd610964d70e859aa76cb862a5209a1fcf93..6da3eaa95f8ce98c9ce4a5799aae3a92c6e8c4f6 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -133,6 +133,10 @@ FinalizablePersistentHandle* Api::UnwrapAsPrologueWeakPersistentHandle(
Dart_Handle Api::CheckIsolateState(Isolate* isolate) {
+ if (!isolate->AllowClassFinalization()) {
+ // Class finalization is blocked for the isolate. Do nothing.
+ return Api::Success();
+ }
if (ClassFinalizer::FinalizePendingClasses() &&
isolate->object_store()->PreallocateObjects()) {
return Api::Success();
@@ -2966,23 +2970,12 @@ DART_EXPORT Dart_Handle Dart_Invoke(Dart_Handle target,
} else if (obj.IsLibrary()) {
// Check whether class finalization is needed.
- bool finalize_classes = true;
const Library& lib = Library::Cast(obj);
- // When calling functions in the dart:builtin library do not finalize as it
- // should have been prefinalized.
- Library& builtin =
- Library::Handle(isolate, isolate->object_store()->builtin_library());
- if (builtin.raw() == lib.raw()) {
- finalize_classes = false;
- }
-
// Finalize all classes if needed.
- if (finalize_classes) {
- Dart_Handle state = Api::CheckIsolateState(isolate);
- if (::Dart_IsError(state)) {
- return state;
- }
+ Dart_Handle state = Api::CheckIsolateState(isolate);
+ if (::Dart_IsError(state)) {
+ return state;
}
Function& function = Function::Handle(isolate);
@@ -3074,6 +3067,7 @@ DART_EXPORT Dart_Handle Dart_GetField(Dart_Handle container, Dart_Handle name) {
if (::Dart_IsError(state)) {
return state;
}
+
Field& field = Field::Handle(isolate);
Function& getter = Function::Handle(isolate);
const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(container));
« 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