| 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 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 RawObject* raw_obj = arguments->NativeArg0(); | 501 RawObject* raw_obj = arguments->NativeArg0(); |
| 502 if (raw_obj->IsHeapObject()) { | 502 if (raw_obj->IsHeapObject()) { |
| 503 intptr_t cid = raw_obj->GetClassId(); | 503 intptr_t cid = raw_obj->GetClassId(); |
| 504 if (cid > kNumPredefinedCids) { | 504 if (cid > kNumPredefinedCids) { |
| 505 ASSERT(Instance::Cast(Object::Handle(raw_obj)).IsValidNativeIndex(0)); | 505 ASSERT(Instance::Cast(Object::Handle(raw_obj)).IsValidNativeIndex(0)); |
| 506 RawTypedData* native_fields = *reinterpret_cast<RawTypedData**>( | 506 RawTypedData* native_fields = *reinterpret_cast<RawTypedData**>( |
| 507 RawObject::ToAddr(raw_obj) + sizeof(RawObject)); | 507 RawObject::ToAddr(raw_obj) + sizeof(RawObject)); |
| 508 if (native_fields == TypedData::null()) { | 508 if (native_fields == TypedData::null()) { |
| 509 *value = 0; | 509 *value = 0; |
| 510 } else { | 510 } else { |
| 511 *value = *bit_cast<intptr_t*, uint8_t*>(native_fields->ptr()->data_); | 511 *value = *bit_cast<intptr_t*, uint8_t*>(native_fields->ptr()->data()); |
| 512 } | 512 } |
| 513 return true; | 513 return true; |
| 514 } | 514 } |
| 515 } | 515 } |
| 516 return false; | 516 return false; |
| 517 } | 517 } |
| 518 | 518 |
| 519 | 519 |
| 520 bool Api::GetNativeBooleanArgument(NativeArguments* arguments, | 520 bool Api::GetNativeBooleanArgument(NativeArguments* arguments, |
| 521 int arg_index, | 521 int arg_index, |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 RawObject* raw_obj = arguments->NativeArgAt(arg_index); | 586 RawObject* raw_obj = arguments->NativeArgAt(arg_index); |
| 587 if (raw_obj->IsHeapObject()) { | 587 if (raw_obj->IsHeapObject()) { |
| 588 intptr_t cid = raw_obj->GetClassId(); | 588 intptr_t cid = raw_obj->GetClassId(); |
| 589 if (cid > kNumPredefinedCids) { | 589 if (cid > kNumPredefinedCids) { |
| 590 RawTypedData* native_fields = *reinterpret_cast<RawTypedData**>( | 590 RawTypedData* native_fields = *reinterpret_cast<RawTypedData**>( |
| 591 RawObject::ToAddr(raw_obj) + sizeof(RawObject)); | 591 RawObject::ToAddr(raw_obj) + sizeof(RawObject)); |
| 592 if (native_fields == TypedData::null()) { | 592 if (native_fields == TypedData::null()) { |
| 593 memset(field_values, 0, (num_fields * sizeof(field_values[0]))); | 593 memset(field_values, 0, (num_fields * sizeof(field_values[0]))); |
| 594 } else if (num_fields == Smi::Value(native_fields->ptr()->length_)) { | 594 } else if (num_fields == Smi::Value(native_fields->ptr()->length_)) { |
| 595 intptr_t* native_values = | 595 intptr_t* native_values = |
| 596 bit_cast<intptr_t*, uint8_t*>(native_fields->ptr()->data_); | 596 bit_cast<intptr_t*, uint8_t*>(native_fields->ptr()->data()); |
| 597 memmove(field_values, | 597 memmove(field_values, |
| 598 native_values, | 598 native_values, |
| 599 (num_fields * sizeof(field_values[0]))); | 599 (num_fields * sizeof(field_values[0]))); |
| 600 } | 600 } |
| 601 return true; | 601 return true; |
| 602 } | 602 } |
| 603 } | 603 } |
| 604 return false; | 604 return false; |
| 605 } | 605 } |
| 606 | 606 |
| (...skipping 4612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5219 | 5219 |
| 5220 | 5220 |
| 5221 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( | 5221 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( |
| 5222 const char* name, | 5222 const char* name, |
| 5223 Dart_ServiceRequestCallback callback, | 5223 Dart_ServiceRequestCallback callback, |
| 5224 void* user_data) { | 5224 void* user_data) { |
| 5225 Service::RegisterRootEmbedderCallback(name, callback, user_data); | 5225 Service::RegisterRootEmbedderCallback(name, callback, user_data); |
| 5226 } | 5226 } |
| 5227 | 5227 |
| 5228 } // namespace dart | 5228 } // namespace dart |
| OLD | NEW |