File tree Expand file tree Collapse file tree 3 files changed +10
-17
lines changed Expand file tree Collapse file tree 3 files changed +10
-17
lines changed Original file line number Diff line number Diff line change @@ -117,7 +117,9 @@ static TimelineEventRecorder* CreateTimelineRecorder() {
117117#if defined(HOST_OS_LINUX) || defined(HOST_OS_ANDROID)
118118 return new TimelineEventSystraceRecorder ();
119119#elif defined(HOST_OS_MACOS)
120- return new TimelineEventMacosRecorder ();
120+ if (__builtin_available (iOS 12.0 , macOS 10.14 , *)) {
121+ return new TimelineEventMacosRecorder ();
122+ }
121123#elif defined(HOST_OS_FUCHSIA)
122124 return new TimelineEventFuchsiaRecorder ();
123125#else
@@ -765,8 +767,10 @@ TimelineStream::TimelineStream(const char* name,
765767 enabled_ (static_cast <uintptr_t >(enabled))
766768#endif
767769{
768- #if defined(HOST_OS_SUPPORTS_SIGNPOST)
769- macos_log_ = os_log_create (" Dart" , name);
770+ #if defined(HOST_OS_MACOS)
771+ if (__builtin_available (iOS 12.0 , macOS 10.14 , *)) {
772+ macos_log_ = os_log_create (" Dart" , name);
773+ }
770774#endif
771775}
772776
Original file line number Diff line number Diff line change 2020#include < lib/trace-engine/instrumentation.h>
2121#elif defined(HOST_OS_MACOS)
2222#include < os/availability.h>
23- #if defined(__MAC_10_14) || defined (__IPHONE_12_0)
24- #define HOST_OS_SUPPORTS_SIGNPOST 1
25- #endif
26- // signpost.h exists in macOS 10.14, iOS 12 or above
27- #if defined(HOST_OS_SUPPORTS_SIGNPOST)
2823#include < os/signpost.h>
2924#endif
30- #endif
3125
3226namespace dart {
3327
@@ -100,7 +94,7 @@ class TimelineStream {
10094
10195#if defined(HOST_OS_FUCHSIA)
10296 trace_site_t * trace_site () { return &trace_site_; }
103- #elif defined(HOST_OS_SUPPORTS_SIGNPOST )
97+ #elif defined(HOST_OS_MACOS )
10498 os_log_t macos_log () { return macos_log_; }
10599#endif
106100
@@ -114,7 +108,7 @@ class TimelineStream {
114108
115109#if defined(HOST_OS_FUCHSIA)
116110 trace_site_t trace_site_ = {};
117- #elif defined(HOST_OS_SUPPORTS_SIGNPOST )
111+ #elif defined(HOST_OS_MACOS )
118112 os_log_t macos_log_ = {};
119113#endif
120114};
Original file line number Diff line number Diff line change 55#include " vm/globals.h"
66#if defined(HOST_OS_MACOS) && defined(SUPPORT_TIMELINE)
77
8+ #include < os/signpost.h>
89
910#include " vm/log.h"
1011#include " vm/timeline.h"
1112
12- #if defined(HOST_OS_SUPPORTS_SIGNPOST)
13- #include < os/signpost.h>
14- #endif
15-
1613namespace dart {
1714
1815// Only available on iOS 12.0, macOS 10.14 or above
@@ -26,7 +23,6 @@ void TimelineEventMacosRecorder::OnEvent(TimelineEvent* event) {
2623 return ;
2724 }
2825
29- #if defined(HOST_OS_SUPPORTS_SIGNPOST)
3026 os_log_t log = event->stream_ ->macos_log ();
3127 if (!os_signpost_enabled (log)) {
3228 return ;
@@ -79,7 +75,6 @@ void TimelineEventMacosRecorder::OnEvent(TimelineEvent* event) {
7975 default :
8076 break ;
8177 }
82- #endif // defined(HOST_OS_SUPPORTS_SIGNPOST)
8378}
8479
8580} // namespace dart
You can’t perform that action at this time.
0 commit comments