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

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

Issue 1760963002: Print isolate properly in debug output for IsolateRunnable events. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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
« no previous file with comments | « runtime/vm/service.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) 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 "vm/service.h" 5 #include "vm/service.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "include/dart_native_api.h" 8 #include "include/dart_native_api.h"
9 #include "platform/globals.h" 9 #include "platform/globals.h"
10 10
(...skipping 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after
1023 const char* stream_id = event->stream_id(); 1023 const char* stream_id = event->stream_id();
1024 ASSERT(stream_id != NULL); 1024 ASSERT(stream_id != NULL);
1025 { 1025 {
1026 JSONObject jsobj(&js); 1026 JSONObject jsobj(&js);
1027 jsobj.AddProperty("jsonrpc", "2.0"); 1027 jsobj.AddProperty("jsonrpc", "2.0");
1028 jsobj.AddProperty("method", "streamNotify"); 1028 jsobj.AddProperty("method", "streamNotify");
1029 JSONObject params(&jsobj, "params"); 1029 JSONObject params(&jsobj, "params");
1030 params.AddProperty("streamId", stream_id); 1030 params.AddProperty("streamId", stream_id);
1031 params.AddProperty("event", event); 1031 params.AddProperty("event", event);
1032 } 1032 }
1033 PostEvent(stream_id, event->KindAsCString(), &js); 1033 PostEvent(event->isolate(), stream_id, event->KindAsCString(), &js);
1034 } 1034 }
1035 1035
1036 1036
1037 void Service::PostEvent(const char* stream_id, 1037 void Service::PostEvent(Isolate* isolate,
1038 const char* stream_id,
1038 const char* kind, 1039 const char* kind,
1039 JSONStream* event) { 1040 JSONStream* event) {
1040 ASSERT(stream_id != NULL); 1041 ASSERT(stream_id != NULL);
1041 ASSERT(kind != NULL); 1042 ASSERT(kind != NULL);
1042 ASSERT(event != NULL); 1043 ASSERT(event != NULL);
1043 1044
1044 // Message is of the format [<stream id>, <json string>]. 1045 // Message is of the format [<stream id>, <json string>].
1045 // 1046 //
1046 // Build the event message in the C heap to avoid dart heap 1047 // Build the event message in the C heap to avoid dart heap
1047 // allocation. This method can be called while we have acquired a 1048 // allocation. This method can be called while we have acquired a
1048 // direct pointer to typed data, so we can't allocate here. 1049 // direct pointer to typed data, so we can't allocate here.
1049 Dart_CObject list_cobj; 1050 Dart_CObject list_cobj;
1050 Dart_CObject* list_values[2]; 1051 Dart_CObject* list_values[2];
1051 list_cobj.type = Dart_CObject_kArray; 1052 list_cobj.type = Dart_CObject_kArray;
1052 list_cobj.value.as_array.length = 2; 1053 list_cobj.value.as_array.length = 2;
1053 list_cobj.value.as_array.values = list_values; 1054 list_cobj.value.as_array.values = list_values;
1054 1055
1055 Dart_CObject stream_id_cobj; 1056 Dart_CObject stream_id_cobj;
1056 stream_id_cobj.type = Dart_CObject_kString; 1057 stream_id_cobj.type = Dart_CObject_kString;
1057 stream_id_cobj.value.as_string = const_cast<char*>(stream_id); 1058 stream_id_cobj.value.as_string = const_cast<char*>(stream_id);
1058 list_values[0] = &stream_id_cobj; 1059 list_values[0] = &stream_id_cobj;
1059 1060
1060 Dart_CObject json_cobj; 1061 Dart_CObject json_cobj;
1061 json_cobj.type = Dart_CObject_kString; 1062 json_cobj.type = Dart_CObject_kString;
1062 json_cobj.value.as_string = const_cast<char*>(event->ToCString()); 1063 json_cobj.value.as_string = const_cast<char*>(event->ToCString());
1063 list_values[1] = &json_cobj; 1064 list_values[1] = &json_cobj;
1064 1065
1065 if (FLAG_trace_service) { 1066 if (FLAG_trace_service) {
1066 Isolate* isolate = Isolate::Current();
1067 const char* isolate_name = "<no current isolate>"; 1067 const char* isolate_name = "<no current isolate>";
1068 if (isolate != NULL) { 1068 if (isolate != NULL) {
1069 isolate_name = isolate->name(); 1069 isolate_name = isolate->name();
1070 } 1070 }
1071 OS::Print("vm-service: Pushing ServiceEvent(isolate='%s', kind='%s') " 1071 OS::Print("vm-service: Pushing ServiceEvent(isolate='%s', kind='%s') "
1072 "to stream %s\n", 1072 "to stream %s\n",
1073 isolate_name, kind, stream_id); 1073 isolate_name, kind, stream_id);
1074 } 1074 }
1075 1075
1076 Dart_PostCObject(ServiceIsolate::Port(), &list_cobj); 1076 Dart_PostCObject(ServiceIsolate::Port(), &list_cobj);
(...skipping 3019 matching lines...) Expand 10 before | Expand all | Expand 10 after
4096 if (strcmp(method_name, method.name) == 0) { 4096 if (strcmp(method_name, method.name) == 0) {
4097 return &method; 4097 return &method;
4098 } 4098 }
4099 } 4099 }
4100 return NULL; 4100 return NULL;
4101 } 4101 }
4102 4102
4103 #endif // !PRODUCT 4103 #endif // !PRODUCT
4104 4104
4105 } // namespace dart 4105 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698