OLD | NEW |
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 "vm/isolate.h" | 5 #include "vm/isolate.h" |
6 | 6 |
7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 #include "include/dart_native_api.h" | 8 #include "include/dart_native_api.h" |
9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
10 #include "platform/text_buffer.h" | 10 #include "platform/text_buffer.h" |
(...skipping 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1094 reload_context_->AbortReload(error); | 1094 reload_context_->AbortReload(error); |
1095 } | 1095 } |
1096 | 1096 |
1097 | 1097 |
1098 bool Isolate::ReloadSources(JSONStream* js, | 1098 bool Isolate::ReloadSources(JSONStream* js, |
1099 bool force_reload, | 1099 bool force_reload, |
1100 bool dont_delete_reload_context) { | 1100 bool dont_delete_reload_context) { |
1101 ASSERT(!IsReloading()); | 1101 ASSERT(!IsReloading()); |
1102 has_attempted_reload_ = true; | 1102 has_attempted_reload_ = true; |
1103 reload_context_ = new IsolateReloadContext(this, js); | 1103 reload_context_ = new IsolateReloadContext(this, js); |
1104 reload_context_->StartReload(force_reload); | 1104 reload_context_->Reload(force_reload); |
1105 bool success = !reload_context_->has_error(); | 1105 bool success = !reload_context_->reload_aborted(); |
1106 // Unit tests use the reload context later. Caller is responsible | |
1107 // for deleting the context. | |
1108 if (!dont_delete_reload_context) { | 1106 if (!dont_delete_reload_context) { |
1109 DeleteReloadContext(); | 1107 DeleteReloadContext(); |
1110 } | 1108 } |
1111 #if defined(DEBUG) | 1109 #if defined(DEBUG) |
1112 if (success) { | 1110 if (success) { |
| 1111 return success; |
1113 Thread* thread = Thread::Current(); | 1112 Thread* thread = Thread::Current(); |
1114 Isolate* isolate = thread->isolate(); | 1113 Isolate* isolate = thread->isolate(); |
1115 isolate->heap()->CollectAllGarbage(); | 1114 isolate->heap()->CollectAllGarbage(); |
1116 VerifyCanonicalVisitor check_canonical(thread); | 1115 VerifyCanonicalVisitor check_canonical(thread); |
1117 isolate->heap()->IterateObjects(&check_canonical); | 1116 isolate->heap()->IterateObjects(&check_canonical); |
1118 } | 1117 } |
1119 #endif // DEBUG | 1118 #endif // DEBUG |
1120 return success; | 1119 return success; |
1121 } | 1120 } |
1122 | 1121 |
1123 | 1122 |
1124 void Isolate::DeleteReloadContext() { | 1123 void Isolate::DeleteReloadContext() { |
1125 delete reload_context_; | 1124 delete reload_context_; |
1126 reload_context_ = NULL; | 1125 reload_context_ = NULL; |
1127 } | 1126 } |
1128 #endif // !PRODUCT | 1127 #endif // !PRODUCT |
1129 | 1128 |
1130 | 1129 |
1131 void Isolate::DoneFinalizing() { | 1130 void Isolate::DoneFinalizing() { |
1132 NOT_IN_PRODUCT( | 1131 NOT_IN_PRODUCT( |
1133 if (IsReloading()) { | 1132 if (IsReloading()) { |
1134 reload_context_->FinishReload(); | 1133 reload_context_->FinalizeLoading(); |
1135 } | 1134 } |
1136 ) | 1135 ) |
1137 } | 1136 } |
1138 | 1137 |
1139 | 1138 |
1140 | 1139 |
1141 bool Isolate::MakeRunnable() { | 1140 bool Isolate::MakeRunnable() { |
1142 ASSERT(Isolate::Current() == NULL); | 1141 ASSERT(Isolate::Current() == NULL); |
1143 | 1142 |
1144 MutexLocker ml(mutex_); | 1143 MutexLocker ml(mutex_); |
(...skipping 1753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2898 void IsolateSpawnState::DecrementSpawnCount() { | 2897 void IsolateSpawnState::DecrementSpawnCount() { |
2899 ASSERT(spawn_count_monitor_ != NULL); | 2898 ASSERT(spawn_count_monitor_ != NULL); |
2900 ASSERT(spawn_count_ != NULL); | 2899 ASSERT(spawn_count_ != NULL); |
2901 MonitorLocker ml(spawn_count_monitor_); | 2900 MonitorLocker ml(spawn_count_monitor_); |
2902 ASSERT(*spawn_count_ > 0); | 2901 ASSERT(*spawn_count_ > 0); |
2903 *spawn_count_ = *spawn_count_ - 1; | 2902 *spawn_count_ = *spawn_count_ - 1; |
2904 ml.Notify(); | 2903 ml.Notify(); |
2905 } | 2904 } |
2906 | 2905 |
2907 } // namespace dart | 2906 } // namespace dart |
OLD | NEW |