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

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

Issue 10574037: Add dart:web to VM. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « runtime/bin/dartutils.h ('k') | runtime/bin/main.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/dartutils.h" 5 #include "bin/dartutils.h"
6 6
7 #include "bin/file.h" 7 #include "bin/file.h"
8 #include "include/dart_api.h" 8 #include "include/dart_api.h"
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "platform/globals.h" 10 #include "platform/globals.h"
11 11
12 const char* DartUtils::kDartScheme = "dart:"; 12 const char* DartUtils::kDartScheme = "dart:";
13 const char* DartUtils::kDartExtensionScheme = "dart-ext:"; 13 const char* DartUtils::kDartExtensionScheme = "dart-ext:";
14 const char* DartUtils::kBuiltinLibURL = "dart:builtin"; 14 const char* DartUtils::kBuiltinLibURL = "dart:builtin";
15 const char* DartUtils::kCoreLibURL = "dart:core"; 15 const char* DartUtils::kCoreLibURL = "dart:core";
16 const char* DartUtils::kCoreImplLibURL = "dart:coreimpl"; 16 const char* DartUtils::kCoreImplLibURL = "dart:coreimpl";
17 const char* DartUtils::kCryptoLibURL = "dart:crypto"; 17 const char* DartUtils::kCryptoLibURL = "dart:crypto";
18 const char* DartUtils::kIOLibURL = "dart:io"; 18 const char* DartUtils::kIOLibURL = "dart:io";
19 const char* DartUtils::kJsonLibURL = "dart:json"; 19 const char* DartUtils::kJsonLibURL = "dart:json";
20 const char* DartUtils::kUriLibURL = "dart:uri"; 20 const char* DartUtils::kUriLibURL = "dart:uri";
21 const char* DartUtils::kUtfLibURL = "dart:utf"; 21 const char* DartUtils::kUtfLibURL = "dart:utf";
22 const char* DartUtils::kIsolateLibURL = "dart:isolate"; 22 const char* DartUtils::kIsolateLibURL = "dart:isolate";
23 const char* DartUtils::kWebLibURL = "dart:web";
23 24
24 25
25 const char* DartUtils::kIdFieldName = "_id"; 26 const char* DartUtils::kIdFieldName = "_id";
26 27
27 28
28 static const char* MapLibraryUrl(CommandLineOptions* url_mapping, 29 static const char* MapLibraryUrl(CommandLineOptions* url_mapping,
29 const char* url_string) { 30 const char* url_string) {
30 ASSERT(url_mapping != NULL); 31 ASSERT(url_mapping != NULL);
31 // We need to check if the passed in url is found in the url_mapping array, 32 // We need to check if the passed in url is found in the url_mapping array,
32 // in that case use the mapped entry. 33 // in that case use the mapped entry.
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 bool DartUtils::IsDartUriLibURL(const char* url_name) { 147 bool DartUtils::IsDartUriLibURL(const char* url_name) {
147 return (strcmp(url_name, kUriLibURL) == 0); 148 return (strcmp(url_name, kUriLibURL) == 0);
148 } 149 }
149 150
150 151
151 bool DartUtils::IsDartUtfLibURL(const char* url_name) { 152 bool DartUtils::IsDartUtfLibURL(const char* url_name) {
152 return (strcmp(url_name, kUtfLibURL) == 0); 153 return (strcmp(url_name, kUtfLibURL) == 0);
153 } 154 }
154 155
155 156
157 bool DartUtils::IsDartWebLibURL(const char* url_name) {
158 return (strcmp(url_name, kWebLibURL) == 0);
159 }
160
161
156 Dart_Handle DartUtils::CanonicalizeURL(CommandLineOptions* url_mapping, 162 Dart_Handle DartUtils::CanonicalizeURL(CommandLineOptions* url_mapping,
157 Dart_Handle library, 163 Dart_Handle library,
158 const char* url_str) { 164 const char* url_str) {
159 // Get the url of the including library. 165 // Get the url of the including library.
160 Dart_Handle library_url = Dart_LibraryUrl(library); 166 Dart_Handle library_url = Dart_LibraryUrl(library);
161 if (Dart_IsError(library_url)) { 167 if (Dart_IsError(library_url)) {
162 return Dart_Error("accessing library url failed"); 168 return Dart_Error("accessing library url failed");
163 } 169 }
164 if (!Dart_IsString8(library_url)) { 170 if (!Dart_IsString8(library_url)) {
165 return Dart_Error("library url is not a string"); 171 return Dart_Error("library url is not a string");
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 459
454 CObject* CObject::NewOSError(OSError* os_error) { 460 CObject* CObject::NewOSError(OSError* os_error) {
455 CObject* error_message = 461 CObject* error_message =
456 new CObjectString(CObject::NewString(os_error->message())); 462 new CObjectString(CObject::NewString(os_error->message()));
457 CObjectArray* result = new CObjectArray(CObject::NewArray(3)); 463 CObjectArray* result = new CObjectArray(CObject::NewArray(3));
458 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError))); 464 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError)));
459 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code()))); 465 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code())));
460 result->SetAt(2, error_message); 466 result->SetAt(2, error_message);
461 return result; 467 return result;
462 } 468 }
OLDNEW
« no previous file with comments | « runtime/bin/dartutils.h ('k') | runtime/bin/main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698