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

Side by Side Diff: runtime/vm/timeline.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 unified diff | Download patch
« runtime/platform/text_buffer.cc ('K') | « runtime/vm/timeline.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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 <cstdlib> 5 #include <cstdlib>
6 6
7 #include "vm/atomic.h" 7 #include "vm/atomic.h"
8 #include "vm/isolate.h" 8 #include "vm/isolate.h"
9 #include "vm/json_stream.h" 9 #include "vm/json_stream.h"
10 #include "vm/lockers.h" 10 #include "vm/lockers.h"
(...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after
1020 #if defined(DEBUG) 1020 #if defined(DEBUG)
1021 Thread* T = Thread::Current(); 1021 Thread* T = Thread::Current();
1022 if (T != NULL) { 1022 if (T != NULL) {
1023 T->DecrementNoSafepointScopeDepth(); 1023 T->DecrementNoSafepointScopeDepth();
1024 } 1024 }
1025 #endif // defined(DEBUG) 1025 #endif // defined(DEBUG)
1026 thread_block_lock->Unlock(); 1026 thread_block_lock->Unlock();
1027 } 1027 }
1028 1028
1029 1029
1030 void TimelineEventRecorder::PrintEmbedderJSONEvents(JSONStream* events) {
1031 if (Timeline::get_get_timeline_cb() != NULL) {
1032 events->PrintCommaIfNeeded();
1033 Timeline::get_get_timeline_cb()(AppendJSONStreamConsumer, events);
1034 }
1035 }
1036
1037
1030 void TimelineEventRecorder::WriteTo(const char* directory) { 1038 void TimelineEventRecorder::WriteTo(const char* directory) {
1031 if (!FLAG_support_service) { 1039 if (!FLAG_support_service) {
1032 return; 1040 return;
1033 } 1041 }
1034 Dart_FileOpenCallback file_open = Isolate::file_open_callback(); 1042 Dart_FileOpenCallback file_open = Isolate::file_open_callback();
1035 Dart_FileWriteCallback file_write = Isolate::file_write_callback(); 1043 Dart_FileWriteCallback file_write = Isolate::file_write_callback();
1036 Dart_FileCloseCallback file_close = Isolate::file_close_callback(); 1044 Dart_FileCloseCallback file_close = Isolate::file_close_callback();
1037 if ((file_open == NULL) || (file_write == NULL) || (file_close == NULL)) { 1045 if ((file_open == NULL) || (file_write == NULL) || (file_close == NULL)) {
1038 return; 1046 return;
1039 } 1047 }
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
1159 TimelineEventFilter* filter) { 1167 TimelineEventFilter* filter) {
1160 if (!FLAG_support_service) { 1168 if (!FLAG_support_service) {
1161 return; 1169 return;
1162 } 1170 }
1163 JSONObject topLevel(js); 1171 JSONObject topLevel(js);
1164 topLevel.AddProperty("type", "_Timeline"); 1172 topLevel.AddProperty("type", "_Timeline");
1165 { 1173 {
1166 JSONArray events(&topLevel, "traceEvents"); 1174 JSONArray events(&topLevel, "traceEvents");
1167 PrintJSONMeta(&events); 1175 PrintJSONMeta(&events);
1168 PrintJSONEvents(&events, filter); 1176 PrintJSONEvents(&events, filter);
1177 PrintEmbedderJSONEvents(js);
1169 } 1178 }
1170 } 1179 }
1171 1180
1172 1181
1173 void TimelineEventRingRecorder::PrintTraceEvent(JSONStream* js, 1182 void TimelineEventRingRecorder::PrintTraceEvent(JSONStream* js,
1174 TimelineEventFilter* filter) { 1183 TimelineEventFilter* filter) {
1175 if (!FLAG_support_service) { 1184 if (!FLAG_support_service) {
1176 return; 1185 return;
1177 } 1186 }
1178 JSONArray events(js); 1187 JSONArray events(js);
1179 PrintJSONEvents(&events, filter); 1188 PrintJSONEvents(&events, filter);
1189 PrintEmbedderJSONEvents(js);
1180 } 1190 }
1181 1191
1182 1192
1183 TimelineEventBlock* TimelineEventRingRecorder::GetHeadBlockLocked() { 1193 TimelineEventBlock* TimelineEventRingRecorder::GetHeadBlockLocked() {
1184 return blocks_[0]; 1194 return blocks_[0];
1185 } 1195 }
1186 1196
1187 1197
1188 TimelineEventBlock* TimelineEventRingRecorder::GetNewBlockLocked() { 1198 TimelineEventBlock* TimelineEventRingRecorder::GetNewBlockLocked() {
1189 // TODO(johnmccutchan): This function should only hand out blocks 1199 // TODO(johnmccutchan): This function should only hand out blocks
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1292 TimelineEventFilter* filter) { 1302 TimelineEventFilter* filter) {
1293 if (!FLAG_support_service) { 1303 if (!FLAG_support_service) {
1294 return; 1304 return;
1295 } 1305 }
1296 JSONObject topLevel(js); 1306 JSONObject topLevel(js);
1297 topLevel.AddProperty("type", "_Timeline"); 1307 topLevel.AddProperty("type", "_Timeline");
1298 { 1308 {
1299 JSONArray events(&topLevel, "traceEvents"); 1309 JSONArray events(&topLevel, "traceEvents");
1300 PrintJSONMeta(&events); 1310 PrintJSONMeta(&events);
1301 PrintJSONEvents(&events, filter); 1311 PrintJSONEvents(&events, filter);
1312 PrintEmbedderJSONEvents(js);
1302 } 1313 }
1303 } 1314 }
1304 1315
1305 1316
1306 void TimelineEventEndlessRecorder::PrintTraceEvent( 1317 void TimelineEventEndlessRecorder::PrintTraceEvent(
1307 JSONStream* js, 1318 JSONStream* js,
1308 TimelineEventFilter* filter) { 1319 TimelineEventFilter* filter) {
1309 if (!FLAG_support_service) { 1320 if (!FLAG_support_service) {
1310 return; 1321 return;
1311 } 1322 }
1312 JSONArray events(js); 1323 JSONArray events(js);
1313 PrintJSONEvents(&events, filter); 1324 PrintJSONEvents(&events, filter);
1325 PrintEmbedderJSONEvents(js);
1314 } 1326 }
1315 1327
1316 1328
1317 TimelineEventBlock* TimelineEventEndlessRecorder::GetHeadBlockLocked() { 1329 TimelineEventBlock* TimelineEventEndlessRecorder::GetHeadBlockLocked() {
1318 return head_; 1330 return head_;
1319 } 1331 }
1320 1332
1321 1333
1322 TimelineEvent* TimelineEventEndlessRecorder::StartEvent() { 1334 TimelineEvent* TimelineEventEndlessRecorder::StartEvent() {
1323 return ThreadBlockStartEvent(); 1335 return ThreadBlockStartEvent();
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
1542 TimelineEventBlock* TimelineEventBlockIterator::Next() { 1554 TimelineEventBlock* TimelineEventBlockIterator::Next() {
1543 ASSERT(current_ != NULL); 1555 ASSERT(current_ != NULL);
1544 TimelineEventBlock* r = current_; 1556 TimelineEventBlock* r = current_;
1545 current_ = current_->next(); 1557 current_ = current_->next();
1546 return r; 1558 return r;
1547 } 1559 }
1548 1560
1549 #endif // !PRODUCT 1561 #endif // !PRODUCT
1550 1562
1551 } // namespace dart 1563 } // namespace dart
OLDNEW
« runtime/platform/text_buffer.cc ('K') | « runtime/vm/timeline.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698