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

Unified Diff: runtime/vm/dart_api_state.h

Issue 1473403003: Move ApiLocalScope out of class ApiState into class Thread so that the API local handles and zone e… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: code-review-patch Created 5 years, 1 month 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
diff --git a/runtime/vm/dart_api_state.h b/runtime/vm/dart_api_state.h
index c208065d722a12204a59c8c07cfef687c7a378b0..e0f6e00ef16fb6b3e1c12ceef6817d7ed9b7c523 100644
--- a/runtime/vm/dart_api_state.h
+++ b/runtime/vm/dart_api_state.h
@@ -668,18 +668,11 @@ class ApiState {
public:
ApiState() : persistent_handles_(),
weak_persistent_handles_(),
- reusable_scope_(NULL),
- top_scope_(NULL),
null_(NULL),
true_(NULL),
false_(NULL),
acquired_error_(NULL) {}
~ApiState() {
- while (top_scope_ != NULL) {
- ApiLocalScope* scope = top_scope_;
- top_scope_ = top_scope_->previous();
- delete scope;
- }
if (null_ != NULL) {
persistent_handles().FreeHandle(null_);
null_ = NULL;
@@ -699,38 +692,13 @@ class ApiState {
}
// Accessors.
- ApiLocalScope* reusable_scope() const { return reusable_scope_; }
- void set_reusable_scope(ApiLocalScope* value) {
- ASSERT(value == NULL || reusable_scope_ == NULL);
- reusable_scope_ = value;
- }
- ApiLocalScope* top_scope() const { return top_scope_; }
- void set_top_scope(ApiLocalScope* value) { top_scope_ = value; }
-
PersistentHandles& persistent_handles() { return persistent_handles_; }
FinalizablePersistentHandles& weak_persistent_handles() {
return weak_persistent_handles_;
}
- void UnwindScopes(uword stack_marker) {
- // Unwind all scopes using the same stack_marker, i.e. all scopes allocated
- // under the same top_exit_frame_info.
- while (top_scope_ != NULL &&
- top_scope_->stack_marker() != 0 &&
- top_scope_->stack_marker() == stack_marker) {
- ApiLocalScope* scope = top_scope_;
- top_scope_ = top_scope_->previous();
- delete scope;
- }
- }
-
void VisitObjectPointers(ObjectPointerVisitor* visitor) {
- ApiLocalScope* scope = top_scope_;
- while (scope != NULL) {
- scope->local_handles()->VisitObjectPointers(visitor);
- scope = scope->previous();
- }
persistent_handles().VisitObjectPointers(visitor);
}
@@ -738,17 +706,6 @@ class ApiState {
weak_persistent_handles().VisitHandles(visitor);
}
- bool IsValidLocalHandle(Dart_Handle object) const {
- ApiLocalScope* scope = top_scope_;
- while (scope != NULL) {
- if (scope->local_handles()->IsValidHandle(object)) {
- return true;
- }
- scope = scope->previous();
- }
- return false;
- }
-
bool IsValidPersistentHandle(Dart_PersistentHandle object) const {
return persistent_handles_.IsValidHandle(object);
}
@@ -762,27 +719,9 @@ class ApiState {
return object == null_ || object == true_ || object == false_;
}
- int CountLocalHandles() const {
- int total = 0;
- ApiLocalScope* scope = top_scope_;
- while (scope != NULL) {
- total += scope->local_handles()->CountHandles();
- scope = scope->previous();
- }
- return total;
- }
int CountPersistentHandles() const {
return persistent_handles_.CountHandles();
}
- int ZoneSizeInBytes() const {
- int total = 0;
- ApiLocalScope* scope = top_scope_;
- while (scope != NULL) {
- total += scope->zone()->SizeInBytes();
- scope = scope->previous();
- }
- return total;
- }
void SetupAcquiredError() {
ASSERT(acquired_error_ == NULL);
@@ -803,8 +742,6 @@ class ApiState {
private:
PersistentHandles persistent_handles_;
FinalizablePersistentHandles weak_persistent_handles_;
- ApiLocalScope* reusable_scope_;
- ApiLocalScope* top_scope_;
WeakTable acquired_table_;
// Persistent handles to important objects.
« 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