Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(481)

Unified Diff: runtime/vm/os_macos.cc

Issue 2974233002: VM: Re-format to use at most one newline between functions (Closed)
Patch Set: Rebase and merge Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/os_linux.cc ('k') | runtime/vm/os_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/os_macos.cc
diff --git a/runtime/vm/os_macos.cc b/runtime/vm/os_macos.cc
index a358609af2872cc073903ccdd199edc457835456..25e36162a16f0fee22c9757868d8d5d26345791c 100644
--- a/runtime/vm/os_macos.cc
+++ b/runtime/vm/os_macos.cc
@@ -9,11 +9,11 @@
#include <errno.h> // NOLINT
#include <limits.h> // NOLINT
-#include <mach/mach.h> // NOLINT
#include <mach/clock.h> // NOLINT
+#include <mach/mach.h> // NOLINT
#include <mach/mach_time.h> // NOLINT
-#include <sys/time.h> // NOLINT
#include <sys/resource.h> // NOLINT
+#include <sys/time.h> // NOLINT
#include <unistd.h> // NOLINT
#if HOST_OS_IOS
#include <sys/sysctl.h> // NOLINT
@@ -34,12 +34,10 @@ const char* OS::Name() {
#endif
}
-
intptr_t OS::ProcessId() {
return static_cast<intptr_t>(getpid());
}
-
static bool LocalTime(int64_t seconds_since_epoch, tm* tm_result) {
time_t seconds = static_cast<time_t>(seconds_since_epoch);
if (seconds != seconds_since_epoch) return false;
@@ -47,7 +45,6 @@ static bool LocalTime(int64_t seconds_since_epoch, tm* tm_result) {
return error_code != NULL;
}
-
const char* OS::GetTimeZoneName(int64_t seconds_since_epoch) {
tm decomposed;
bool succeeded = LocalTime(seconds_since_epoch, &decomposed);
@@ -55,7 +52,6 @@ const char* OS::GetTimeZoneName(int64_t seconds_since_epoch) {
return (succeeded && (decomposed.tm_zone != NULL)) ? decomposed.tm_zone : "";
}
-
int OS::GetTimeZoneOffsetInSeconds(int64_t seconds_since_epoch) {
tm decomposed;
bool succeeded = LocalTime(seconds_since_epoch, &decomposed);
@@ -64,7 +60,6 @@ int OS::GetTimeZoneOffsetInSeconds(int64_t seconds_since_epoch) {
return succeeded ? static_cast<int>(decomposed.tm_gmtoff) : 0;
}
-
int OS::GetLocalTimeZoneAdjustmentInSeconds() {
// TODO(floitsch): avoid excessive calls to tzset?
tzset();
@@ -73,12 +68,10 @@ int OS::GetLocalTimeZoneAdjustmentInSeconds() {
return static_cast<int>(-timezone);
}
-
int64_t OS::GetCurrentTimeMillis() {
return GetCurrentTimeMicros() / 1000;
}
-
int64_t OS::GetCurrentTimeMicros() {
// gettimeofday has microsecond resolution.
struct timeval tv;
@@ -89,12 +82,10 @@ int64_t OS::GetCurrentTimeMicros() {
return (static_cast<int64_t>(tv.tv_sec) * 1000000) + tv.tv_usec;
}
-
#if !HOST_OS_IOS
static mach_timebase_info_data_t timebase_info;
#endif
-
int64_t OS::GetCurrentMonotonicTicks() {
#if HOST_OS_IOS
// On iOS mach_absolute_time stops while the device is sleeping. Instead use
@@ -124,7 +115,6 @@ int64_t OS::GetCurrentMonotonicTicks() {
#endif // HOST_OS_IOS
}
-
int64_t OS::GetCurrentMonotonicFrequency() {
#if HOST_OS_IOS
return kMicrosecondsPerSecond;
@@ -133,7 +123,6 @@ int64_t OS::GetCurrentMonotonicFrequency() {
#endif // HOST_OS_IOS
}
-
int64_t OS::GetCurrentMonotonicMicros() {
#if HOST_OS_IOS
ASSERT(GetCurrentMonotonicFrequency() == kMicrosecondsPerSecond);
@@ -144,7 +133,6 @@ int64_t OS::GetCurrentMonotonicMicros() {
#endif // HOST_OS_IOS
}
-
int64_t OS::GetCurrentThreadCPUMicros() {
mach_msg_type_number_t count = THREAD_BASIC_INFO_COUNT;
thread_basic_info_data_t info_data;
@@ -165,7 +153,6 @@ int64_t OS::GetCurrentThreadCPUMicros() {
return thread_cpu_micros;
}
-
intptr_t OS::ActivationFrameAlignment() {
#if HOST_OS_IOS
#if TARGET_ARCH_ARM
@@ -190,7 +177,6 @@ intptr_t OS::ActivationFrameAlignment() {
#endif // HOST_OS_IOS
}
-
intptr_t OS::PreferredCodeAlignment() {
#if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) || \
defined(TARGET_ARCH_ARM64) || defined(TARGET_ARCH_DBC)
@@ -210,12 +196,10 @@ intptr_t OS::PreferredCodeAlignment() {
return alignment;
}
-
int OS::NumberOfAvailableProcessors() {
return sysconf(_SC_NPROCESSORS_ONLN);
}
-
uintptr_t OS::MaxRSS() {
struct rusage usage;
usage.ru_maxrss = 0;
@@ -224,13 +208,11 @@ uintptr_t OS::MaxRSS() {
return usage.ru_maxrss;
}
-
void OS::Sleep(int64_t millis) {
int64_t micros = millis * kMicrosecondsPerMillisecond;
SleepMicros(micros);
}
-
void OS::SleepMicros(int64_t micros) {
struct timespec req; // requested.
struct timespec rem; // remainder.
@@ -255,18 +237,15 @@ void OS::SleepMicros(int64_t micros) {
}
}
-
void OS::DebugBreak() {
__builtin_trap();
}
-
uintptr_t DART_NOINLINE OS::GetProgramCounter() {
return reinterpret_cast<uintptr_t>(
__builtin_extract_return_addr(__builtin_return_address(0)));
}
-
char* OS::StrNDup(const char* s, intptr_t n) {
// strndup has only been added to Mac OS X in 10.7. We are supplying
// our own copy here if needed.
@@ -290,7 +269,6 @@ char* OS::StrNDup(const char* s, intptr_t n) {
#endif // !defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) || ...
}
-
intptr_t OS::StrNLen(const char* s, intptr_t n) {
// strnlen has only been added to Mac OS X in 10.7. We are supplying
// our own copy here if needed.
@@ -307,7 +285,6 @@ intptr_t OS::StrNLen(const char* s, intptr_t n) {
#endif // !defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) || ...
}
-
void OS::Print(const char* format, ...) {
#if HOST_OS_IOS
va_list args;
@@ -322,13 +299,11 @@ void OS::Print(const char* format, ...) {
#endif
}
-
void OS::VFPrint(FILE* stream, const char* format, va_list args) {
vfprintf(stream, format, args);
fflush(stream);
}
-
int OS::SNPrint(char* str, size_t size, const char* format, ...) {
va_list args;
va_start(args, format);
@@ -337,7 +312,6 @@ int OS::SNPrint(char* str, size_t size, const char* format, ...) {
return retval;
}
-
int OS::VSNPrint(char* str, size_t size, const char* format, va_list args) {
int retval = vsnprintf(str, size, format, args);
if (retval < 0) {
@@ -346,7 +320,6 @@ int OS::VSNPrint(char* str, size_t size, const char* format, va_list args) {
return retval;
}
-
char* OS::SCreate(Zone* zone, const char* format, ...) {
va_list args;
va_start(args, format);
@@ -355,7 +328,6 @@ char* OS::SCreate(Zone* zone, const char* format, ...) {
return buffer;
}
-
char* OS::VSCreate(Zone* zone, const char* format, va_list args) {
// Measure.
va_list measure_args;
@@ -379,7 +351,6 @@ char* OS::VSCreate(Zone* zone, const char* format, va_list args) {
return buffer;
}
-
bool OS::StringToInt64(const char* str, int64_t* value) {
ASSERT(str != NULL && strlen(str) > 0 && value != NULL);
int32_t base = 10;
@@ -397,10 +368,8 @@ bool OS::StringToInt64(const char* str, int64_t* value) {
return ((errno == 0) && (endptr != str) && (*endptr == 0));
}
-
void OS::RegisterCodeObservers() {}
-
void OS::PrintErr(const char* format, ...) {
#if HOST_OS_IOS
va_list args;
@@ -415,7 +384,6 @@ void OS::PrintErr(const char* format, ...) {
#endif
}
-
void OS::InitOnce() {
// TODO(5411554): For now we check that initonce is called only once,
// Once there is more formal mechanism to call InitOnce we can move
@@ -440,15 +408,12 @@ void OS::InitOnce() {
}
}
-
void OS::Shutdown() {}
-
void OS::Abort() {
abort();
}
-
void OS::Exit(int code) {
exit(code);
}
« no previous file with comments | « runtime/vm/os_linux.cc ('k') | runtime/vm/os_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698