mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 00:13:50 +00:00
[VM] Allow for Dart_SetVMFlags to be called again after Dart_Cleanup
Change-Id: Icf07258cfb05a987e0a439277a59825c06f993b2 Reviewed-on: https://dart-review.googlesource.com/77486 Auto-Submit: Ben Konyi <bkonyi@google.com> Reviewed-by: Zach Anderson <zra@google.com> Commit-Queue: Ben Konyi <bkonyi@google.com>
This commit is contained in:
parent
d70b0fa3be
commit
07a8496919
|
@ -281,6 +281,8 @@ static int Main(int argc, const char** argv) {
|
|||
TesterState::vm_snapshot_data = dart::bin::vm_snapshot_data;
|
||||
TesterState::create_callback = CreateIsolateAndSetup;
|
||||
TesterState::cleanup_callback = CleanupIsolate;
|
||||
TesterState::argv = dart_argv;
|
||||
TesterState::argc = dart_argc;
|
||||
|
||||
error = Dart::Init(
|
||||
dart::bin::vm_snapshot_data, dart::bin::vm_snapshot_instructions,
|
||||
|
|
|
@ -531,6 +531,7 @@ const char* Dart::Cleanup() {
|
|||
OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Done\n", UptimeMillis());
|
||||
}
|
||||
MallocHooks::Cleanup();
|
||||
Flags::Cleanup();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ DECLARE_FLAG(bool, use_dart_frontend);
|
|||
#ifndef PRODUCT
|
||||
|
||||
UNIT_TEST_CASE(DartAPI_DartInitializeAfterCleanup) {
|
||||
EXPECT(Dart_SetVMFlags(TesterState::argc, TesterState::argv) == NULL);
|
||||
Dart_InitializeParams params;
|
||||
memset(¶ms, 0, sizeof(Dart_InitializeParams));
|
||||
params.version = DART_INITIALIZE_PARAMS_CURRENT_VERSION;
|
||||
|
|
|
@ -177,6 +177,11 @@ bool Flags::IsSet(const char* name) {
|
|||
(flag->bool_ptr_ != NULL) && (*flag->bool_ptr_ == true);
|
||||
}
|
||||
|
||||
void Flags::Cleanup() {
|
||||
ASSERT(initialized_);
|
||||
initialized_ = false;
|
||||
}
|
||||
|
||||
void Flags::AddFlag(Flag* flag) {
|
||||
ASSERT(!initialized_);
|
||||
if (num_flags_ == capacity_) {
|
||||
|
|
|
@ -71,6 +71,8 @@ class Flags {
|
|||
|
||||
static bool Initialized() { return initialized_; }
|
||||
|
||||
static void Cleanup();
|
||||
|
||||
#ifndef PRODUCT
|
||||
static void PrintJSON(JSONStream* js);
|
||||
#endif // !PRODUCT
|
||||
|
|
|
@ -41,6 +41,8 @@ const uint8_t* TesterState::vm_snapshot_data = NULL;
|
|||
Dart_IsolateCreateCallback TesterState::create_callback = NULL;
|
||||
Dart_IsolateShutdownCallback TesterState::shutdown_callback = NULL;
|
||||
Dart_IsolateCleanupCallback TesterState::cleanup_callback = NULL;
|
||||
const char** TesterState::argv = NULL;
|
||||
int TesterState::argc = 0;
|
||||
|
||||
DEFINE_FLAG(bool,
|
||||
use_dart_frontend,
|
||||
|
|
|
@ -281,6 +281,8 @@ class TesterState : public AllStatic {
|
|||
static Dart_IsolateCreateCallback create_callback;
|
||||
static Dart_IsolateShutdownCallback shutdown_callback;
|
||||
static Dart_IsolateCleanupCallback cleanup_callback;
|
||||
static const char** argv;
|
||||
static int argc;
|
||||
};
|
||||
|
||||
class KernelBufferList {
|
||||
|
|
Loading…
Reference in a new issue