File tree Expand file tree Collapse file tree 3 files changed +17
-10
lines changed Expand file tree Collapse file tree 3 files changed +17
-10
lines changed Original file line number Diff line number Diff line change @@ -117,9 +117,7 @@ static TimelineEventRecorder* CreateTimelineRecorder() {
117117#if defined(HOST_OS_LINUX) || defined(HOST_OS_ANDROID)
118118 return new TimelineEventSystraceRecorder ();
119119#elif defined(HOST_OS_MACOS)
120- if (__builtin_available (iOS 12.0 , macOS 10.14 , *)) {
121- return new TimelineEventMacosRecorder ();
122- }
120+ return new TimelineEventMacosRecorder ();
123121#elif defined(HOST_OS_FUCHSIA)
124122 return new TimelineEventFuchsiaRecorder ();
125123#else
@@ -767,10 +765,8 @@ TimelineStream::TimelineStream(const char* name,
767765 enabled_ (static_cast <uintptr_t >(enabled))
768766#endif
769767{
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- }
768+ #if defined(HOST_OS_SUPPORTS_SIGNPOST)
769+ macos_log_ = os_log_create (" Dart" , name);
774770#endif
775771}
776772
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)
2328#include < os/signpost.h>
2429#endif
30+ #endif
2531
2632namespace dart {
2733
@@ -94,7 +100,7 @@ class TimelineStream {
94100
95101#if defined(HOST_OS_FUCHSIA)
96102 trace_site_t * trace_site () { return &trace_site_; }
97- #elif defined(HOST_OS_MACOS )
103+ #elif defined(HOST_OS_SUPPORTS_SIGNPOST )
98104 os_log_t macos_log () { return macos_log_; }
99105#endif
100106
@@ -108,7 +114,7 @@ class TimelineStream {
108114
109115#if defined(HOST_OS_FUCHSIA)
110116 trace_site_t trace_site_ = {};
111- #elif defined(HOST_OS_MACOS )
117+ #elif defined(HOST_OS_SUPPORTS_SIGNPOST )
112118 os_log_t macos_log_ = {};
113119#endif
114120};
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>
98
109#include " vm/log.h"
1110#include " vm/timeline.h"
1211
12+ #if defined(HOST_OS_SUPPORTS_SIGNPOST)
13+ #include < os/signpost.h>
14+ #endif
15+
1316namespace dart {
1417
1518// Only available on iOS 12.0, macOS 10.14 or above
@@ -23,6 +26,7 @@ void TimelineEventMacosRecorder::OnEvent(TimelineEvent* event) {
2326 return ;
2427 }
2528
29+ #if defined(HOST_OS_SUPPORTS_SIGNPOST)
2630 os_log_t log = event->stream_ ->macos_log ();
2731 if (!os_signpost_enabled (log)) {
2832 return ;
@@ -75,6 +79,7 @@ void TimelineEventMacosRecorder::OnEvent(TimelineEvent* event) {
7579 default :
7680 break ;
7781 }
82+ #endif // defined(HOST_OS_SUPPORTS_SIGNPOST)
7883}
7984
8085} // namespace dart
You can’t perform that action at this time.
0 commit comments