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

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

Issue 1535743002: - Make sure that externals are patched for dart2js. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: More removal of native code. Created 5 years 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
« no previous file with comments | « runtime/bin/platform.h ('k') | sdk/lib/_internal/js_runtime/lib/io_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) 2012, 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/platform.h" 5 #include "bin/platform.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 8
9 #include "bin/file.h" 9 #include "bin/file.h"
10 #include "bin/utils.h" 10 #include "bin/utils.h"
11 11
12 namespace dart { 12 namespace dart {
13 namespace bin { 13 namespace bin {
14 14
15 const char* Platform::executable_name_ = NULL; 15 const char* Platform::executable_name_ = NULL;
16 const char* Platform::resolved_executable_name_ = NULL; 16 const char* Platform::resolved_executable_name_ = NULL;
17 const char* Platform::package_root_ = NULL;
18 int Platform::script_index_ = 1; 17 int Platform::script_index_ = 1;
19 char** Platform::argv_ = NULL; 18 char** Platform::argv_ = NULL;
20 19
21 void FUNCTION_NAME(Platform_NumberOfProcessors)(Dart_NativeArguments args) { 20 void FUNCTION_NAME(Platform_NumberOfProcessors)(Dart_NativeArguments args) {
22 Dart_SetReturnValue(args, Dart_NewInteger(Platform::NumberOfProcessors())); 21 Dart_SetReturnValue(args, Dart_NewInteger(Platform::NumberOfProcessors()));
23 } 22 }
24 23
25 24
26 void FUNCTION_NAME(Platform_OperatingSystem)(Dart_NativeArguments args) { 25 void FUNCTION_NAME(Platform_OperatingSystem)(Dart_NativeArguments args) {
27 Dart_SetReturnValue(args, DartUtils::NewString(Platform::OperatingSystem())); 26 Dart_SetReturnValue(args, DartUtils::NewString(Platform::OperatingSystem()));
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 Dart_Handle str = DartUtils::NewString(argv[i]); 68 Dart_Handle str = DartUtils::NewString(argv[i]);
70 Dart_Handle error = Dart_ListSetAt(result, i - 1, str); 69 Dart_Handle error = Dart_ListSetAt(result, i - 1, str);
71 if (Dart_IsError(error)) { 70 if (Dart_IsError(error)) {
72 Dart_PropagateError(error); 71 Dart_PropagateError(error);
73 } 72 }
74 } 73 }
75 Dart_SetReturnValue(args, result); 74 Dart_SetReturnValue(args, result);
76 } 75 }
77 76
78 77
79 void FUNCTION_NAME(Platform_PackageRoot)(Dart_NativeArguments args) {
80 const char* package_root = Platform::GetPackageRoot();
81 if (package_root == NULL) {
82 package_root = "";
83 }
84 Dart_SetReturnValue(args, Dart_NewStringFromCString(package_root));
85 }
86
87
88 void FUNCTION_NAME(Platform_Environment)(Dart_NativeArguments args) { 78 void FUNCTION_NAME(Platform_Environment)(Dart_NativeArguments args) {
89 intptr_t count = 0; 79 intptr_t count = 0;
90 char** env = Platform::Environment(&count); 80 char** env = Platform::Environment(&count);
91 if (env == NULL) { 81 if (env == NULL) {
92 OSError error(-1, 82 OSError error(-1,
93 "Failed to retrieve environment variables.", 83 "Failed to retrieve environment variables.",
94 OSError::kUnknown); 84 OSError::kUnknown);
95 Dart_SetReturnValue(args, DartUtils::NewDartOSError(&error)); 85 Dart_SetReturnValue(args, DartUtils::NewDartOSError(&error));
96 } else { 86 } else {
97 Dart_Handle result = Dart_NewList(count); 87 Dart_Handle result = Dart_NewList(count);
(...skipping 18 matching lines...) Expand all
116 } 106 }
117 } 107 }
118 108
119 109
120 void FUNCTION_NAME(Platform_GetVersion)(Dart_NativeArguments args) { 110 void FUNCTION_NAME(Platform_GetVersion)(Dart_NativeArguments args) {
121 Dart_SetReturnValue(args, Dart_NewStringFromCString(Dart_VersionString())); 111 Dart_SetReturnValue(args, Dart_NewStringFromCString(Dart_VersionString()));
122 } 112 }
123 113
124 } // namespace bin 114 } // namespace bin
125 } // namespace dart 115 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/bin/platform.h ('k') | sdk/lib/_internal/js_runtime/lib/io_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698