Chromium Code Reviews| Index: runtime/vm/timeline.cc |
| diff --git a/runtime/vm/timeline.cc b/runtime/vm/timeline.cc |
| index 64c71271d21da9075437233e745fdfb578907b47..76d4729f914ec100343022b0adae14bad41b8b7c 100644 |
| --- a/runtime/vm/timeline.cc |
| +++ b/runtime/vm/timeline.cc |
| @@ -80,12 +80,10 @@ void Timeline::InitOnce() { |
| } else if (use_ring_recorder) { |
| recorder_ = new TimelineEventRingRecorder(); |
| } |
| - vm_stream_ = new TimelineStream(); |
| - vm_stream_->Init("VM", EnableStreamByDefault("VM"), NULL); |
| - vm_api_stream_ = new TimelineStream(); |
| - vm_api_stream_->Init("API", |
| - EnableStreamByDefault("API"), |
| - &stream_API_enabled_); |
| + vm_stream_.Init("VM", EnableStreamByDefault("VM"), NULL); |
| + vm_api_stream_.Init("API", |
| + EnableStreamByDefault("API"), |
| + &stream_API_enabled_); |
| // Global overrides. |
| #define ISOLATE_TIMELINE_STREAM_FLAG_DEFAULT(name, not_used) \ |
| stream_##name##_enabled_ = EnableStreamByDefault(#name); |
| @@ -99,12 +97,15 @@ void Timeline::Shutdown() { |
| if (FLAG_timeline_dir != NULL) { |
| recorder_->WriteTo(FLAG_timeline_dir); |
| } |
| + // Disable global streams. |
| + vm_stream_.set_enabled(false); |
| + vm_api_stream_.set_enabled(false); |
| +#define ISOLATE_TIMELINE_STREAM_DISABLE(name, not_used) \ |
| + stream_##name##_enabled_ = false; |
| + ISOLATE_TIMELINE_STREAM_LIST(ISOLATE_TIMELINE_STREAM_DISABLE) |
| +#undef ISOLATE_TIMELINE_STREAM_DISABLE |
| delete recorder_; |
|
Florian Schneider
2016/01/15 15:48:26
Make sure that the deletion of recorder_ safe here
Cutch
2016/01/15 17:35:49
It can't have a static lifetime because there are
|
| recorder_ = NULL; |
| - delete vm_stream_; |
| - vm_stream_ = NULL; |
| - delete vm_api_stream_; |
| - vm_api_stream_ = NULL; |
| } |
| @@ -120,14 +121,12 @@ bool Timeline::EnableStreamByDefault(const char* stream_name) { |
| TimelineStream* Timeline::GetVMStream() { |
| - ASSERT(vm_stream_ != NULL); |
| - return vm_stream_; |
| + return &vm_stream_; |
| } |
| TimelineStream* Timeline::GetVMApiStream() { |
| - ASSERT(vm_api_stream_ != NULL); |
| - return vm_api_stream_; |
| + return &vm_api_stream_; |
| } |
| @@ -164,8 +163,8 @@ void Timeline::Clear() { |
| TimelineEventRecorder* Timeline::recorder_ = NULL; |
| -TimelineStream* Timeline::vm_stream_ = NULL; |
| -TimelineStream* Timeline::vm_api_stream_ = NULL; |
| +TimelineStream Timeline::vm_stream_; |
| +TimelineStream Timeline::vm_api_stream_; |
| #define ISOLATE_TIMELINE_STREAM_DEFINE_FLAG(name, enabled_by_default) \ |
| bool Timeline::stream_##name##_enabled_ = enabled_by_default; |