Chromium Code Reviews| 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 1544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1555 Isolate* isolate = Isolate::Current(); | 1555 Isolate* isolate = Isolate::Current(); |
| 1556 DARTSCOPE(isolate); | 1556 DARTSCOPE(isolate); |
| 1557 if (utf8_array == NULL && length != 0) { | 1557 if (utf8_array == NULL && length != 0) { |
| 1558 RETURN_NULL_ERROR(utf8_array); | 1558 RETURN_NULL_ERROR(utf8_array); |
| 1559 } | 1559 } |
| 1560 CHECK_LENGTH(length, String::kMaxElements); | 1560 CHECK_LENGTH(length, String::kMaxElements); |
| 1561 if (!Utf8::IsValid(utf8_array, length)) { | 1561 if (!Utf8::IsValid(utf8_array, length)) { |
| 1562 return Api::NewError("%s expects argument 'str' to be valid UTF-8.", | 1562 return Api::NewError("%s expects argument 'str' to be valid UTF-8.", |
| 1563 CURRENT_FUNC); | 1563 CURRENT_FUNC); |
| 1564 } | 1564 } |
| 1565 return Api::NewHandle(isolate, String::New(utf8_array, length)); | 1565 return Api::NewHandle(isolate, String::NewFromUTF8(utf8_array, length)); |
|
cshapiro
2012/12/04 00:41:07
This should cause a compile time error as NewFromU
siva
2012/12/04 00:55:57
Done.
| |
| 1566 } | 1566 } |
| 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 } |
| (...skipping 2877 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 |