Chromium Code Reviews| Index: runtime/vm/isolate.cc |
| diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc |
| index 9381e1f74b1cb9c29907c14d357c67c92064d5fe..e9bb4c95432e879757384df5f032706b8661ea60 100644 |
| --- a/runtime/vm/isolate.cc |
| +++ b/runtime/vm/isolate.cc |
| @@ -691,12 +691,18 @@ MessageHandler::MessageStatus IsolateMessageHandler::ProcessUnhandledException( |
| } |
| void Isolate::FlagsInitialize(Dart_IsolateFlags* api_flags) { |
| + const bool false_by_default = false; |
| + const bool true_by_default = true; |
| + USE(true_by_default); |
| + USE(false_by_default); |
| + |
| api_flags->version = DART_FLAGS_CURRENT_VERSION; |
| #define INIT_FROM_FLAG(name, bitname, isolate_flag, flag) \ |
| api_flags->isolate_flag = flag; |
| ISOLATE_FLAG_LIST(INIT_FROM_FLAG) |
| #undef INIT_FROM_FLAG |
| api_flags->use_dart_frontend = false; |
| + api_flags->entry_points = NULL; |
| } |
| void Isolate::FlagsCopyTo(Dart_IsolateFlags* api_flags) const { |
| @@ -706,6 +712,7 @@ void Isolate::FlagsCopyTo(Dart_IsolateFlags* api_flags) const { |
| ISOLATE_FLAG_LIST(INIT_FROM_FIELD) |
| #undef INIT_FROM_FIELD |
| api_flags->use_dart_frontend = use_dart_frontend(); |
| + api_flags->entry_points = NULL; |
| } |
| void Isolate::FlagsCopyFrom(const Dart_IsolateFlags& api_flags) { |
| @@ -716,6 +723,26 @@ void Isolate::FlagsCopyFrom(const Dart_IsolateFlags& api_flags) { |
| #undef SET_FROM_FLAG |
| #endif // !defined(PRODUCT) |
| set_use_dart_frontend(api_flags.use_dart_frontend); |
| + |
| + // Copy entry points list. |
| + ASSERT(embedder_entry_points_ == NULL); |
| + if (api_flags.entry_points != NULL) { |
| + intptr_t count = 0; |
| + while (api_flags.entry_points[count].function_name != NULL) |
| + count++; |
| + embedder_entry_points_ = new Dart_QualifiedFunctionName[count + 1]; |
| + for (intptr_t i = 0; i < count; i++) { |
| + embedder_entry_points_[i].library_uri = |
| + strdup(api_flags.entry_points[i].library_uri); |
| + embedder_entry_points_[i].class_name = |
| + strdup(api_flags.entry_points[i].class_name); |
| + embedder_entry_points_[i].function_name = |
| + strdup(api_flags.entry_points[i].function_name); |
| + } |
| + memset(&embedder_entry_points_[count], sizeof(Dart_QualifiedFunctionName), |
| + 0); |
| + } |
| + |
| // Leave others at defaults. |
| } |
|
rmacnak
2017/08/23 01:16:50
if (obfuscate) {
OS::Print("Warning: This VM has
Vyacheslav Egorov (Google)
2017/08/23 15:54:52
Done.
|
| @@ -815,7 +842,8 @@ Isolate::Isolate(const Dart_IsolateFlags& api_flags) |
| spawn_count_monitor_(new Monitor()), |
| spawn_count_(0), |
| handler_info_cache_(), |
| - catch_entry_state_cache_() { |
| + catch_entry_state_cache_(), |
| + embedder_entry_points_(NULL) { |
| FlagsCopyFrom(api_flags); |
| SetErrorsFatal(true); |
| set_compilation_allowed(true); |
| @@ -870,6 +898,15 @@ Isolate::~Isolate() { |
| delete spawn_count_monitor_; |
| delete safepoint_handler_; |
| delete thread_registry_; |
| + |
| + if (embedder_entry_points_ != NULL) { |
| + for (intptr_t i = 0; embedder_entry_points_[i].function_name != NULL; i++) { |
| + free(const_cast<char*>(embedder_entry_points_[i].library_uri)); |
| + free(const_cast<char*>(embedder_entry_points_[i].class_name)); |
| + free(const_cast<char*>(embedder_entry_points_[i].function_name)); |
| + } |
| + } |
| + delete[] embedder_entry_points_; |
| } |
| void Isolate::InitOnce() { |