Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(202)

Unified Diff: runtime/vm/dart_api_state.h

Issue 15772005: - Add different types for persistent and weak persistent handles (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/dart_api_impl_test.cc ('k') | runtime/vm/debugger_api_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart_api_state.h
===================================================================
--- runtime/vm/dart_api_state.h (revision 23307)
+++ runtime/vm/dart_api_state.h (working copy)
@@ -187,7 +187,7 @@
if (callback != NULL) {
void* peer = handle->peer();
handle->Clear();
- (*callback)(reinterpret_cast<Dart_Handle>(handle), peer);
+ (*callback)(reinterpret_cast<Dart_WeakPersistentHandle>(handle), peer);
} else {
handle->Clear();
}
@@ -351,7 +351,7 @@
}
// Validate if passed in handle is a Persistent Handle.
- bool IsValidHandle(Dart_Handle object) const {
+ bool IsValidHandle(Dart_PersistentHandle object) const {
return IsValidScopedHandle(reinterpret_cast<uword>(object));
}
@@ -425,7 +425,7 @@
}
// Validate if passed in handle is a Persistent Handle.
- bool IsValidHandle(Dart_Handle object) const {
+ bool IsValidHandle(Dart_WeakPersistentHandle object) const {
return IsValidScopedHandle(reinterpret_cast<uword>(object));
}
@@ -456,14 +456,16 @@
RawObject** get_key(intptr_t i) {
ASSERT(i >= 0);
ASSERT(i < num_keys_);
- return (reinterpret_cast<PersistentHandle*>(keys_[i]))->raw_addr();
+ return (reinterpret_cast<FinalizablePersistentHandle*>(keys_[i]))->
+ raw_addr();
}
intptr_t num_values() const { return num_values_; }
RawObject** get_value(intptr_t i) {
ASSERT(i >= 0);
ASSERT(i < num_values_);
- return (reinterpret_cast<PersistentHandle*>(values_[i]))->raw_addr();
+ return (reinterpret_cast<FinalizablePersistentHandle*>(values_[i]))->
+ raw_addr();
}
static WeakReferenceSet* Pop(WeakReferenceSet** queue) {
@@ -617,15 +619,16 @@
return false;
}
- bool IsValidPersistentHandle(Dart_Handle object) const {
+ bool IsValidPersistentHandle(Dart_PersistentHandle object) const {
return persistent_handles_.IsValidHandle(object);
}
- bool IsValidWeakPersistentHandle(Dart_Handle object) const {
+ bool IsValidWeakPersistentHandle(Dart_WeakPersistentHandle object) const {
return weak_persistent_handles_.IsValidHandle(object);
}
- bool IsValidPrologueWeakPersistentHandle(Dart_Handle object) const {
+ bool IsValidPrologueWeakPersistentHandle(
+ Dart_WeakPersistentHandle object) const {
return prologue_weak_persistent_handles_.IsValidHandle(object);
}
@@ -655,27 +658,6 @@
}
return total;
}
- PersistentHandle* Null() {
- if (null_ == NULL) {
- null_ = persistent_handles().AllocateHandle();
- null_->set_raw(Object::null());
- }
- return null_;
- }
- PersistentHandle* True() {
- if (true_ == NULL) {
- true_ = persistent_handles().AllocateHandle();
- true_->set_raw(Bool::True());
- }
- return true_;
- }
- PersistentHandle* False() {
- if (false_ == NULL) {
- false_ = persistent_handles().AllocateHandle();
- false_->set_raw(Bool::False());
- }
- return false_;
- }
void SetupAcquiredError() {
ASSERT(acquired_error_ == NULL);
« no previous file with comments | « runtime/vm/dart_api_impl_test.cc ('k') | runtime/vm/debugger_api_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698