| 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 1599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1610 RETURN_TYPE_ERROR(Isolate::Current(), object, String); | 1610 RETURN_TYPE_ERROR(Isolate::Current(), object, String); |
| 1611 } else { | 1611 } else { |
| 1612 return | 1612 return |
| 1613 Api::NewError( | 1613 Api::NewError( |
| 1614 "%s expects argument 'object' to be an external String.", | 1614 "%s expects argument 'object' to be an external String.", |
| 1615 CURRENT_FUNC); | 1615 CURRENT_FUNC); |
| 1616 } | 1616 } |
| 1617 } | 1617 } |
| 1618 | 1618 |
| 1619 | 1619 |
| 1620 DART_EXPORT Dart_Handle Dart_NewExternalUTF8String(const uint8_t* utf8_array, | 1620 DART_EXPORT Dart_Handle Dart_NewExternalLatin1String( |
| 1621 intptr_t length, | 1621 const uint8_t* latin1_array, |
| 1622 void* peer, | 1622 intptr_t length, |
| 1623 Dart_PeerFinalizer cback) { | 1623 void* peer, |
| 1624 Dart_PeerFinalizer cback) { |
| 1624 Isolate* isolate = Isolate::Current(); | 1625 Isolate* isolate = Isolate::Current(); |
| 1625 DARTSCOPE(isolate); | 1626 DARTSCOPE(isolate); |
| 1626 if (utf8_array == NULL && length != 0) { | 1627 if (latin1_array == NULL && length != 0) { |
| 1627 RETURN_NULL_ERROR(utf8_array); | 1628 RETURN_NULL_ERROR(latin1_array); |
| 1628 } | 1629 } |
| 1629 CHECK_LENGTH(length, String::kMaxElements); | 1630 CHECK_LENGTH(length, String::kMaxElements); |
| 1630 return Api::NewHandle(isolate, | 1631 return Api::NewHandle(isolate, |
| 1631 String::NewExternal(utf8_array, length, peer, cback)); | 1632 String::NewExternal(latin1_array, length, peer, cback)); |
| 1632 } | 1633 } |
| 1633 | 1634 |
| 1634 | 1635 |
| 1635 DART_EXPORT Dart_Handle Dart_NewExternalUTF16String(const uint16_t* utf16_array, | 1636 DART_EXPORT Dart_Handle Dart_NewExternalUTF16String(const uint16_t* utf16_array, |
| 1636 intptr_t length, | 1637 intptr_t length, |
| 1637 void* peer, | 1638 void* peer, |
| 1638 Dart_PeerFinalizer cback) { | 1639 Dart_PeerFinalizer cback) { |
| 1639 Isolate* isolate = Isolate::Current(); | 1640 Isolate* isolate = Isolate::Current(); |
| 1640 DARTSCOPE(isolate); | 1641 DARTSCOPE(isolate); |
| 1641 if (utf16_array == NULL && length != 0) { | 1642 if (utf16_array == NULL && length != 0) { |
| (...skipping 2809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4451 } | 4452 } |
| 4452 { | 4453 { |
| 4453 NoGCScope no_gc; | 4454 NoGCScope no_gc; |
| 4454 RawObject* raw_obj = obj.raw(); | 4455 RawObject* raw_obj = obj.raw(); |
| 4455 isolate->heap()->SetPeer(raw_obj, peer); | 4456 isolate->heap()->SetPeer(raw_obj, peer); |
| 4456 } | 4457 } |
| 4457 return Api::Success(isolate); | 4458 return Api::Success(isolate); |
| 4458 } | 4459 } |
| 4459 | 4460 |
| 4460 } // namespace dart | 4461 } // namespace dart |
| OLD | NEW |