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

Unified Diff: runtime/bin/process.cc

Issue 14322011: Add access to process id for both current process and processes started (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: runtime/bin/process.cc
diff --git a/runtime/bin/process.cc b/runtime/bin/process.cc
index 7a0c55503331d3ee0dad171c17c9f183cfbc86b7..c112e853a91ad62610365828a8c37eb83dc55921 100644
--- a/runtime/bin/process.cc
+++ b/runtime/bin/process.cc
@@ -199,6 +199,21 @@ void FUNCTION_NAME(Process_Sleep)(Dart_NativeArguments args) {
}
+void FUNCTION_NAME(Process_Pid)(Dart_NativeArguments args) {
+ Dart_EnterScope();
+ // Ignore result if passing invalid argument and just set exit code to 0.
+ intptr_t pid = -1;
+ Dart_Handle process = Dart_GetNativeArgument(args, 0);
+ if (Dart_IsNull(process)) {
+ pid = Process::CurrentProcessId();
+ } else {
+ Process::GetProcessIdNativeField(process, &pid);
+ }
+ Dart_SetReturnValue(args, Dart_NewInteger(pid));
+ Dart_ExitScope();
+}
+
+
Dart_Handle Process::GetProcessIdNativeField(Dart_Handle process,
intptr_t* pid) {
return Dart_GetNativeInstanceField(process, kProcessIdNativeField, pid);

Powered by Google App Engine
This is Rietveld 408576698