Index: runtime/vm/timeline.cc |
diff --git a/runtime/vm/timeline.cc b/runtime/vm/timeline.cc |
index 2fa59ef6b9f4ead3a48cf1dd0fb58d3220988d24..4072d80689482c2ed031ae7066ad0b80edd1c79e 100644 |
--- a/runtime/vm/timeline.cc |
+++ b/runtime/vm/timeline.cc |
@@ -155,6 +155,22 @@ void Timeline::SetVMStreamEnabled(bool enabled) { |
} |
+void Timeline::StreamStateChange(const char* stream_name, |
+ bool prev, |
+ bool curr) { |
+ if (prev == curr) { |
+ return; |
+ } |
+ if (strcmp(stream_name, "Embedder") == 0) { |
+ if (curr && (Timeline::get_start_recording_cb() != NULL)) { |
+ Timeline::get_start_recording_cb()(); |
+ } else if (!curr && (Timeline::get_stop_recording_cb() != NULL)) { |
+ Timeline::get_stop_recording_cb()(); |
+ } |
+ } |
+} |
+ |
+ |
void Timeline::Shutdown() { |
ASSERT(recorder_ != NULL); |
if (FLAG_timeline_dir != NULL) { |
@@ -273,6 +289,9 @@ TimelineEventRecorder* Timeline::recorder_ = NULL; |
TimelineStream Timeline::vm_stream_; |
TimelineStream Timeline::vm_api_stream_; |
MallocGrowableArray<char*>* Timeline::enabled_streams_ = NULL; |
+Dart_EmbedderTimelineStartRecording Timeline::start_recording_cb_ = NULL; |
+Dart_EmbedderTimelineStopRecording Timeline::stop_recording_cb_ = NULL; |
+Dart_EmbedderTimelineGetTimeline Timeline::get_timeline_cb_ = NULL; |
#define ISOLATE_TIMELINE_STREAM_DEFINE_FLAG(name, enabled_by_default) \ |
bool Timeline::stream_##name##_enabled_ = enabled_by_default; |