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

Unified Diff: runtime/lib/platform_patch.dart

Issue 36883005: Add fields to platform library, implement them on runtime dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address all comments Created 7 years, 2 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/lib/platform_patch.dart
diff --git a/runtime/lib/platform_patch.dart b/runtime/lib/platform_patch.dart
index 8df6d946c9c5d72ba154d01612807fdee14cbe56..cc1c1879fa362ec2fff4fca3d1d1443dd1ea1d5e 100644
--- a/runtime/lib/platform_patch.dart
+++ b/runtime/lib/platform_patch.dart
@@ -2,3 +2,88 @@
// 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.
+patch int get numberOfProcessors => _platform.numberOfProcessors;
+
+patch String get pathSeparator => _platform.pathSeparator;
+
+patch String get operatingSystem => _platform.operatingSystem;
+
+patch String get localHostname => _platform.localHostname;
+
+patch String get version => _platform.version;
+
+patch Map<String, String> get environment => _platform.environment;
+
+patch String get executable => _platform.executable;
+
+patch Uri get script => _platform.script;
+
+patch List<String> get executableArguments => _platform.executableArguments;
+
+patch String get packageRoot => _platform.packageRoot;
+
+patch bool get isLinux => _platform.operatingSystem == "linux";
+
+patch bool get isMacOS => _platform.operatingSystem == "macos";
+
+patch bool get isWindows => _platform.operatingSystem == "windows";
+
+patch bool get isAndroid => _platform.operatingSystem == "android";
+
+class _Platform {
+ int get numberOfProcessors;
+ String get pathSeparator;
+ String get operatingSystem;
+ String get localHostname;
+ String get version;
+ Map get environment;
+ Uri get script;
+ String get executable;
+ List<String> get executableArguments;
+ String get packageRoot;
+}
+
+// A non-default _Platform, with real values, is stored here by the embedder.
+_Platform _platform = new _DefaultPlatform();
+
+class _DefaultPlatform implements _Platform {
+ int get numberOfProcessors {
+ return null;
+ }
+
+ String get pathSeparator {
+ return "/";
+ }
+
+ String get operatingSystem {
+ return null;
+ }
+
+ String get localHostname {
+ return null;
+ }
+
+ String get version {
+ return null;
+ }
+
+ Map get environment {
+ return null;
+ }
+
+ Uri get script {
+ return null;
+ }
+
+ String get executable {
+ return null;
+ }
+
+ List<String> get executableArguments {
+ return new List<String>(0);
+ }
+
+ String get packageRoot {
+ return null;
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698