| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 1616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1627 } | 1627 } |
| 1628 | 1628 |
| 1629 | 1629 |
| 1630 static uint8_t* allocator(uint8_t* ptr, intptr_t old_size, intptr_t new_size) { | 1630 static uint8_t* allocator(uint8_t* ptr, intptr_t old_size, intptr_t new_size) { |
| 1631 void* new_ptr = realloc(reinterpret_cast<void*>(ptr), new_size); | 1631 void* new_ptr = realloc(reinterpret_cast<void*>(ptr), new_size); |
| 1632 return reinterpret_cast<uint8_t*>(new_ptr); | 1632 return reinterpret_cast<uint8_t*>(new_ptr); |
| 1633 } | 1633 } |
| 1634 | 1634 |
| 1635 | 1635 |
| 1636 DART_EXPORT bool Dart_PostIntArray(Dart_Port port, | 1636 DART_EXPORT bool Dart_PostIntArray(Dart_Port port, |
| 1637 int field_count, | 1637 intptr_t len, |
| 1638 intptr_t* data) { | 1638 intptr_t* data) { |
| 1639 uint8_t* buffer = NULL; | 1639 uint8_t* buffer = NULL; |
| 1640 MessageWriter writer(&buffer, &allocator); | 1640 MessageWriter writer(&buffer, &allocator); |
| 1641 | 1641 |
| 1642 writer.WriteMessage(field_count, data); | 1642 writer.WriteMessage(len, data); |
| 1643 | 1643 |
| 1644 // Post the message at the given port. | 1644 // Post the message at the given port. |
| 1645 return PortMap::PostMessage(port, kNoReplyPort, buffer); | 1645 return PortMap::PostMessage(port, kNoReplyPort, buffer); |
| 1646 } | 1646 } |
| 1647 | 1647 |
| 1648 | 1648 |
| 1649 DART_EXPORT bool Dart_Post(Dart_Port port, Dart_Handle handle) { | 1649 DART_EXPORT bool Dart_Post(Dart_Port port, Dart_Handle handle) { |
| 1650 Zone zone; // Setup a VM zone as we are creating some handles. | 1650 Zone zone; // Setup a VM zone as we are creating some handles. |
| 1651 HandleScope scope; // Setup a VM handle scope. | 1651 HandleScope scope; // Setup a VM handle scope. |
| 1652 const Object& object = Object::Handle(Api::UnwrapHandle(handle)); | 1652 const Object& object = Object::Handle(Api::UnwrapHandle(handle)); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1773 ASSERT(isolate != NULL); | 1773 ASSERT(isolate != NULL); |
| 1774 ApiState* state = isolate->api_state(); | 1774 ApiState* state = isolate->api_state(); |
| 1775 ASSERT(state != NULL); | 1775 ASSERT(state != NULL); |
| 1776 ApiLocalScope* scope = state->top_scope(); | 1776 ApiLocalScope* scope = state->top_scope(); |
| 1777 ASSERT(scope != NULL); | 1777 ASSERT(scope != NULL); |
| 1778 return scope->zone().Reallocate(ptr, old_size, new_size); | 1778 return scope->zone().Reallocate(ptr, old_size, new_size); |
| 1779 } | 1779 } |
| 1780 | 1780 |
| 1781 | 1781 |
| 1782 } // namespace dart | 1782 } // namespace dart |
| OLD | NEW |