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

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

Issue 337183002: Refactor creation of FinalizablePersistentHandle into proper factory. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 6 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') | no next file » | 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 #include "vm/object.h" 5 #include "vm/object.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 16852 matching lines...) Expand 10 before | Expand all | Expand 10 after
16863 Utf8::Encode(*this, reinterpret_cast<char*>(utf8_array), array_len); 16863 Utf8::Encode(*this, reinterpret_cast<char*>(utf8_array), array_len);
16864 } 16864 }
16865 16865
16866 16866
16867 static FinalizablePersistentHandle* AddFinalizer( 16867 static FinalizablePersistentHandle* AddFinalizer(
16868 const Object& referent, 16868 const Object& referent,
16869 void* peer, 16869 void* peer,
16870 Dart_WeakPersistentHandleFinalizer callback) { 16870 Dart_WeakPersistentHandleFinalizer callback) {
16871 ASSERT((callback != NULL && peer != NULL) || 16871 ASSERT((callback != NULL && peer != NULL) ||
16872 (callback == NULL && peer == NULL)); 16872 (callback == NULL && peer == NULL));
16873 ApiState* state = Isolate::Current()->api_state(); 16873 const bool is_prologue = false;
16874 ASSERT(state != NULL); 16874 // TODO(19482): Make API consistent for external size of strings/typed data.
16875 FinalizablePersistentHandle* weak_ref = 16875 const intptr_t external_size = 0;
16876 state->weak_persistent_handles().AllocateHandle(); 16876 return FinalizablePersistentHandle::New(Isolate::Current(),
16877 weak_ref->set_raw(referent); 16877 is_prologue,
16878 weak_ref->set_peer(peer); 16878 referent,
16879 weak_ref->set_callback(callback); 16879 peer,
16880 return weak_ref; 16880 callback,
16881 external_size);
16881 } 16882 }
16882 16883
16883 16884
16884 RawString* String::MakeExternal(void* array, 16885 RawString* String::MakeExternal(void* array,
16885 intptr_t length, 16886 intptr_t length,
16886 void* peer, 16887 void* peer,
16887 Dart_PeerFinalizer cback) const { 16888 Dart_PeerFinalizer cback) const {
16888 NoGCScope no_gc; 16889 NoGCScope no_gc;
16889 ASSERT(array != NULL); 16890 ASSERT(array != NULL);
16890 intptr_t str_length = this->Length(); 16891 intptr_t str_length = this->Length();
(...skipping 2177 matching lines...) Expand 10 before | Expand all | Expand 10 after
19068 return tag_label.ToCString(); 19069 return tag_label.ToCString();
19069 } 19070 }
19070 19071
19071 19072
19072 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { 19073 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const {
19073 Instance::PrintJSONImpl(stream, ref); 19074 Instance::PrintJSONImpl(stream, ref);
19074 } 19075 }
19075 19076
19076 19077
19077 } // namespace dart 19078 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/dart_api_state.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698