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

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

Issue 148453016: Add new Dart API function Dart_IsolateData which returns the peer isolate data associated with an i… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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/include/dart_api.h ('k') | runtime/vm/dart_api_impl_test.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) 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 902 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 } 913 }
914 914
915 915
916 DART_EXPORT void* Dart_CurrentIsolateData() { 916 DART_EXPORT void* Dart_CurrentIsolateData() {
917 Isolate* isolate = Isolate::Current(); 917 Isolate* isolate = Isolate::Current();
918 CHECK_ISOLATE(isolate); 918 CHECK_ISOLATE(isolate);
919 return isolate->init_callback_data(); 919 return isolate->init_callback_data();
920 } 920 }
921 921
922 922
923 DART_EXPORT void* Dart_IsolateData(Dart_Isolate isolate) {
924 TRACE_API_CALL(CURRENT_FUNC);
925 if (isolate == NULL) {
926 FATAL1("%s expects argument 'isolate' to be non-null.", CURRENT_FUNC);
927 }
928 // TODO(16615): Validate isolate parameter.
929 Isolate* iso = reinterpret_cast<Isolate*>(isolate);
930 return iso->init_callback_data();
931 }
932
933
923 DART_EXPORT Dart_Handle Dart_DebugName() { 934 DART_EXPORT Dart_Handle Dart_DebugName() {
924 Isolate* isolate = Isolate::Current(); 935 Isolate* isolate = Isolate::Current();
925 DARTSCOPE(isolate); 936 DARTSCOPE(isolate);
926 return Api::NewHandle(isolate, String::New(isolate->name())); 937 return Api::NewHandle(isolate, String::New(isolate->name()));
927 } 938 }
928 939
929 940
930 941
931 DART_EXPORT void Dart_EnterIsolate(Dart_Isolate dart_isolate) { 942 DART_EXPORT void Dart_EnterIsolate(Dart_Isolate isolate) {
932 CHECK_NO_ISOLATE(Isolate::Current()); 943 CHECK_NO_ISOLATE(Isolate::Current());
933 Isolate* isolate = reinterpret_cast<Isolate*>(dart_isolate); 944 // TODO(16615): Validate isolate parameter.
934 Isolate::SetCurrent(isolate); 945 Isolate* iso = reinterpret_cast<Isolate*>(isolate);
946 Isolate::SetCurrent(iso);
935 } 947 }
936 948
937 949
938 DART_EXPORT void Dart_ExitIsolate() { 950 DART_EXPORT void Dart_ExitIsolate() {
939 CHECK_ISOLATE(Isolate::Current()); 951 CHECK_ISOLATE(Isolate::Current());
940 Isolate::SetCurrent(NULL); 952 Isolate::SetCurrent(NULL);
941 } 953 }
942 954
943 955
944 static uint8_t* ApiReallocate(uint8_t* ptr, 956 static uint8_t* ApiReallocate(uint8_t* ptr,
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1000 *size = writer.BytesWritten(); 1012 *size = writer.BytesWritten();
1001 return Api::Success(); 1013 return Api::Success();
1002 } 1014 }
1003 1015
1004 1016
1005 DART_EXPORT void Dart_InterruptIsolate(Dart_Isolate isolate) { 1017 DART_EXPORT void Dart_InterruptIsolate(Dart_Isolate isolate) {
1006 TRACE_API_CALL(CURRENT_FUNC); 1018 TRACE_API_CALL(CURRENT_FUNC);
1007 if (isolate == NULL) { 1019 if (isolate == NULL) {
1008 FATAL1("%s expects argument 'isolate' to be non-null.", CURRENT_FUNC); 1020 FATAL1("%s expects argument 'isolate' to be non-null.", CURRENT_FUNC);
1009 } 1021 }
1022 // TODO(16615): Validate isolate parameter.
1010 Isolate* iso = reinterpret_cast<Isolate*>(isolate); 1023 Isolate* iso = reinterpret_cast<Isolate*>(isolate);
1011 iso->ScheduleInterrupts(Isolate::kApiInterrupt); 1024 iso->ScheduleInterrupts(Isolate::kApiInterrupt);
1012 } 1025 }
1013 1026
1014 1027
1015 DART_EXPORT bool Dart_IsolateMakeRunnable(Dart_Isolate isolate) { 1028 DART_EXPORT bool Dart_IsolateMakeRunnable(Dart_Isolate isolate) {
1016 CHECK_NO_ISOLATE(Isolate::Current()); 1029 CHECK_NO_ISOLATE(Isolate::Current());
1017 if (isolate == NULL) { 1030 if (isolate == NULL) {
1018 FATAL1("%s expects argument 'isolate' to be non-null.", CURRENT_FUNC); 1031 FATAL1("%s expects argument 'isolate' to be non-null.", CURRENT_FUNC);
1019 } 1032 }
1033 // TODO(16615): Validate isolate parameter.
1020 Isolate* iso = reinterpret_cast<Isolate*>(isolate); 1034 Isolate* iso = reinterpret_cast<Isolate*>(isolate);
1021 return iso->MakeRunnable(); 1035 return iso->MakeRunnable();
1022 } 1036 }
1023 1037
1024 1038
1025 // --- Messages and Ports --- 1039 // --- Messages and Ports ---
1026 1040
1027 DART_EXPORT void Dart_SetMessageNotifyCallback( 1041 DART_EXPORT void Dart_SetMessageNotifyCallback(
1028 Dart_MessageNotifyCallback message_notify_callback) { 1042 Dart_MessageNotifyCallback message_notify_callback) {
1029 Isolate* isolate = Isolate::Current(); 1043 Isolate* isolate = Isolate::Current();
(...skipping 3504 matching lines...) Expand 10 before | Expand all | Expand 10 after
4534 } 4548 }
4535 4549
4536 4550
4537 // --- Service support --- 4551 // --- Service support ---
4538 4552
4539 DART_EXPORT Dart_Isolate Dart_GetServiceIsolate(void* callback_data) { 4553 DART_EXPORT Dart_Isolate Dart_GetServiceIsolate(void* callback_data) {
4540 return Api::CastIsolate(Service::GetServiceIsolate(callback_data)); 4554 return Api::CastIsolate(Service::GetServiceIsolate(callback_data));
4541 } 4555 }
4542 4556
4543 } // namespace dart 4557 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/include/dart_api.h ('k') | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698