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

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

Issue 2162113002: Revert "Fix use-after-free in isolate reload." (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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
« no previous file with comments | « no previous file | no next file » | 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 "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 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after
1088 delete reload_context_; 1088 delete reload_context_;
1089 reload_context_ = NULL; 1089 reload_context_ = NULL;
1090 } 1090 }
1091 1091
1092 1092
1093 void Isolate::ReloadSources(bool test_mode) { 1093 void Isolate::ReloadSources(bool test_mode) {
1094 ASSERT(!IsReloading()); 1094 ASSERT(!IsReloading());
1095 has_attempted_reload_ = true; 1095 has_attempted_reload_ = true;
1096 reload_context_ = new IsolateReloadContext(this, test_mode); 1096 reload_context_ = new IsolateReloadContext(this, test_mode);
1097 reload_context_->StartReload(); 1097 reload_context_->StartReload();
1098 delete reload_context_;
1099 reload_context_ = NULL;
1100 } 1098 }
1101 #endif // !PRODUCT 1099 #endif // !PRODUCT
1102 1100
1103 1101
1104 void Isolate::DoneFinalizing() { 1102 void Isolate::DoneFinalizing() {
1105 NOT_IN_PRODUCT( 1103 NOT_IN_PRODUCT(
1106 if (IsReloading()) { 1104 if (IsReloading()) {
1107 reload_context_->FinishReload(); 1105 reload_context_->FinishReload();
1108 if (reload_context_->has_error() && reload_context_->test_mode()) { 1106 if (reload_context_->has_error() && reload_context_->test_mode()) {
1109 // If the reload has an error and we are in test mode keep the reload 1107 // If the reload has an error and we are in test mode keep the reload
1110 // context on the isolate so that it can be used by unit tests. 1108 // context on the isolate so that it can be used by unit tests.
1111 return; 1109 return;
1112 } 1110 }
1113 if (reload_context_->has_error()) { 1111 if (reload_context_->has_error()) {
1114 // Remember the reload error. 1112 // Remember the reload error.
1115 sticky_reload_error_ = reload_context_->error(); 1113 sticky_reload_error_ = reload_context_->error();
1116 } 1114 }
1117 if (!reload_context_->has_error()) { 1115 if (!reload_context_->has_error()) {
1118 reload_context_->ReportSuccess(); 1116 reload_context_->ReportSuccess();
1119 } 1117 }
1118 delete reload_context_;
1119 reload_context_ = NULL;
1120 } 1120 }
1121 ) 1121 )
1122 } 1122 }
1123 1123
1124 1124
1125 1125
1126 bool Isolate::MakeRunnable() { 1126 bool Isolate::MakeRunnable() {
1127 ASSERT(Isolate::Current() == NULL); 1127 ASSERT(Isolate::Current() == NULL);
1128 1128
1129 MutexLocker ml(mutex_); 1129 MutexLocker ml(mutex_);
(...skipping 1744 matching lines...) Expand 10 before | Expand all | Expand 10 after
2874 void IsolateSpawnState::DecrementSpawnCount() { 2874 void IsolateSpawnState::DecrementSpawnCount() {
2875 ASSERT(spawn_count_monitor_ != NULL); 2875 ASSERT(spawn_count_monitor_ != NULL);
2876 ASSERT(spawn_count_ != NULL); 2876 ASSERT(spawn_count_ != NULL);
2877 MonitorLocker ml(spawn_count_monitor_); 2877 MonitorLocker ml(spawn_count_monitor_);
2878 ASSERT(*spawn_count_ > 0); 2878 ASSERT(*spawn_count_ > 0);
2879 *spawn_count_ = *spawn_count_ - 1; 2879 *spawn_count_ = *spawn_count_ - 1;
2880 ml.Notify(); 2880 ml.Notify();
2881 } 2881 }
2882 2882
2883 } // namespace dart 2883 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698