| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 #include "include/dart_mirrors_api.h" | 6 #include "include/dart_mirrors_api.h" |
| 7 #include "include/dart_native_api.h" | 7 #include "include/dart_native_api.h" |
| 8 | 8 |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 #include "vm/bigint_operations.h" | 10 #include "vm/bigint_operations.h" |
| (...skipping 3607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3618 Isolate* isolate = Isolate::Current(); | 3618 Isolate* isolate = Isolate::Current(); |
| 3619 DARTSCOPE(isolate); | 3619 DARTSCOPE(isolate); |
| 3620 const String& cls_name = Api::UnwrapStringHandle(isolate, name); | 3620 const String& cls_name = Api::UnwrapStringHandle(isolate, name); |
| 3621 if (cls_name.IsNull()) { | 3621 if (cls_name.IsNull()) { |
| 3622 RETURN_TYPE_ERROR(isolate, name, String); | 3622 RETURN_TYPE_ERROR(isolate, name, String); |
| 3623 } | 3623 } |
| 3624 const Library& lib = Api::UnwrapLibraryHandle(isolate, library); | 3624 const Library& lib = Api::UnwrapLibraryHandle(isolate, library); |
| 3625 if (lib.IsNull()) { | 3625 if (lib.IsNull()) { |
| 3626 RETURN_TYPE_ERROR(isolate, library, Library); | 3626 RETURN_TYPE_ERROR(isolate, library, Library); |
| 3627 } | 3627 } |
| 3628 if (field_count <= 0) { | 3628 if (!Utils::IsUint(16, field_count)) { |
| 3629 return Api::NewError( | 3629 return Api::NewError( |
| 3630 "Negative field_count passed to Dart_CreateNativeWrapperClass"); | 3630 "Invalid field_count passed to Dart_CreateNativeWrapperClass"); |
| 3631 } | 3631 } |
| 3632 CHECK_CALLBACK_STATE(isolate); | 3632 CHECK_CALLBACK_STATE(isolate); |
| 3633 | 3633 |
| 3634 String& cls_symbol = String::Handle(isolate, Symbols::New(cls_name)); | 3634 String& cls_symbol = String::Handle(isolate, Symbols::New(cls_name)); |
| 3635 const Class& cls = Class::Handle( | 3635 const Class& cls = Class::Handle( |
| 3636 isolate, Class::NewNativeWrapper(lib, cls_symbol, field_count)); | 3636 isolate, Class::NewNativeWrapper(lib, cls_symbol, field_count)); |
| 3637 if (cls.IsNull()) { | 3637 if (cls.IsNull()) { |
| 3638 return Api::NewError( | 3638 return Api::NewError( |
| 3639 "Unable to create native wrapper class : already exists"); | 3639 "Unable to create native wrapper class : already exists"); |
| 3640 } | 3640 } |
| (...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4436 } | 4436 } |
| 4437 { | 4437 { |
| 4438 NoGCScope no_gc; | 4438 NoGCScope no_gc; |
| 4439 RawObject* raw_obj = obj.raw(); | 4439 RawObject* raw_obj = obj.raw(); |
| 4440 isolate->heap()->SetPeer(raw_obj, peer); | 4440 isolate->heap()->SetPeer(raw_obj, peer); |
| 4441 } | 4441 } |
| 4442 return Api::Success(); | 4442 return Api::Success(); |
| 4443 } | 4443 } |
| 4444 | 4444 |
| 4445 } // namespace dart | 4445 } // namespace dart |
| OLD | NEW |