| 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 VM_DART_API_STATE_H_ | 5 #ifndef VM_DART_API_STATE_H_ |
| 6 #define VM_DART_API_STATE_H_ | 6 #define VM_DART_API_STATE_H_ |
| 7 | 7 |
| 8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
| 9 | 9 |
| 10 #include "platform/thread.h" | 10 #include "platform/thread.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 // It is preferred to use Alloc<T>() instead, as that function can | 55 // It is preferred to use Alloc<T>() instead, as that function can |
| 56 // check for integer overflow. If you use AllocUnsafe, you are | 56 // check for integer overflow. If you use AllocUnsafe, you are |
| 57 // responsible for avoiding integer overflow yourself. | 57 // responsible for avoiding integer overflow yourself. |
| 58 uword AllocUnsafe(intptr_t size) { return zone_.AllocUnsafe(size); } | 58 uword AllocUnsafe(intptr_t size) { return zone_.AllocUnsafe(size); } |
| 59 | 59 |
| 60 // Compute the total size of this zone. This includes wasted space that is | 60 // Compute the total size of this zone. This includes wasted space that is |
| 61 // due to internal fragmentation in the segments. | 61 // due to internal fragmentation in the segments. |
| 62 intptr_t SizeInBytes() const { return zone_.SizeInBytes(); } | 62 intptr_t SizeInBytes() const { return zone_.SizeInBytes(); } |
| 63 | 63 |
| 64 private: | 64 private: |
| 65 BaseZone* GetBaseZone() { return &zone_; } | 65 Zone* GetBaseZone() { return &zone_; } |
| 66 | 66 |
| 67 BaseZone zone_; | 67 Zone zone_; |
| 68 | 68 |
| 69 template<typename T> friend class ApiGrowableArray; | 69 template<typename T> friend class ApiGrowableArray; |
| 70 DISALLOW_COPY_AND_ASSIGN(ApiZone); | 70 DISALLOW_COPY_AND_ASSIGN(ApiZone); |
| 71 }; | 71 }; |
| 72 | 72 |
| 73 | 73 |
| 74 // Implementation of local handles which are handed out from every | 74 // Implementation of local handles which are handed out from every |
| 75 // dart API call, these handles are valid only in the present scope | 75 // dart API call, these handles are valid only in the present scope |
| 76 // and are destroyed when a Dart_ExitScope() is called. | 76 // and are destroyed when a Dart_ExitScope() is called. |
| 77 class LocalHandle { | 77 class LocalHandle { |
| (...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 674 ApiNativeScope::Current()->zone()->GetBaseZone()) {} | 674 ApiNativeScope::Current()->zone()->GetBaseZone()) {} |
| 675 ApiGrowableArray() | 675 ApiGrowableArray() |
| 676 : BaseGrowableArray<T, ValueObject>( | 676 : BaseGrowableArray<T, ValueObject>( |
| 677 ApiNativeScope::Current()->zone()->GetBaseZone()) {} | 677 ApiNativeScope::Current()->zone()->GetBaseZone()) {} |
| 678 }; | 678 }; |
| 679 | 679 |
| 680 | 680 |
| 681 } // namespace dart | 681 } // namespace dart |
| 682 | 682 |
| 683 #endif // VM_DART_API_STATE_H_ | 683 #endif // VM_DART_API_STATE_H_ |
| OLD | NEW |