| 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 1842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1853 } | 1853 } |
| 1854 | 1854 |
| 1855 | 1855 |
| 1856 static uint8_t* allocator(uint8_t* ptr, intptr_t old_size, intptr_t new_size) { | 1856 static uint8_t* allocator(uint8_t* ptr, intptr_t old_size, intptr_t new_size) { |
| 1857 void* new_ptr = realloc(reinterpret_cast<void*>(ptr), new_size); | 1857 void* new_ptr = realloc(reinterpret_cast<void*>(ptr), new_size); |
| 1858 return reinterpret_cast<uint8_t*>(new_ptr); | 1858 return reinterpret_cast<uint8_t*>(new_ptr); |
| 1859 } | 1859 } |
| 1860 | 1860 |
| 1861 | 1861 |
| 1862 DART_EXPORT bool Dart_PostIntArray(Dart_Port port, | 1862 DART_EXPORT bool Dart_PostIntArray(Dart_Port port, |
| 1863 int field_count, | 1863 intptr_t len, |
| 1864 intptr_t* data) { | 1864 intptr_t* data) { |
| 1865 uint8_t* buffer = NULL; | 1865 uint8_t* buffer = NULL; |
| 1866 MessageWriter writer(&buffer, &allocator); | 1866 MessageWriter writer(&buffer, &allocator); |
| 1867 | 1867 |
| 1868 writer.WriteMessage(field_count, data); | 1868 writer.WriteMessage(len, data); |
| 1869 | 1869 |
| 1870 // Post the message at the given port. | 1870 // Post the message at the given port. |
| 1871 return PortMap::PostMessage(port, kNoReplyPort, buffer); | 1871 return PortMap::PostMessage(port, kNoReplyPort, buffer); |
| 1872 } | 1872 } |
| 1873 | 1873 |
| 1874 | 1874 |
| 1875 DART_EXPORT bool Dart_Post(Dart_Port port, Dart_Handle handle) { | 1875 DART_EXPORT bool Dart_Post(Dart_Port port, Dart_Handle handle) { |
| 1876 Zone zone; // Setup a VM zone as we are creating some handles. | 1876 Zone zone; // Setup a VM zone as we are creating some handles. |
| 1877 HandleScope scope; // Setup a VM handle scope. | 1877 HandleScope scope; // Setup a VM handle scope. |
| 1878 const Object& object = Object::Handle(Api::UnwrapHandle(handle)); | 1878 const Object& object = Object::Handle(Api::UnwrapHandle(handle)); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1999 ASSERT(isolate != NULL); | 1999 ASSERT(isolate != NULL); |
| 2000 ApiState* state = isolate->api_state(); | 2000 ApiState* state = isolate->api_state(); |
| 2001 ASSERT(state != NULL); | 2001 ASSERT(state != NULL); |
| 2002 ApiLocalScope* scope = state->top_scope(); | 2002 ApiLocalScope* scope = state->top_scope(); |
| 2003 ASSERT(scope != NULL); | 2003 ASSERT(scope != NULL); |
| 2004 return scope->zone().Reallocate(ptr, old_size, new_size); | 2004 return scope->zone().Reallocate(ptr, old_size, new_size); |
| 2005 } | 2005 } |
| 2006 | 2006 |
| 2007 | 2007 |
| 2008 } // namespace dart | 2008 } // namespace dart |
| OLD | NEW |