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

Unified Diff: runtime/vm/dart_api_impl.cc

Issue 1232193003: Provide stdout and stderr output in the Observatory debugger. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: before commit Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/observatory/tests/service/capture_stdio_test.dart ('k') | runtime/vm/debugger.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart_api_impl.cc
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
index 99e9a559bad7bb12151f6bce0e208c75782ef4da..4cee7e86fe666c40a492fbf8786145044225e996 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -5692,6 +5692,67 @@ DART_EXPORT void Dart_RegisterRootServiceRequestCallback(
}
+DART_EXPORT Dart_Handle Dart_SetServiceStreamCallbacks(
+ Dart_ServiceStreamListenCallback listen_callback,
+ Dart_ServiceStreamCancelCallback cancel_callback) {
+ if (listen_callback != NULL) {
+ if (Service::stream_listen_callback() != NULL) {
+ return Api::NewError(
+ "%s permits only one listen callback to be registered, please "
+ "remove the existing callback and then add this callback",
+ CURRENT_FUNC);
+ }
+ } else {
+ if (Service::stream_listen_callback() == NULL) {
+ return Api::NewError(
+ "%s expects 'listen_callback' to be present in the callback set.",
+ CURRENT_FUNC);
+ }
+ }
+ if (cancel_callback != NULL) {
+ if (Service::stream_cancel_callback() != NULL) {
+ return Api::NewError(
+ "%s permits only one cancel callback to be registered, please "
+ "remove the existing callback and then add this callback",
+ CURRENT_FUNC);
+ }
+ } else {
+ if (Service::stream_cancel_callback() == NULL) {
+ return Api::NewError(
+ "%s expects 'cancel_callback' to be present in the callback set.",
+ CURRENT_FUNC);
+ }
+ }
+ Service::SetEmbedderStreamCallbacks(listen_callback, cancel_callback);
+ return Api::Success();
+}
+
+
+DART_EXPORT Dart_Handle Dart_ServiceSendDataEvent(const char* stream_id,
+ const char* event_kind,
+ const uint8_t* bytes,
+ intptr_t bytes_length) {
+ Isolate* isolate = Isolate::Current();
+ DARTSCOPE(isolate);
+ if (stream_id == NULL) {
+ RETURN_NULL_ERROR(stream_id);
+ }
+ if (event_kind == NULL) {
+ RETURN_NULL_ERROR(event_kind);
+ }
+ if (bytes == NULL) {
+ RETURN_NULL_ERROR(bytes);
+ }
+ if (bytes_length < 0) {
+ return Api::NewError("%s expects argument 'bytes_length' to be >= 0.",
+ CURRENT_FUNC);
+ }
+ Service::SendEmbedderEvent(isolate, stream_id, event_kind,
+ bytes, bytes_length);
+ return Api::Success();
+}
+
+
DART_EXPORT Dart_Handle Dart_TimelineDuration(const char* label,
int64_t start_micros,
int64_t end_micros) {
« no previous file with comments | « runtime/observatory/tests/service/capture_stdio_test.dart ('k') | runtime/vm/debugger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698