Skip to content

Commit 7901612

Browse files
parloughCommit Queue
authored andcommitted
[vm] Remove macOS 10.14 and iOS 12 availability checks
macOS 10.14 has been Flutter's minimum for a while, and iOS 12 is the new minimum as of flutter/flutter#140474. Dart has not marked these platforms as supported for an even longer time. Supported platforms reference: https://docs.flutter.dev/reference/supported-platforms TEST=ci Bug: flutter/flutter#140474 Change-Id: I12377975d9c4d57e19d486898f0fcd89a1583f7c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346920 Reviewed-by: Ryan Macnak <[email protected]> Reviewed-by: Slava Egorov <[email protected]> Auto-Submit: Parker Lougheed <[email protected]> Commit-Queue: Slava Egorov <[email protected]>
1 parent f04e42b commit 7901612

File tree

5 files changed

+16
-59
lines changed

5 files changed

+16
-59
lines changed

runtime/bin/security_context_macos.cc

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -287,23 +287,13 @@ static void TrustEvaluateHandler(Dart_Port dest_port_id,
287287
usleep(3000 * 1000 /* 3 s*/);
288288
}
289289

290-
OSStatus status = noErr;
291290
// Perform the certificate verification.
292-
if (__builtin_available(iOS 12.0, macOS 10.14, *)) {
293-
// SecTrustEvaluateWithError available as of OSX 10.14 and iOS 12.
294-
// The result is ignored as we get more information from the following call
295-
// to SecTrustGetTrustResult which also happens to match the information we
296-
// get from calling SecTrustEvaluate.
297-
bool res = SecTrustEvaluateWithError(trust.get(), nullptr);
298-
USE(res);
299-
status = SecTrustGetTrustResult(trust.get(), &trust_result);
300-
} else {
301-
// SecTrustEvaluate is deprecated as of OSX 10.15 and iOS 13.
302-
#pragma clang diagnostic push
303-
#pragma clang diagnostic ignored "-Wdeprecated"
304-
status = SecTrustEvaluate(trust.get(), &trust_result);
305-
#pragma clang diagnostic pop
306-
}
291+
// The result is ignored as we get more information from the following call
292+
// to SecTrustGetTrustResult which also happens to match the information we
293+
// got from calling SecTrustEvaluate before macOS 10.14.
294+
bool res = SecTrustEvaluateWithError(trust.get(), nullptr);
295+
USE(res);
296+
OSStatus status = SecTrustGetTrustResult(trust.get(), &trust_result);
307297

