OLD | NEW |
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::kBuiltinLibURL = "dart:builtin"; | 14 const char* DartUtils::kBuiltinLibURL = "dart:builtin"; |
14 const char* DartUtils::kCoreLibURL = "dart:core"; | 15 const char* DartUtils::kCoreLibURL = "dart:core"; |
15 const char* DartUtils::kCoreImplLibURL = "dart:coreimpl"; | 16 const char* DartUtils::kCoreImplLibURL = "dart:coreimpl"; |
16 const char* DartUtils::kIOLibURL = "dart:io"; | 17 const char* DartUtils::kIOLibURL = "dart:io"; |
17 const char* DartUtils::kJsonLibURL = "dart:json"; | 18 const char* DartUtils::kJsonLibURL = "dart:json"; |
18 const char* DartUtils::kUriLibURL = "dart:uri"; | 19 const char* DartUtils::kUriLibURL = "dart:uri"; |
19 const char* DartUtils::kUtf8LibURL = "dart:utf8"; | 20 const char* DartUtils::kUtf8LibURL = "dart:utf8"; |
20 | 21 |
21 | 22 |
22 const char* DartUtils::kIdFieldName = "_id"; | 23 const char* DartUtils::kIdFieldName = "_id"; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 | 98 |
98 | 99 |
99 bool DartUtils::IsDartSchemeURL(const char* url_name) { | 100 bool DartUtils::IsDartSchemeURL(const char* url_name) { |
100 static const intptr_t kDartSchemeLen = strlen(kDartScheme); | 101 static const intptr_t kDartSchemeLen = strlen(kDartScheme); |
101 // If the URL starts with "dart:" then it is considered as a special | 102 // If the URL starts with "dart:" then it is considered as a special |
102 // library URL which is handled differently from other URLs. | 103 // library URL which is handled differently from other URLs. |
103 return (strncmp(url_name, kDartScheme, kDartSchemeLen) == 0); | 104 return (strncmp(url_name, kDartScheme, kDartSchemeLen) == 0); |
104 } | 105 } |
105 | 106 |
106 | 107 |
| 108 bool DartUtils::IsDartExtensionSchemeURL(const char* url_name) { |
| 109 static const intptr_t kDartExtensionSchemeLen = strlen(kDartExtensionScheme); |
| 110 // If the URL starts with "dartext:" then it is considered as a special |
| 111 // extension library URL which is handled differently from other URLs. |
| 112 return |
| 113 (strncmp(url_name, kDartExtensionScheme, kDartExtensionSchemeLen) == 0); |
| 114 } |
| 115 |
| 116 |
107 bool DartUtils::IsDartIOLibURL(const char* url_name) { | 117 bool DartUtils::IsDartIOLibURL(const char* url_name) { |
108 return (strcmp(url_name, kIOLibURL) == 0); | 118 return (strcmp(url_name, kIOLibURL) == 0); |
109 } | 119 } |
110 | 120 |
111 | 121 |
112 bool DartUtils::IsDartJsonLibURL(const char* url_name) { | 122 bool DartUtils::IsDartJsonLibURL(const char* url_name) { |
113 return (strcmp(url_name, kJsonLibURL) == 0); | 123 return (strcmp(url_name, kJsonLibURL) == 0); |
114 } | 124 } |
115 | 125 |
116 | 126 |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 return cobject; | 371 return cobject; |
362 } | 372 } |
363 | 373 |
364 | 374 |
365 Dart_CObject* CObject::NewByteArray(int length) { | 375 Dart_CObject* CObject::NewByteArray(int length) { |
366 Dart_CObject* cobject = New(Dart_CObject::kByteArray, length); | 376 Dart_CObject* cobject = New(Dart_CObject::kByteArray, length); |
367 cobject->value.as_byte_array.length = length; | 377 cobject->value.as_byte_array.length = length; |
368 cobject->value.as_byte_array.values = reinterpret_cast<uint8_t*>(cobject + 1); | 378 cobject->value.as_byte_array.values = reinterpret_cast<uint8_t*>(cobject + 1); |
369 return cobject; | 379 return cobject; |
370 } | 380 } |
OLD | NEW |