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

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

Issue 205153002: Auto delete persistent weak handles during finalization after invoking the callback associated with… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 9 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_state.h ('k') | runtime/vm/object.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_OBJECT_H_ 5 #ifndef VM_OBJECT_H_
6 #define VM_OBJECT_H_ 6 #define VM_OBJECT_H_
7 7
8 #include "include/dart_api.h" 8 #include "include/dart_api.h"
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "platform/utils.h" 10 #include "platform/utils.h"
(...skipping 2350 matching lines...) Expand 10 before | Expand all | Expand 10 after
2361 intptr_t cur_token_pos_; 2361 intptr_t cur_token_pos_;
2362 Token::Kind cur_token_kind_; 2362 Token::Kind cur_token_kind_;
2363 intptr_t cur_token_obj_index_; 2363 intptr_t cur_token_obj_index_;
2364 Iterator::StreamType stream_type_; 2364 Iterator::StreamType stream_type_;
2365 }; 2365 };
2366 2366
2367 private: 2367 private:
2368 void SetPrivateKey(const String& value) const; 2368 void SetPrivateKey(const String& value) const;
2369 2369
2370 static RawTokenStream* New(); 2370 static RawTokenStream* New();
2371 static void DataFinalizer(Dart_Isolate isolate, 2371 static void DataFinalizer(void* isolate_callback_data,
2372 Dart_WeakPersistentHandle handle, 2372 Dart_WeakPersistentHandle handle,
2373 void *peer); 2373 void *peer);
2374 2374
2375 FINAL_HEAP_OBJECT_IMPLEMENTATION(TokenStream, Object); 2375 FINAL_HEAP_OBJECT_IMPLEMENTATION(TokenStream, Object);
2376 friend class Class; 2376 friend class Class;
2377 }; 2377 };
2378 2378
2379 2379
2380 class Script : public Object { 2380 class Script : public Object {
2381 public: 2381 public:
(...skipping 2939 matching lines...) Expand 10 before | Expand all | Expand 10 after
5321 // "str" must be OneByteString. 5321 // "str" must be OneByteString.
5322 static RawOneByteString* SubStringUnchecked(const String& str, 5322 static RawOneByteString* SubStringUnchecked(const String& str,
5323 intptr_t begin_index, 5323 intptr_t begin_index,
5324 intptr_t length, 5324 intptr_t length,
5325 Heap::Space space); 5325 Heap::Space space);
5326 5326
5327 static void SetPeer(const String& str, 5327 static void SetPeer(const String& str,
5328 void* peer, 5328 void* peer,
5329 Dart_PeerFinalizer cback); 5329 Dart_PeerFinalizer cback);
5330 5330
5331 static void Finalize(Dart_Isolate isolate, 5331 static void Finalize(void* isolate_callback_data,
5332 Dart_WeakPersistentHandle handle, 5332 Dart_WeakPersistentHandle handle,
5333 void* peer); 5333 void* peer);
5334 5334
5335 static const ClassId kClassId = kOneByteStringCid; 5335 static const ClassId kClassId = kOneByteStringCid;
5336 5336
5337 static RawOneByteString* null() { 5337 static RawOneByteString* null() {
5338 return reinterpret_cast<RawOneByteString*>(Object::null()); 5338 return reinterpret_cast<RawOneByteString*>(Object::null());
5339 } 5339 }
5340 5340
5341 private: 5341 private:
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
5414 Heap::Space space); 5414 Heap::Space space);
5415 5415
5416 static RawTwoByteString* Transform(int32_t (*mapping)(int32_t ch), 5416 static RawTwoByteString* Transform(int32_t (*mapping)(int32_t ch),
5417 const String& str, 5417 const String& str,
5418 Heap::Space space); 5418 Heap::Space space);
5419 5419
5420 static void SetPeer(const String& str, 5420 static void SetPeer(const String& str,
5421 void* peer, 5421 void* peer,
5422 Dart_PeerFinalizer cback); 5422 Dart_PeerFinalizer cback);
5423 5423
5424 static void Finalize(Dart_Isolate isolate, 5424 static void Finalize(void* isolate_callback_data,
5425 Dart_WeakPersistentHandle handle, 5425 Dart_WeakPersistentHandle handle,
5426 void* peer); 5426 void* peer);
5427 5427
5428 static RawTwoByteString* null() { 5428 static RawTwoByteString* null() {
5429 return reinterpret_cast<RawTwoByteString*>(Object::null()); 5429 return reinterpret_cast<RawTwoByteString*>(Object::null());
5430 } 5430 }
5431 5431
5432 5432
5433 static const ClassId kClassId = kTwoByteStringCid; 5433 static const ClassId kClassId = kTwoByteStringCid;
5434 5434
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
5509 return &(raw_ptr(str)->external_data_->data()[index]); 5509 return &(raw_ptr(str)->external_data_->data()[index]);
5510 } 5510 }
5511 5511
5512 static void SetExternalData(const String& str, 5512 static void SetExternalData(const String& str,
5513 ExternalStringData<uint8_t>* data) { 5513 ExternalStringData<uint8_t>* data) {
5514 ASSERT(str.IsExternalOneByteString()); 5514 ASSERT(str.IsExternalOneByteString());
5515 NoGCScope no_gc; 5515 NoGCScope no_gc;
5516 raw_ptr(str)->external_data_ = data; 5516 raw_ptr(str)->external_data_ = data;
5517 } 5517 }
5518 5518
5519 static void Finalize(Dart_Isolate isolate, 5519 static void Finalize(void* isolate_callback_data,
5520 Dart_WeakPersistentHandle handle, 5520 Dart_WeakPersistentHandle handle,
5521 void* peer); 5521 void* peer);
5522 5522
5523 static RawExternalOneByteString* ReadFrom(SnapshotReader* reader, 5523 static RawExternalOneByteString* ReadFrom(SnapshotReader* reader,
5524 intptr_t object_id, 5524 intptr_t object_id,
5525 intptr_t tags, 5525 intptr_t tags,
5526 Snapshot::Kind kind); 5526 Snapshot::Kind kind);
5527 5527
5528 static intptr_t NextFieldOffset() { 5528 static intptr_t NextFieldOffset() {
5529 // Indicates this class cannot be extended by dart code. 5529 // Indicates this class cannot be extended by dart code.
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
5582 return &(raw_ptr(str)->external_data_->data()[index]); 5582 return &(raw_ptr(str)->external_data_->data()[index]);
5583 } 5583 }
5584 5584
5585 static void SetExternalData(const String& str, 5585 static void SetExternalData(const String& str,
5586 ExternalStringData<uint16_t>* data) { 5586 ExternalStringData<uint16_t>* data) {
5587 ASSERT(str.IsExternalTwoByteString()); 5587 ASSERT(str.IsExternalTwoByteString());
5588 NoGCScope no_gc; 5588 NoGCScope no_gc;
5589 raw_ptr(str)->external_data_ = data; 5589 raw_ptr(str)->external_data_ = data;
5590 } 5590 }
5591 5591
5592 static void Finalize(Dart_Isolate isolate, 5592 static void Finalize(void* isolate_callback_data,
5593 Dart_WeakPersistentHandle handle, 5593 Dart_WeakPersistentHandle handle,
5594 void* peer); 5594 void* peer);
5595 5595
5596 static RawExternalTwoByteString* ReadFrom(SnapshotReader* reader, 5596 static RawExternalTwoByteString* ReadFrom(SnapshotReader* reader,
5597 intptr_t object_id, 5597 intptr_t object_id,
5598 intptr_t tags, 5598 intptr_t tags,
5599 Snapshot::Kind kind); 5599 Snapshot::Kind kind);
5600 5600
5601 static intptr_t NextFieldOffset() { 5601 static intptr_t NextFieldOffset() {
5602 // Indicates this class cannot be extended by dart code. 5602 // Indicates this class cannot be extended by dart code.
(...skipping 1139 matching lines...) Expand 10 before | Expand all | Expand 10 after
6742 6742
6743 6743
6744 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 6744 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
6745 intptr_t index) { 6745 intptr_t index) {
6746 return array.At((index * kEntryLength) + kTargetFunctionIndex); 6746 return array.At((index * kEntryLength) + kTargetFunctionIndex);
6747 } 6747 }
6748 6748
6749 } // namespace dart 6749 } // namespace dart
6750 6750
6751 #endif // VM_OBJECT_H_ 6751 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/dart_api_state.h ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698