308298
postReply(reply_port_id,
309299
status == noErr && (trust_result == kSecTrustResultProceed ||

runtime/vm/os_macos.cc

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -95,25 +95,8 @@ int64_t OS::GetCurrentMonotonicMicros() {
9595
}
9696

9797
int64_t OS::GetCurrentThreadCPUMicros() {
98-
if (__builtin_available(macOS 10.12, iOS 10.0, *)) {
99-
// This is more efficient when available.
100-
return clock_gettime_nsec_np(CLOCK_THREAD_CPUTIME_ID) /
101-
kNanosecondsPerMicrosecond;
102-
}
103-
104-
mach_msg_type_number_t count = THREAD_BASIC_INFO_COUNT;
105-
thread_basic_info_data_t info_data;
106-
thread_basic_info_t info = &info_data;
107-
mach_port_t thread_port = pthread_mach_thread_np(pthread_self());
108-
kern_return_t r =
109-
thread_info(thread_port, THREAD_BASIC_INFO, (thread_info_t)info, &count);
110-
ASSERT(r == KERN_SUCCESS);
111-
int64_t thread_cpu_micros =
112-
(info->system_time.seconds + info->user_time.seconds);
113-
thread_cpu_micros *= kMicrosecondsPerSecond;
114-
thread_cpu_micros += info->user_time.microseconds;
115-
thread_cpu_micros += info->system_time.microseconds;
116-
return thread_cpu_micros;
98+
return clock_gettime_nsec_np(CLOCK_THREAD_CPUTIME_ID) /
99+
kNanosecondsPerMicrosecond;
117100
}
118101

119102
int64_t OS::GetCurrentMonotonicMicrosForTimeline() {

runtime/vm/timeline.cc

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,7 @@ static TimelineEventRecorder* CreateTimelineRecorder() {
167167
#if defined(DART_HOST_OS_LINUX) || defined(DART_HOST_OS_ANDROID)
168168
return new TimelineEventSystraceRecorder();
169169
#elif defined(DART_HOST_OS_MACOS)
170-
if (__builtin_available(iOS 12.0, macOS 10.14, *)) {
171-
return new TimelineEventMacosRecorder();
172-
}
170+
return new TimelineEventMacosRecorder();
173171
#elif defined(DART_HOST_OS_FUCHSIA)
174172
return new TimelineEventFuchsiaRecorder();
175173
#else
@@ -1076,10 +1074,8 @@ TimelineStream::TimelineStream(const char* name,
10761074
#endif
10771075
{
10781076
#if defined(DART_HOST_OS_MACOS)
1079-
if (__builtin_available(iOS 12.0, macOS 10.14, *)) {
1080-
macos_log_ = os_log_create("Dart", name);
1081-
has_static_labels_ = has_static_labels;
1082-
}
1077+
macos_log_ = os_log_create("Dart", name);
1078+
has_static_labels_ = has_static_labels;
10831079
#endif
10841080
}
10851081

runtime/vm/timeline.h

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,8 @@
3030
#include <lib/trace-engine/context.h>
3131
#include <lib/trace-engine/instrumentation.h>
3232
#elif defined(DART_HOST_OS_MACOS)
33-
#include <os/availability.h>
34-
#if defined(__MAC_10_14) || defined (__IPHONE_12_0)
35-
#define DART_HOST_OS_SUPPORTS_SIGNPOST 1
36-
#endif
37-
// signpost.h exists in macOS 10.14, iOS 12 or above
38-
#if defined(DART_HOST_OS_SUPPORTS_SIGNPOST)
3933
#include <os/signpost.h>
40-
#else
41-
#include <os/log.h>
42-
#endif
43-
#endif
34+
#endif // defined(FUCHSIA_SDK) || defined(DART_HOST_OS_FUCHSIA)
4435

4536
namespace dart {
4637

@@ -1248,18 +1239,18 @@ class TimelineEventSystraceRecorder : public TimelineEventPlatformRecorder {
12481239
#endif // defined(DART_HOST_OS_ANDROID) || defined(DART_HOST_OS_LINUX)
12491240

12501241
#if defined(DART_HOST_OS_MACOS)
1251-
// A recorder that sends events to Macos's tracing app. See:
1242+
// A recorder that sends events to macOS's tracing app. See:
12521243
// https://developer.apple.com/documentation/os/logging?language=objc
12531244
class TimelineEventMacosRecorder : public TimelineEventPlatformRecorder {
12541245
public:
1255-
TimelineEventMacosRecorder() API_AVAILABLE(ios(12.0), macos(10.14));
1256-
virtual ~TimelineEventMacosRecorder() API_AVAILABLE(ios(12.0), macos(10.14));
1246+
TimelineEventMacosRecorder();
1247+
virtual ~TimelineEventMacosRecorder();
12571248

12581249
const char* name() const { return MACOS_RECORDER_NAME; }
12591250
intptr_t Size() { return 0; }
12601251

12611252
private:
1262-
void OnEvent(TimelineEvent* event) API_AVAILABLE(ios(12.0), macos(10.14));
1253+
void OnEvent(TimelineEvent* event);
12631254
};
12641255
#endif // defined(DART_HOST_OS_MACOS)
12651256

runtime/vm/timeline_macos.cc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
namespace dart {
1212

13-
// Only available on iOS 12.0, macOS 10.14 or above
1413
TimelineEventMacosRecorder::TimelineEventMacosRecorder()
1514
: TimelineEventPlatformRecorder() {
1615
Timeline::set_recorder_discards_clock_values(true);
@@ -23,7 +22,6 @@ void TimelineEventMacosRecorder::OnEvent(TimelineEvent* event) {
2322
return;
2423
}
2524

26-
#if defined(DART_HOST_OS_SUPPORTS_SIGNPOST)
2725
os_log_t log = event->stream_->macos_log();
2826
if (!os_signpost_enabled(log)) {
2927
return;
@@ -72,7 +70,6 @@ void TimelineEventMacosRecorder::OnEvent(TimelineEvent* event) {
7270
default:
7371
break;
7472
}
75-
#endif // defined(DART_HOST_OS_SUPPORTS_SIGNPOST)
7673
}
7774

7875
} // namespace dart

0 commit comments

Comments
 (0)