OLD | NEW |
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 990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1001 ServiceIsolate::server_address()); | 1001 ServiceIsolate::server_address()); |
1002 } | 1002 } |
1003 const Error& err = Error::Handle(Thread::Current()->sticky_error()); | 1003 const Error& err = Error::Handle(Thread::Current()->sticky_error()); |
1004 if (!err.IsNull()) { | 1004 if (!err.IsNull()) { |
1005 OS::PrintErr("%s\n", err.ToErrorCString()); | 1005 OS::PrintErr("%s\n", err.ToErrorCString()); |
1006 } | 1006 } |
1007 } | 1007 } |
1008 | 1008 |
1009 | 1009 |
1010 void Service::HandleEvent(ServiceEvent* event) { | 1010 void Service::HandleEvent(ServiceEvent* event) { |
1011 if (event->isolate() != NULL && | 1011 if (event->stream_info() != NULL && |
1012 ServiceIsolate::IsServiceIsolateDescendant(event->isolate())) { | 1012 !event->stream_info()->enabled()) { |
| 1013 if (FLAG_warn_on_pause_with_no_debugger && |
| 1014 event->IsPause()) { |
| 1015 // If we are about to pause a running program which has no |
| 1016 // debugger connected, tell the user about it. |
| 1017 ReportPauseOnConsole(event); |
| 1018 } |
| 1019 // Ignore events when no one is listening to the event stream. |
1013 return; | 1020 return; |
1014 } | 1021 } |
1015 if (FLAG_warn_on_pause_with_no_debugger && | |
1016 event->IsPause() && !Service::debug_stream.enabled()) { | |
1017 // If we are about to pause a running program which has no | |
1018 // debugger connected, tell the user about it. | |
1019 ReportPauseOnConsole(event); | |
1020 } | |
1021 if (!ServiceIsolate::IsRunning()) { | 1022 if (!ServiceIsolate::IsRunning()) { |
1022 return; | 1023 return; |
1023 } | 1024 } |
1024 JSONStream js; | 1025 JSONStream js; |
1025 const char* stream_id = event->stream_id(); | 1026 const char* stream_id = event->stream_id(); |
1026 ASSERT(stream_id != NULL); | 1027 ASSERT(stream_id != NULL); |
1027 { | 1028 { |
1028 JSONObject jsobj(&js); | 1029 JSONObject jsobj(&js); |
1029 jsobj.AddProperty("jsonrpc", "2.0"); | 1030 jsobj.AddProperty("jsonrpc", "2.0"); |
1030 jsobj.AddProperty("method", "streamNotify"); | 1031 jsobj.AddProperty("method", "streamNotify"); |
(...skipping 2945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3976 if (strcmp(method_name, method.name) == 0) { | 3977 if (strcmp(method_name, method.name) == 0) { |
3977 return &method; | 3978 return &method; |
3978 } | 3979 } |
3979 } | 3980 } |
3980 return NULL; | 3981 return NULL; |
3981 } | 3982 } |
3982 | 3983 |
3983 #endif // !PRODUCT | 3984 #endif // !PRODUCT |
3984 | 3985 |
3985 } // namespace dart | 3986 } // namespace dart |
OLD | NEW |