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

Unified Diff: runtime/bin/loader.cc

Issue 2147833002: Make loader lock new-allocated to avoid shutdown crash. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/loader.h ('k') | runtime/bin/main.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/loader.cc
diff --git a/runtime/bin/loader.cc b/runtime/bin/loader.cc
index 8e24f677719e5ab95db8c388dabd1e339b87dd87..b4d50a0b2fd80619f6b624c31c34f21030ef8f2e 100644
--- a/runtime/bin/loader.cc
+++ b/runtime/bin/loader.cc
@@ -608,7 +608,12 @@ Dart_Handle Loader::DartColonLibraryTagHandler(Dart_LibraryTag tag,
}
-Mutex Loader::loader_infos_lock_;
+void Loader::InitOnce() {
+ loader_infos_lock_ = new Mutex();
zra 2016/07/13 14:51:38 Can this be deleted in a Loader::Shutdown() call s
Florian Schneider 2016/07/13 16:13:58 It could be. But since it is in the embedder, and
zra 2016/07/13 16:16:06 sgtm. Didn't notice this was in bin/
+}
+
+
+Mutex* Loader::loader_infos_lock_;
Loader::LoaderInfo* Loader::loader_infos_ = NULL;
intptr_t Loader::loader_infos_length_ = 0;
intptr_t Loader::loader_infos_capacity_ = 0;
@@ -619,7 +624,7 @@ intptr_t Loader::loader_infos_capacity_ = 0;
// correct loader.
// This happens whenever an isolate begins loading.
void Loader::AddLoader(Dart_Port port, IsolateData* isolate_data) {
- MutexLocker ml(&loader_infos_lock_);
+ MutexLocker ml(loader_infos_lock_);
ASSERT(LoaderForLocked(port) == NULL);
if (loader_infos_length_ == loader_infos_capacity_) {
// Grow to an initial capacity or double in size.
@@ -647,7 +652,7 @@ void Loader::AddLoader(Dart_Port port, IsolateData* isolate_data) {
// Remove |port| from the map.
// This happens once an isolate has finished loading.
void Loader::RemoveLoader(Dart_Port port) {
- MutexLocker ml(&loader_infos_lock_);
+ MutexLocker ml(loader_infos_lock_);
const intptr_t index = LoaderIndexFor(port);
ASSERT(index >= 0);
const intptr_t last = loader_infos_length_ - 1;
@@ -680,14 +685,14 @@ Loader* Loader::LoaderForLocked(Dart_Port port) {
Loader* Loader::LoaderFor(Dart_Port port) {
- MutexLocker ml(&loader_infos_lock_);
+ MutexLocker ml(loader_infos_lock_);
return LoaderForLocked(port);
}
void Loader::NativeMessageHandler(Dart_Port dest_port_id,
Dart_CObject* message) {
- MutexLocker ml(&loader_infos_lock_);
+ MutexLocker ml(loader_infos_lock_);
Loader* loader = LoaderForLocked(dest_port_id);
if (loader == NULL) {
return;
« no previous file with comments | « runtime/bin/loader.h ('k') | runtime/bin/main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698