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

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

Issue 50573002: Remove dart:platform library. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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
« no previous file with comments | « runtime/bin/dartutils.h ('k') | runtime/lib/platform_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/dartutils.h" 5 #include "bin/dartutils.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "include/dart_native_api.h" 8 #include "include/dart_native_api.h"
9 9
10 #include "platform/assert.h" 10 #include "platform/assert.h"
(...skipping 11 matching lines...) Expand all
22 22
23 const char* DartUtils::original_working_directory = NULL; 23 const char* DartUtils::original_working_directory = NULL;
24 const char* DartUtils::kDartScheme = "dart:"; 24 const char* DartUtils::kDartScheme = "dart:";
25 const char* DartUtils::kDartExtensionScheme = "dart-ext:"; 25 const char* DartUtils::kDartExtensionScheme = "dart-ext:";
26 const char* DartUtils::kAsyncLibURL = "dart:async"; 26 const char* DartUtils::kAsyncLibURL = "dart:async";
27 const char* DartUtils::kBuiltinLibURL = "dart:builtin"; 27 const char* DartUtils::kBuiltinLibURL = "dart:builtin";
28 const char* DartUtils::kCoreLibURL = "dart:core"; 28 const char* DartUtils::kCoreLibURL = "dart:core";
29 const char* DartUtils::kIOLibURL = "dart:io"; 29 const char* DartUtils::kIOLibURL = "dart:io";
30 const char* DartUtils::kIOLibPatchURL = "dart:io-patch"; 30 const char* DartUtils::kIOLibPatchURL = "dart:io-patch";
31 const char* DartUtils::kUriLibURL = "dart:uri"; 31 const char* DartUtils::kUriLibURL = "dart:uri";
32 const char* DartUtils::kPlatformLibURL = "dart:platform";
33 const char* DartUtils::kHttpScheme = "http:"; 32 const char* DartUtils::kHttpScheme = "http:";
34 33
35 const char* DartUtils::kIdFieldName = "_id"; 34 const char* DartUtils::kIdFieldName = "_id";
36 35
37 uint8_t DartUtils::magic_number[] = { 0xf5, 0xf5, 0xdc, 0xdc }; 36 uint8_t DartUtils::magic_number[] = { 0xf5, 0xf5, 0xdc, 0xdc };
38 37
39 static bool IsWindowsHost() { 38 static bool IsWindowsHost() {
40 #if defined(TARGET_OS_WINDOWS) 39 #if defined(TARGET_OS_WINDOWS)
41 return true; 40 return true;
42 #else // defined(TARGET_OS_WINDOWS) 41 #else // defined(TARGET_OS_WINDOWS)
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 } 704 }
706 705
707 // Set current working directory. 706 // Set current working directory.
708 result = SetWorkingDirectory(builtin_lib); 707 result = SetWorkingDirectory(builtin_lib);
709 if (Dart_IsError(result)) { 708 if (Dart_IsError(result)) {
710 return result; 709 return result;
711 } 710 }
712 711
713 // Set up package root if specified. 712 // Set up package root if specified.
714 if (package_root != NULL) { 713 if (package_root != NULL) {
715 Dart_Handle package_root_string = NewString(package_root); 714 result = NewString(package_root);
716 if (Dart_IsError(package_root_string)) { 715 if (!Dart_IsError(result)) {
717 return package_root_string; 716 const int kNumArgs = 1;
718 } 717 Dart_Handle dart_args[kNumArgs];
719 const int kNumArgs = 1; 718 dart_args[0] = result;
720 Dart_Handle dart_args[kNumArgs]; 719 return Dart_Invoke(builtin_lib,
721 dart_args[0] = package_root_string;
722 result = Dart_Invoke(builtin_lib,
723 NewString("_setPackageRoot"), 720 NewString("_setPackageRoot"),
724 kNumArgs, 721 kNumArgs,
725 dart_args); 722 dart_args);
726 if (Dart_IsError(result)) {
727 return result;
728 } 723 }
729 } 724 }
730
731 // Setup the platform library's _platform object.
732 internal_lib = Dart_LookupLibrary(NewString(kPlatformLibURL));
733 DART_CHECK_VALID(internal_lib);
734 Dart_Handle platform =
735 Dart_Invoke(builtin_lib, NewString("_getPlatform"), 0, NULL);
736 result = Dart_SetField(internal_lib, NewString("_platform"), platform);
737 DART_CHECK_VALID(result);
738 return result; 725 return result;
739 } 726 }
740 727
741 728
742 const char* DartUtils::GetCanonicalPath(const char* reference_dir, 729 const char* DartUtils::GetCanonicalPath(const char* reference_dir,
743 const char* filename) { 730 const char* filename) {
744 if (File::IsAbsolutePath(filename)) { 731 if (File::IsAbsolutePath(filename)) {
745 return strdup(filename); 732 return strdup(filename);
746 } 733 }
747 734
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
1055 new CObjectString(CObject::NewString(os_error->message())); 1042 new CObjectString(CObject::NewString(os_error->message()));
1056 CObjectArray* result = new CObjectArray(CObject::NewArray(3)); 1043 CObjectArray* result = new CObjectArray(CObject::NewArray(3));
1057 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError))); 1044 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError)));
1058 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code()))); 1045 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code())));
1059 result->SetAt(2, error_message); 1046 result->SetAt(2, error_message);
1060 return result; 1047 return result;
1061 } 1048 }
1062 1049
1063 } // namespace bin 1050 } // namespace bin
1064 } // namespace dart 1051 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/bin/dartutils.h ('k') | runtime/lib/platform_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698