Index: src/d8.cc |
diff --git a/src/d8.cc b/src/d8.cc |
index 2b1832a28e6c7e5ccba73900cebfc0346d8851f5..d882e45b24fa198748d4071aa6845cdb40c9ea58 100644 |
--- a/src/d8.cc |
+++ b/src/d8.cc |
@@ -216,6 +216,7 @@ |
ArrayBuffer::Allocator* Shell::array_buffer_allocator; |
ShellOptions Shell::options; |
const char* Shell::kPrompt = "d8> "; |
+base::OnceType Shell::quit_once_ = V8_ONCE_INIT; |
#ifndef V8_SHARED |
bool CounterMap::Match(void* key1, void* key2) { |
@@ -809,13 +810,19 @@ |
#endif // !V8_SHARED |
+void Shell::QuitOnce(v8::FunctionCallbackInfo<v8::Value>* args) { |
+ int exit_code = (*args)[0]->Int32Value(); |
+#ifndef V8_SHARED |
+ CleanupWorkers(); |
+#endif // !V8_SHARED |
+ OnExit(args->GetIsolate()); |
+ exit(exit_code); |
+} |
+ |
+ |
void Shell::Quit(const v8::FunctionCallbackInfo<v8::Value>& args) { |
- int exit_code = args[0]->Int32Value(); |
-#ifndef V8_SHARED |
- CleanupWorkers(); |
-#endif // !V8_SHARED |
- OnExit(args.GetIsolate()); |
- exit(exit_code); |
+ base::CallOnce(&quit_once_, &QuitOnce, |
+ const_cast<v8::FunctionCallbackInfo<v8::Value>*>(&args)); |
} |