| 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 "include/dart_api.h" | 5 #include "include/dart_api.h" |
| 6 | 6 |
| 7 #include "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.h" |
| 8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
| 9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/dart.h" | 10 #include "vm/dart.h" |
| (...skipping 1556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1567 | 1567 |
| 1568 | 1568 |
| 1569 DART_EXPORT Dart_Handle Dart_NewStringFromUTF16(const uint16_t* utf16_array, | 1569 DART_EXPORT Dart_Handle Dart_NewStringFromUTF16(const uint16_t* utf16_array, |
| 1570 intptr_t length) { | 1570 intptr_t length) { |
| 1571 Isolate* isolate = Isolate::Current(); | 1571 Isolate* isolate = Isolate::Current(); |
| 1572 DARTSCOPE(isolate); | 1572 DARTSCOPE(isolate); |
| 1573 if (utf16_array == NULL && length != 0) { | 1573 if (utf16_array == NULL && length != 0) { |
| 1574 RETURN_NULL_ERROR(utf16_array); | 1574 RETURN_NULL_ERROR(utf16_array); |
| 1575 } | 1575 } |
| 1576 CHECK_LENGTH(length, String::kMaxElements); | 1576 CHECK_LENGTH(length, String::kMaxElements); |
| 1577 return Api::NewHandle(isolate, String::New(utf16_array, length)); | 1577 return Api::NewHandle(isolate, String::FromUTF16(utf16_array, length)); |
| 1578 } | 1578 } |
| 1579 | 1579 |
| 1580 | 1580 |
| 1581 DART_EXPORT Dart_Handle Dart_NewStringFromUTF32(const int32_t* utf32_array, | 1581 DART_EXPORT Dart_Handle Dart_NewStringFromUTF32(const int32_t* utf32_array, |
| 1582 intptr_t length) { | 1582 intptr_t length) { |
| 1583 Isolate* isolate = Isolate::Current(); | 1583 Isolate* isolate = Isolate::Current(); |
| 1584 DARTSCOPE(isolate); | 1584 DARTSCOPE(isolate); |
| 1585 if (utf32_array == NULL && length != 0) { | 1585 if (utf32_array == NULL && length != 0) { |
| 1586 RETURN_NULL_ERROR(utf32_array); | 1586 RETURN_NULL_ERROR(utf32_array); |
| 1587 } | 1587 } |
| 1588 CHECK_LENGTH(length, String::kMaxElements); | 1588 CHECK_LENGTH(length, String::kMaxElements); |
| 1589 return Api::NewHandle(isolate, String::New(utf32_array, length)); | 1589 return Api::NewHandle(isolate, String::FromUTF32(utf32_array, length)); |
| 1590 } | 1590 } |
| 1591 | 1591 |
| 1592 | 1592 |
| 1593 DART_EXPORT bool Dart_IsExternalString(Dart_Handle object) { | 1593 DART_EXPORT bool Dart_IsExternalString(Dart_Handle object) { |
| 1594 return RawObject::IsExternalStringClassId(Api::ClassId(object)); | 1594 return RawObject::IsExternalStringClassId(Api::ClassId(object)); |
| 1595 } | 1595 } |
| 1596 | 1596 |
| 1597 | 1597 |
| 1598 DART_EXPORT Dart_Handle Dart_ExternalStringGetPeer(Dart_Handle object, | 1598 DART_EXPORT Dart_Handle Dart_ExternalStringGetPeer(Dart_Handle object, |
| 1599 void** peer) { | 1599 void** peer) { |
| (...skipping 2853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4453 } | 4453 } |
| 4454 { | 4454 { |
| 4455 NoGCScope no_gc; | 4455 NoGCScope no_gc; |
| 4456 RawObject* raw_obj = obj.raw(); | 4456 RawObject* raw_obj = obj.raw(); |
| 4457 isolate->heap()->SetPeer(raw_obj, peer); | 4457 isolate->heap()->SetPeer(raw_obj, peer); |
| 4458 } | 4458 } |
| 4459 return Api::Success(isolate); | 4459 return Api::Success(isolate); |
| 4460 } | 4460 } |
| 4461 | 4461 |
| 4462 } // namespace dart | 4462 } // namespace dart |
| OLD | NEW |