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

Unified Diff: runtime/vm/dart_api_impl.cc

Issue 1799933002: Ensure embedder timeline callbacks are called for service protocol requests (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 side-by-side diff with in-line comments
Download patch
Index: runtime/vm/dart_api_impl.cc
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
index 8f3cb9764c5cb10600f17e19c39e48d7ff920198..12a7fdb29e501f2d732d551fc6b715e79d1be954 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -5890,8 +5890,7 @@ static void DataStreamToConsumer(Dart_StreamConsumer consumer,
static bool StreamTraceEvents(Dart_StreamConsumer consumer,
void* user_data,
- JSONStream* js,
- bool insert_comma) {
+ JSONStream* js) {
ASSERT(js != NULL);
// Steal output from JSONStream.
char* output = NULL;
@@ -5909,13 +5908,8 @@ static bool StreamTraceEvents(Dart_StreamConsumer consumer,
// Replace the ']' with the null character.
output[output_length - 1] = '\0';
char* start = &output[1];
- if (insert_comma) {
- output[0] = ',';
- start = &output[0];
- } else {
- // We are skipping the '['.
- output_length -= 1;
- }
+ // We are skipping the '['.
+ output_length -= 1;
DataStreamToConsumer(consumer,
user_data,
@@ -5952,7 +5946,7 @@ DART_EXPORT bool Dart_TimelineGetTrace(Dart_StreamConsumer consumer,
IsolateTimelineEventFilter filter(isolate->main_port());
timeline_recorder->PrintTraceEvent(&js, &filter);
StartStreamToConsumer(consumer, user_data, "timeline");
- bool success = StreamTraceEvents(consumer, user_data, &js, false);
+ bool success = StreamTraceEvents(consumer, user_data, &js);
FinishStreamToConsumer(consumer, user_data, "timeline");
return success;
}
@@ -5989,17 +5983,12 @@ DART_EXPORT bool Dart_GlobalTimelineGetTrace(Dart_StreamConsumer consumer,
return false;
}
Timeline::ReclaimCachedBlocksFromThreads();
+ bool success = false;
JSONStream js;
TimelineEventFilter filter;
timeline_recorder->PrintTraceEvent(&js, &filter);
StartStreamToConsumer(consumer, user_data, "timeline");
- bool success = false;
- if (Timeline::get_get_timeline_cb() != NULL) {
- if (Timeline::get_get_timeline_cb()(consumer, user_data)) {
- success = true;
- }
- }
- if (StreamTraceEvents(consumer, user_data, &js, success)) {
+ if (StreamTraceEvents(consumer, user_data, &js)) {
success = true;
}
FinishStreamToConsumer(consumer, user_data, "timeline");

Powered by Google App Engine
This is Rietveld 408576698