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

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

Issue 13565005: Revert r20952, r20953, r20954 (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/bin/io_natives.cc ('k') | runtime/bin/process_patch.dart » ('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) 2012, 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 #include "bin/dartutils.h" 5 #include "bin/dartutils.h"
6 #include "bin/io_buffer.h" 6 #include "bin/io_buffer.h"
7 #include "bin/process.h" 7 #include "bin/process.h"
8 #include "bin/socket.h" 8 #include "bin/socket.h"
9 9
10 #include "include/dart_api.h" 10 #include "include/dart_api.h"
11 11
12
12 static const int kProcessIdNativeField = 0; 13 static const int kProcessIdNativeField = 0;
13 14
14 int Process::global_exit_code_ = 0; 15 int Process::global_exit_code_ = 0;
15 dart::Mutex Process::global_exit_code_mutex_; 16 dart::Mutex Process::global_exit_code_mutex_;
16 17
17 // Extract an array of C strings from a list of Dart strings. 18 // Extract an array of C strings from a list of Dart strings.
18 static char** ExtractCStringList(Dart_Handle strings, 19 static char** ExtractCStringList(Dart_Handle strings,
19 Dart_Handle status_handle, 20 Dart_Handle status_handle,
20 const char* error_msg, 21 const char* error_msg,
21 intptr_t* length) { 22 intptr_t* length) {
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 void FUNCTION_NAME(Process_SetExitCode)(Dart_NativeArguments args) { 183 void FUNCTION_NAME(Process_SetExitCode)(Dart_NativeArguments args) {
183 Dart_EnterScope(); 184 Dart_EnterScope();
184 int64_t status = 0; 185 int64_t status = 0;
185 // Ignore result if passing invalid argument and just set exit code to 0. 186 // Ignore result if passing invalid argument and just set exit code to 0.
186 DartUtils::GetInt64Value(Dart_GetNativeArgument(args, 0), &status); 187 DartUtils::GetInt64Value(Dart_GetNativeArgument(args, 0), &status);
187 Process::SetGlobalExitCode(status); 188 Process::SetGlobalExitCode(status);
188 Dart_ExitScope(); 189 Dart_ExitScope();
189 } 190 }
190 191
191 192
192 void FUNCTION_NAME(Process_Sleep)(Dart_NativeArguments args) {
193 Dart_EnterScope();
194 int64_t milliseconds = 0;
195 // Ignore result if passing invalid argument and just set exit code to 0.
196 DartUtils::GetInt64Value(Dart_GetNativeArgument(args, 0), &milliseconds);
197 TimerUtils::Sleep(milliseconds);
198 Dart_ExitScope();
199 }
200
201
202 Dart_Handle Process::GetProcessIdNativeField(Dart_Handle process, 193 Dart_Handle Process::GetProcessIdNativeField(Dart_Handle process,
203 intptr_t* pid) { 194 intptr_t* pid) {
204 return Dart_GetNativeInstanceField(process, kProcessIdNativeField, pid); 195 return Dart_GetNativeInstanceField(process, kProcessIdNativeField, pid);
205 } 196 }
206 197
207 198
208 Dart_Handle Process::SetProcessIdNativeField(Dart_Handle process, 199 Dart_Handle Process::SetProcessIdNativeField(Dart_Handle process,
209 intptr_t pid) { 200 intptr_t pid) {
210 return Dart_SetNativeInstanceField(process, kProcessIdNativeField, pid); 201 return Dart_SetNativeInstanceField(process, kProcessIdNativeField, pid);
211 } 202 }
(...skipping 26 matching lines...) Expand all
238 const char* utf8 = DartUtils::GetStringValue(str); 229 const char* utf8 = DartUtils::GetStringValue(str);
239 const char* system_string = StringUtils::Utf8ToConsoleString(utf8); 230 const char* system_string = StringUtils::Utf8ToConsoleString(utf8);
240 int external_length = strlen(system_string); 231 int external_length = strlen(system_string);
241 uint8_t* buffer = NULL; 232 uint8_t* buffer = NULL;
242 Dart_Handle external_array = IOBuffer::Allocate(external_length, &buffer); 233 Dart_Handle external_array = IOBuffer::Allocate(external_length, &buffer);
243 memmove(buffer, system_string, external_length); 234 memmove(buffer, system_string, external_length);
244 if (utf8 != system_string) free(const_cast<char*>(system_string)); 235 if (utf8 != system_string) free(const_cast<char*>(system_string));
245 Dart_SetReturnValue(args, external_array); 236 Dart_SetReturnValue(args, external_array);
246 Dart_ExitScope(); 237 Dart_ExitScope();
247 } 238 }
OLDNEW
« no previous file with comments | « runtime/bin/io_natives.cc ('k') | runtime/bin/process_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698