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

Unified Diff: runtime/bin/process.cc

Issue 13641005: Add a sleep function to dart:io (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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 ac75854da63e1d827583a0e1e2d4e0ddf42e2fba..4e5010d2c6fcb3131512f02936455d79d91b666d 100644
--- a/runtime/bin/process.cc
+++ b/runtime/bin/process.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@@ -9,6 +9,7 @@
#include "include/dart_api.h"
+#include "platform/platform_os.h"
static const int kProcessIdNativeField = 0;
@@ -190,6 +191,16 @@ void FUNCTION_NAME(Process_SetExitCode)(Dart_NativeArguments args) {
}
+void FUNCTION_NAME(Process_Sleep)(Dart_NativeArguments args) {
+ Dart_EnterScope();
+ int64_t milliseconds = 0;
+ // Ignore result if passing invalid argument and just set exit code to 0.
+ DartUtils::GetInt64Value(Dart_GetNativeArgument(args, 0), &milliseconds);
+ platform::OS::Sleep(milliseconds);
+ 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