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

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

Issue 3006873002: [dart:io] Adds Platform.operatingSystemVersion (Closed)
Patch Set: Updated CHANGELOG Created 3 years, 3 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
« no previous file with comments | « runtime/bin/platform.h ('k') | runtime/bin/platform_android.cc » ('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 "bin/file.h" 7 #include "bin/file.h"
8 #include "bin/utils.h" 8 #include "bin/utils.h"
9 #include "include/dart_api.h" 9 #include "include/dart_api.h"
10 10
11 namespace dart { 11 namespace dart {
12 namespace bin { 12 namespace bin {
13 13
14 void FUNCTION_NAME(Platform_NumberOfProcessors)(Dart_NativeArguments args) { 14 void FUNCTION_NAME(Platform_NumberOfProcessors)(Dart_NativeArguments args) {
15 Dart_SetReturnValue(args, Dart_NewInteger(Platform::NumberOfProcessors())); 15 Dart_SetReturnValue(args, Dart_NewInteger(Platform::NumberOfProcessors()));
16 } 16 }
17 17
18 void FUNCTION_NAME(Platform_OperatingSystem)(Dart_NativeArguments args) { 18 void FUNCTION_NAME(Platform_OperatingSystem)(Dart_NativeArguments args) {
19 Dart_SetReturnValue(args, DartUtils::NewString(Platform::OperatingSystem())); 19 Dart_SetReturnValue(args, DartUtils::NewString(Platform::OperatingSystem()));
20 } 20 }
21 21
22 void FUNCTION_NAME(Platform_OperatingSystemVersion)(Dart_NativeArguments args) {
23 const char* version = Platform::OperatingSystemVersion();
24 if (version == NULL) {
25 Dart_SetReturnValue(args, DartUtils::NewDartOSError());
26 } else {
27 Dart_SetReturnValue(args, DartUtils::NewString(version));
28 }
29 }
30
22 void FUNCTION_NAME(Platform_PathSeparator)(Dart_NativeArguments args) { 31 void FUNCTION_NAME(Platform_PathSeparator)(Dart_NativeArguments args) {
23 Dart_SetReturnValue(args, DartUtils::NewString(File::PathSeparator())); 32 Dart_SetReturnValue(args, DartUtils::NewString(File::PathSeparator()));
24 } 33 }
25 34
26 void FUNCTION_NAME(Platform_LocalHostname)(Dart_NativeArguments args) { 35 void FUNCTION_NAME(Platform_LocalHostname)(Dart_NativeArguments args) {
27 const intptr_t HOSTNAME_LENGTH = 256; 36 const intptr_t HOSTNAME_LENGTH = 256;
28 char hostname[HOSTNAME_LENGTH]; 37 char hostname[HOSTNAME_LENGTH];
29 if (Platform::LocalHostname(hostname, HOSTNAME_LENGTH)) { 38 if (Platform::LocalHostname(hostname, HOSTNAME_LENGTH)) {
30 Dart_SetReturnValue(args, DartUtils::NewString(hostname)); 39 Dart_SetReturnValue(args, DartUtils::NewString(hostname));
31 } else { 40 } else {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 const char* locale = Platform::LocaleName(); 112 const char* locale = Platform::LocaleName();
104 if (locale == NULL) { 113 if (locale == NULL) {
105 Dart_SetReturnValue(args, DartUtils::NewDartOSError()); 114 Dart_SetReturnValue(args, DartUtils::NewDartOSError());
106 } else { 115 } else {
107 Dart_SetReturnValue(args, Dart_NewStringFromCString(locale)); 116 Dart_SetReturnValue(args, Dart_NewStringFromCString(locale));
108 } 117 }
109 } 118 }
110 119
111 } // namespace bin 120 } // namespace bin
112 } // namespace dart 121 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/bin/platform.h ('k') | runtime/bin/platform_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698