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

Side by Side Diff: runtime/bin/process.cc

Issue 2463923002: Don't use IsolateData for the exit hook as multiple embedders share the dart/bin while using differ… (Closed)
Patch Set: check secondary Created 4 years, 1 month 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 | « runtime/bin/process.h ('k') | runtime/bin/process_android.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 #if !defined(DART_IO_DISABLED) 5 #if !defined(DART_IO_DISABLED)
6 6
7 #include "bin/process.h" 7 #include "bin/process.h"
8 8
9 #include "bin/dartutils.h" 9 #include "bin/dartutils.h"
10 #include "bin/io_buffer.h" 10 #include "bin/io_buffer.h"
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 intptr_t signal = DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 1)); 239 intptr_t signal = DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 1));
240 bool success = Process::Kill(pid, signal); 240 bool success = Process::Kill(pid, signal);
241 Dart_SetReturnValue(args, Dart_NewBoolean(success)); 241 Dart_SetReturnValue(args, Dart_NewBoolean(success));
242 } 242 }
243 243
244 244
245 void FUNCTION_NAME(Process_Exit)(Dart_NativeArguments args) { 245 void FUNCTION_NAME(Process_Exit)(Dart_NativeArguments args) {
246 int64_t status = 0; 246 int64_t status = 0;
247 // Ignore result if passing invalid argument and just exit 0. 247 // Ignore result if passing invalid argument and just exit 0.
248 DartUtils::GetInt64Value(Dart_GetNativeArgument(args, 0), &status); 248 DartUtils::GetInt64Value(Dart_GetNativeArgument(args, 0), &status);
249 IsolateData* isolate_data = 249 Process::RunExitHook(status);
250 reinterpret_cast<IsolateData*>(Dart_CurrentIsolateData());
251 if (isolate_data->exit_hook() != NULL) {
252 isolate_data->exit_hook()(status);
253 }
254 Dart_ExitIsolate(); 250 Dart_ExitIsolate();
255 Platform::Exit(static_cast<int>(status)); 251 Platform::Exit(static_cast<int>(status));
256 } 252 }
257 253
258 254
259 void FUNCTION_NAME(Process_SetExitCode)(Dart_NativeArguments args) { 255 void FUNCTION_NAME(Process_SetExitCode)(Dart_NativeArguments args) {
260 int64_t status = 0; 256 int64_t status = 0;
261 // Ignore result if passing invalid argument and just set exit code to 0. 257 // Ignore result if passing invalid argument and just set exit code to 0.
262 DartUtils::GetInt64Value(Dart_GetNativeArgument(args, 0), &status); 258 DartUtils::GetInt64Value(Dart_GetNativeArgument(args, 0), &status);
263 Process::SetGlobalExitCode(status); 259 Process::SetGlobalExitCode(status);
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 if (!Dart_IsError(external_array)) { 363 if (!Dart_IsError(external_array)) {
368 memmove(buffer, system_string, system_len); 364 memmove(buffer, system_string, system_len);
369 } 365 }
370 Dart_SetReturnValue(args, external_array); 366 Dart_SetReturnValue(args, external_array);
371 } 367 }
372 368
373 } // namespace bin 369 } // namespace bin
374 } // namespace dart 370 } // namespace dart
375 371
376 #endif // !defined(DART_IO_DISABLED) 372 #endif // !defined(DART_IO_DISABLED)
OLDNEW
« no previous file with comments | « runtime/bin/process.h ('k') | runtime/bin/process_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698