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

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

Issue 8380020: Refactor the dart api a bit: (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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/process.h" 6 #include "bin/process.h"
7 7
8 #include "include/dart_api.h" 8 #include "include/dart_api.h"
9 9
10 void FUNCTION_NAME(Process_Start)(Dart_NativeArguments args) { 10 void FUNCTION_NAME(Process_Start)(Dart_NativeArguments args) {
11 Dart_EnterScope(); 11 Dart_EnterScope();
12 Dart_Handle process = Dart_GetNativeArgument(args, 0); 12 Dart_Handle process = Dart_GetNativeArgument(args, 0);
13 intptr_t in; 13 intptr_t in;
14 intptr_t out; 14 intptr_t out;
15 intptr_t err; 15 intptr_t err;
16 intptr_t exit_event; 16 intptr_t exit_event;
17 const char* path = 17 const char* path =
18 DartUtils::GetStringValue(Dart_GetNativeArgument(args, 1)); 18 DartUtils::GetStringValue(Dart_GetNativeArgument(args, 1));
19 Dart_Handle arguments = Dart_GetNativeArgument(args, 2); 19 Dart_Handle arguments = Dart_GetNativeArgument(args, 2);
20 ASSERT(Dart_IsArray(arguments)); 20 ASSERT(Dart_IsArray(arguments));
21 Dart_Result result = Dart_GetLength(arguments); 21 intptr_t length = 0;
22 ASSERT(Dart_IsValidResult(result)); 22 Dart_Handle result = Dart_GetLength(arguments, &length);
23 intptr_t length = Dart_GetResultAsCIntptr(result); 23 ASSERT(Dart_IsValid(result));
24 char** string_args = new char*[length]; 24 char** string_args = new char*[length];
25 for (int i = 0; i < length; i++) { 25 for (int i = 0; i < length; i++) {
26 result = Dart_ArrayGetAt(arguments, i); 26 Dart_Handle arg = Dart_ArrayGetAt(arguments, i);
27 ASSERT(Dart_IsValidResult(result)); 27 ASSERT(Dart_IsValid(arg));
28 Dart_Handle arg = Dart_GetResult(result);
29 string_args[i] = const_cast<char *>(DartUtils::GetStringValue(arg)); 28 string_args[i] = const_cast<char *>(DartUtils::GetStringValue(arg));
30 } 29 }
31 Dart_Handle in_handle = Dart_GetNativeArgument(args, 3); 30 Dart_Handle in_handle = Dart_GetNativeArgument(args, 3);
32 Dart_Handle out_handle = Dart_GetNativeArgument(args, 4); 31 Dart_Handle out_handle = Dart_GetNativeArgument(args, 4);
33 Dart_Handle err_handle = Dart_GetNativeArgument(args, 5); 32 Dart_Handle err_handle = Dart_GetNativeArgument(args, 5);
34 Dart_Handle exit_handle = Dart_GetNativeArgument(args, 6); 33 Dart_Handle exit_handle = Dart_GetNativeArgument(args, 6);
35 Dart_Handle status_handle = Dart_GetNativeArgument(args, 7); 34 Dart_Handle status_handle = Dart_GetNativeArgument(args, 7);
36 intptr_t pid = -1; 35 intptr_t pid = -1;
37 static const int kMaxChildOsErrorMessageLength = 256; 36 static const int kMaxChildOsErrorMessageLength = 256;
38 char os_error_message[kMaxChildOsErrorMessageLength]; 37 char os_error_message[kMaxChildOsErrorMessageLength];
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 Dart_ExitScope(); 69 Dart_ExitScope();
71 } 70 }
72 71
73 72
74 void FUNCTION_NAME(Process_Exit)(Dart_NativeArguments args) { 73 void FUNCTION_NAME(Process_Exit)(Dart_NativeArguments args) {
75 Dart_EnterScope(); 74 Dart_EnterScope();
76 intptr_t pid = DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 1)); 75 intptr_t pid = DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 1));
77 Process::Exit(pid); 76 Process::Exit(pid);
78 Dart_ExitScope(); 77 Dart_ExitScope();
79 } 78 }
OLDNEW
« no previous file with comments | « runtime/bin/main.cc ('k') | runtime/bin/process_script.h » ('j') | runtime/include/dart_api.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698