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

Side by Side Diff: runtime/vm/dart_api_impl.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 | « no previous file | runtime/vm/dart_api_state.h » ('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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 "include/dart_api.h" 5 #include "include/dart_api.h"
6 #include "include/dart_mirrors_api.h" 6 #include "include/dart_mirrors_api.h"
7 #include "include/dart_native_api.h" 7 #include "include/dart_native_api.h"
8 8
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "vm/bigint_operations.h" 10 #include "vm/bigint_operations.h"
(...skipping 929 matching lines...) Expand 10 before | Expand all | Expand 10 after
940 } 940 }
941 941
942 942
943 static Dart_WeakPersistentHandle AllocateFinalizableHandle( 943 static Dart_WeakPersistentHandle AllocateFinalizableHandle(
944 Isolate* isolate, 944 Isolate* isolate,
945 Dart_Handle object, 945 Dart_Handle object,
946 bool is_prologue, 946 bool is_prologue,
947 void* peer, 947 void* peer,
948 intptr_t external_allocation_size, 948 intptr_t external_allocation_size,
949 Dart_WeakPersistentHandleFinalizer callback) { 949 Dart_WeakPersistentHandleFinalizer callback) {
950 ApiState* state = isolate->api_state();
951 ASSERT(state != NULL);
952 REUSABLE_OBJECT_HANDLESCOPE(isolate); 950 REUSABLE_OBJECT_HANDLESCOPE(isolate);
953 Object& ref = isolate->ObjectHandle(); 951 Object& ref = isolate->ObjectHandle();
954 ref = Api::UnwrapHandle(object); 952 ref = Api::UnwrapHandle(object);
955 FinalizablePersistentHandle* finalizable_ref = is_prologue ? 953 FinalizablePersistentHandle* finalizable_ref =
956 state->prologue_weak_persistent_handles().AllocateHandle() : 954 FinalizablePersistentHandle::New(isolate,
957 state->weak_persistent_handles().AllocateHandle(); 955 is_prologue,
958 956 ref,
959 finalizable_ref->set_raw(ref); 957 peer,
960 finalizable_ref->set_peer(peer); 958 callback,
961 finalizable_ref->set_callback(callback); 959 external_allocation_size);
962 finalizable_ref->SetExternalSize(external_allocation_size, isolate);
963 finalizable_ref->SetPrologueWeakPersistent(is_prologue);
964 return finalizable_ref->apiHandle(); 960 return finalizable_ref->apiHandle();
965 } 961 }
966 962
967 963
968 DART_EXPORT Dart_WeakPersistentHandle Dart_NewWeakPersistentHandle( 964 DART_EXPORT Dart_WeakPersistentHandle Dart_NewWeakPersistentHandle(
969 Dart_Handle object, 965 Dart_Handle object,
970 void* peer, 966 void* peer,
971 intptr_t external_allocation_size, 967 intptr_t external_allocation_size,
972 Dart_WeakPersistentHandleFinalizer callback) { 968 Dart_WeakPersistentHandleFinalizer callback) {
973 Isolate* isolate = Isolate::Current(); 969 Isolate* isolate = Isolate::Current();
(...skipping 4218 matching lines...) Expand 10 before | Expand all | Expand 10 after
5192 5188
5193 5189
5194 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( 5190 DART_EXPORT void Dart_RegisterRootServiceRequestCallback(
5195 const char* name, 5191 const char* name,
5196 Dart_ServiceRequestCallback callback, 5192 Dart_ServiceRequestCallback callback,
5197 void* user_data) { 5193 void* user_data) {
5198 Service::RegisterRootEmbedderCallback(name, callback, user_data); 5194 Service::RegisterRootEmbedderCallback(name, callback, user_data);
5199 } 5195 }
5200 5196
5201 } // namespace dart 5197 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/dart_api_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698