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

Side by Side Diff: runtime/bin/loader.h

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 unified diff | Download patch
« no previous file with comments | « no previous file | runtime/bin/loader.cc » ('j') | runtime/bin/loader.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 #ifndef BIN_LOADER_H_ 5 #ifndef BIN_LOADER_H_
6 #define BIN_LOADER_H_ 6 #define BIN_LOADER_H_
7 7
8 #include "bin/isolate_data.h" 8 #include "bin/isolate_data.h"
9 #include "include/dart_api.h" 9 #include "include/dart_api.h"
10 #include "include/dart_native_api.h" 10 #include "include/dart_native_api.h"
(...skipping 19 matching lines...) Expand all
30 30
31 // A static tag handler that hides all usage of a loader for an isolate. 31 // A static tag handler that hides all usage of a loader for an isolate.
32 static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag, 32 static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag,
33 Dart_Handle library, 33 Dart_Handle library,
34 Dart_Handle url); 34 Dart_Handle url);
35 35
36 Dart_Handle error() const { 36 Dart_Handle error() const {
37 return error_; 37 return error_;
38 } 38 }
39 39
40 static void InitOnce();
41
40 private: 42 private:
41 // The port assigned to our native message handler. 43 // The port assigned to our native message handler.
42 Dart_Port port_; 44 Dart_Port port_;
43 // Each Loader is associated with an Isolate via its IsolateData. 45 // Each Loader is associated with an Isolate via its IsolateData.
44 IsolateData* isolate_data_; 46 IsolateData* isolate_data_;
45 // Remember the first error that occurs during loading. 47 // Remember the first error that occurs during loading.
46 Dart_Handle error_; 48 Dart_Handle error_;
47 // This monitor is used to protect the pending operations count and the 49 // This monitor is used to protect the pending operations count and the
48 // I/O result queue. 50 // I/O result queue.
49 Monitor* monitor_; 51 Monitor* monitor_;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 // message handler callback provides us with the Dart_Port which we use as a 115 // message handler callback provides us with the Dart_Port which we use as a
114 // key into our map of active loaders from |port| to |isolate_data|. 116 // key into our map of active loaders from |port| to |isolate_data|.
115 117
116 // Static information to map Dart_Port back to the isolate in question. 118 // Static information to map Dart_Port back to the isolate in question.
117 struct LoaderInfo { 119 struct LoaderInfo {
118 Dart_Port port; 120 Dart_Port port;
119 IsolateData* isolate_data; 121 IsolateData* isolate_data;
120 }; 122 };
121 123
122 // The map of active loaders. 124 // The map of active loaders.
123 static Mutex loader_infos_lock_; 125 static Mutex* loader_infos_lock_;
124 static LoaderInfo* loader_infos_; 126 static LoaderInfo* loader_infos_;
125 static intptr_t loader_infos_length_; 127 static intptr_t loader_infos_length_;
126 static intptr_t loader_infos_capacity_; 128 static intptr_t loader_infos_capacity_;
127 129
128 static void AddLoader(Dart_Port port, IsolateData* data); 130 static void AddLoader(Dart_Port port, IsolateData* data);
129 static void RemoveLoader(Dart_Port port); 131 static void RemoveLoader(Dart_Port port);
130 static intptr_t LoaderIndexFor(Dart_Port port); 132 static intptr_t LoaderIndexFor(Dart_Port port);
131 static Loader* LoaderFor(Dart_Port port); 133 static Loader* LoaderFor(Dart_Port port);
132 static Loader* LoaderForLocked(Dart_Port port); 134 static Loader* LoaderForLocked(Dart_Port port);
133 135
134 // This is the global callback for the native message handlers. 136 // This is the global callback for the native message handlers.
135 static void NativeMessageHandler(Dart_Port dest_port_id, 137 static void NativeMessageHandler(Dart_Port dest_port_id,
136 Dart_CObject* message); 138 Dart_CObject* message);
137 }; 139 };
138 140
139 } // namespace bin 141 } // namespace bin
140 } // namespace dart 142 } // namespace dart
141 143
142 #endif // BIN_LOADER_H_ 144 #endif // BIN_LOADER_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/loader.cc » ('j') | runtime/bin/loader.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698