| 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 #ifndef BIN_IO_BUFFER_H_ | 5 #ifndef BIN_IO_BUFFER_H_ | 
| 6 #define BIN_IO_BUFFER_H_ | 6 #define BIN_IO_BUFFER_H_ | 
| 7 | 7 | 
| 8 #include "platform/globals.h" | 8 #include "platform/globals.h" | 
| 9 | 9 | 
| 10 #include "include/dart_api.h" | 10 #include "include/dart_api.h" | 
| (...skipping 11 matching lines...) Expand all  Loading... | 
| 22   // Allocate IO buffer storage. | 22   // Allocate IO buffer storage. | 
| 23   static uint8_t* Allocate(intptr_t size); | 23   static uint8_t* Allocate(intptr_t size); | 
| 24 | 24 | 
| 25   // Function for disposing of IO buffer storage. All backing storage | 25   // Function for disposing of IO buffer storage. All backing storage | 
| 26   // for IO buffers must be freed using this function. | 26   // for IO buffers must be freed using this function. | 
| 27   static void Free(void* buffer) { | 27   static void Free(void* buffer) { | 
| 28     delete[] reinterpret_cast<uint8_t*>(buffer); | 28     delete[] reinterpret_cast<uint8_t*>(buffer); | 
| 29   } | 29   } | 
| 30 | 30 | 
| 31   // Function for finalizing external byte arrays used as IO buffers. | 31   // Function for finalizing external byte arrays used as IO buffers. | 
| 32   static void Finalizer(Dart_Handle handle, void* buffer) { | 32   static void Finalizer(Dart_WeakPersistentHandle handle, void* buffer) { | 
| 33     Free(buffer); | 33     Free(buffer); | 
| 34     if (handle != NULL) { | 34     if (handle != NULL) { | 
| 35       Dart_DeletePersistentHandle(handle); | 35       Dart_DeleteWeakPersistentHandle(handle); | 
| 36     } | 36     } | 
| 37   } | 37   } | 
| 38 | 38 | 
| 39  private: | 39  private: | 
| 40   DISALLOW_ALLOCATION(); | 40   DISALLOW_ALLOCATION(); | 
| 41   DISALLOW_IMPLICIT_CONSTRUCTORS(IOBuffer); | 41   DISALLOW_IMPLICIT_CONSTRUCTORS(IOBuffer); | 
| 42 }; | 42 }; | 
| 43 | 43 | 
| 44 }  // namespace bin | 44 }  // namespace bin | 
| 45 }  // namespace dart | 45 }  // namespace dart | 
| 46 | 46 | 
| 47 #endif  // BIN_IO_BUFFER_H_ | 47 #endif  // BIN_IO_BUFFER_H_ | 
| OLD | NEW | 
|---|