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

Side by Side Diff: runtime/vm/dart_api_state.h

Issue 9398014: Ignore deleted handles when processing weak roots. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: final revision Created 8 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/dart_api_impl_test.cc ('k') | runtime/vm/gc_marker.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 void set_raw(const Object& object) { raw_ = object.raw(); } 128 void set_raw(const Object& object) { raw_ = object.raw(); }
129 static intptr_t raw_offset() { return OFFSET_OF(WeakPersistentHandle, raw_); } 129 static intptr_t raw_offset() { return OFFSET_OF(WeakPersistentHandle, raw_); }
130 void* peer() const { return peer_; } 130 void* peer() const { return peer_; }
131 void set_peer(void* peer) { peer_ = peer; } 131 void set_peer(void* peer) { peer_ = peer; }
132 Dart_WeakPersistentHandleFinalizer callback() const { return callback_; } 132 Dart_WeakPersistentHandleFinalizer callback() const { return callback_; }
133 void set_callback(Dart_WeakPersistentHandleFinalizer callback) { 133 void set_callback(Dart_WeakPersistentHandleFinalizer callback) {
134 callback_ = callback; 134 callback_ = callback;
135 } 135 }
136 136
137 static void Finalize(WeakPersistentHandle* handle) { 137 static void Finalize(WeakPersistentHandle* handle) {
138 if (handle->callback() != NULL) { 138 Dart_WeakPersistentHandleFinalizer callback = handle->callback();
139 Dart_WeakPersistentHandleFinalizer callback = handle->callback(); 139 if (callback != NULL) {
140 void* peer = handle->peer(); 140 void* peer = handle->peer();
141 handle->Clear(); 141 handle->Clear();
142 (*callback)(reinterpret_cast<Dart_Handle>(handle), peer); 142 (*callback)(reinterpret_cast<Dart_Handle>(handle), peer);
143 } else { 143 } else {
144 handle->Clear(); 144 handle->Clear();
145 } 145 }
146 } 146 }
147 147
148 private: 148 private:
149 friend class WeakPersistentHandles; 149 friend class WeakPersistentHandles;
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 ApiNativeScope::Current()->zone()->GetBaseZone()) {} 558 ApiNativeScope::Current()->zone()->GetBaseZone()) {}
559 ApiGrowableArray() 559 ApiGrowableArray()
560 : BaseGrowableArray<T, ValueObject>( 560 : BaseGrowableArray<T, ValueObject>(
561 ApiNativeScope::Current()->zone()->GetBaseZone()) {} 561 ApiNativeScope::Current()->zone()->GetBaseZone()) {}
562 }; 562 };
563 563
564 564
565 } // namespace dart 565 } // namespace dart
566 566
567 #endif // VM_DART_API_STATE_H_ 567 #endif // VM_DART_API_STATE_H_
OLDNEW
« no previous file with comments | « runtime/vm/dart_api_impl_test.cc ('k') | runtime/vm/gc_marker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698