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

Unified Diff: runtime/bin/process.cc

Issue 13704003: Reapply "Add a sleep function to dart:io" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Added "hide sleep" where needed 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 ac75854da63e1d827583a0e1e2d4e0ddf42e2fba..7a0c55503331d3ee0dad171c17c9f183cfbc86b7 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,7 +9,6 @@
#include "include/dart_api.h"
-
static const int kProcessIdNativeField = 0;
int Process::global_exit_code_ = 0;
@@ -190,6 +189,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);
+ TimerUtils::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