| 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/utils.h" | 10 #include "platform/utils.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 // Implementation of local handles which are handed out from every | 122 // Implementation of local handles which are handed out from every |
| 123 // dart API call, these handles are valid only in the present scope | 123 // dart API call, these handles are valid only in the present scope |
| 124 // and are destroyed when a Dart_ExitScope() is called. | 124 // and are destroyed when a Dart_ExitScope() is called. |
| 125 class LocalHandle { | 125 class LocalHandle { |
| 126 public: | 126 public: |
| 127 // Accessors. | 127 // Accessors. |
| 128 RawObject* raw() const { return raw_; } | 128 RawObject* raw() const { return raw_; } |
| 129 void set_raw(RawObject* raw) { raw_ = raw; } | 129 void set_raw(RawObject* raw) { raw_ = raw; } |
| 130 static intptr_t raw_offset() { return OFFSET_OF(LocalHandle, raw_); } | 130 static intptr_t raw_offset() { return OFFSET_OF(LocalHandle, raw_); } |
| 131 | 131 |
| 132 Dart_Handle apiHandle() { |
| 133 return reinterpret_cast<Dart_Handle>(this); |
| 134 } |
| 135 |
| 132 private: | 136 private: |
| 133 LocalHandle() { } | 137 LocalHandle() { } |
| 134 ~LocalHandle() { } | 138 ~LocalHandle() { } |
| 135 | 139 |
| 136 RawObject* raw_; | 140 RawObject* raw_; |
| 137 DISALLOW_ALLOCATION(); // Allocated through AllocateHandle methods. | 141 DISALLOW_ALLOCATION(); // Allocated through AllocateHandle methods. |
| 138 DISALLOW_COPY_AND_ASSIGN(LocalHandle); | 142 DISALLOW_COPY_AND_ASSIGN(LocalHandle); |
| 139 }; | 143 }; |
| 140 | 144 |
| 141 | 145 |
| (...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 976 ref->set_peer(peer); | 980 ref->set_peer(peer); |
| 977 ref->set_callback(callback); | 981 ref->set_callback(callback); |
| 978 // This may trigger GC, so it must be called last. | 982 // This may trigger GC, so it must be called last. |
| 979 ref->SetExternalSize(external_size, isolate); | 983 ref->SetExternalSize(external_size, isolate); |
| 980 return ref; | 984 return ref; |
| 981 } | 985 } |
| 982 | 986 |
| 983 } // namespace dart | 987 } // namespace dart |
| 984 | 988 |
| 985 #endif // VM_DART_API_STATE_H_ | 989 #endif // VM_DART_API_STATE_H_ |
| OLD | NEW |