Limit dependencies in time.{cc,h} and time_win.cc We remove the definition of LiveTicks::Now from time.cc. This removes a dependency on mincore.lib through time_win.cc. We remove the definition of ThreadTicks::Now from time.cc. This removes a dependency on platform_thread.h through time_win.cc. We also remove specific functions from time.{cc,h} to avoid the need to compile time_exploded_posix.cc. This removes a dependency on icu. --- base/time/time.cc | 12 ++++++++++++ base/time/time.h | 2 ++ base/time/time_win.cc | 4 ++++ 3 files changed, 18 insertions(+) diff --git a/base/time/time.cc b/base/time/time.cc index 723ece8a838b..b275bde2ae12 100644 --- a/base/time/time.cc +++ b/base/time/time.cc @@ -22,11 +22,13 @@ namespace base { namespace { +#if !defined(MOZ_ZUCCHINI) const char kWeekdayName[7][4] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; const char kMonthName[12][4] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; +#endif // !defined(MOZ_ZUCCHINI) TimeTicks g_shared_time_ticks_at_unix_epoch; @@ -43,11 +45,13 @@ std::atomic g_time_now_from_system_time_function{ std::atomic g_time_ticks_now_function{ &subtle::TimeTicksNowIgnoringOverride}; +#if !defined(MOZ_ZUCCHINI) std::atomic g_live_ticks_now_function{ &subtle::LiveTicksNowIgnoringOverride}; std::atomic g_thread_ticks_now_function{ &subtle::ThreadTicksNowIgnoringOverride}; +#endif // !defined(MOZ_ZUCCHINI) } // namespace internal @@ -102,6 +106,7 @@ Time Time::NowFromSystemTime() { std::memory_order_relaxed)(); } +#if !defined(MOZ_ZUCCHINI) Time Time::Midnight(bool is_local) const { Exploded exploded; Explode(is_local, &exploded); @@ -131,6 +136,7 @@ Time Time::Midnight(bool is_local) const { #endif return out_time; } +#endif // !defined(MOZ_ZUCCHINI) // static bool Time::FromStringInternal(const char* time_string, @@ -190,6 +196,7 @@ int64_t Time::ToRoundedDownMillisecondsSinceUnixEpoch() const { return millis - kEpochOffsetMillis - (submillis < 0); } +#if !defined(MOZ_ZUCCHINI) std::ostream& operator<<(std::ostream& os, Time time) { Time::Exploded exploded; time.UTCExplode(&exploded); @@ -203,6 +210,7 @@ std::ostream& operator<<(std::ostream& os, Time time) { exploded.second, exploded.millisecond); } +#endif // !defined(MOZ_ZUCCHINI) // TimeTicks ------------------------------------------------------------------ @@ -263,6 +271,7 @@ std::ostream& operator<<(std::ostream& os, TimeTicks time_ticks) { return os << as_time_delta.InMicroseconds() << " bogo-microseconds"; } +#if !defined(MOZ_ZUCCHINI) // LiveTicks ------------------------------------------------------------------ // static @@ -289,6 +298,7 @@ ThreadTicks ThreadTicks::Now() { return internal::g_thread_ticks_now_function.load( std::memory_order_relaxed)(); } +#endif // !defined(MOZ_ZUCCHINI) std::ostream& operator<<(std::ostream& os, ThreadTicks thread_ticks) { const TimeDelta as_time_delta = thread_ticks - ThreadTicks(); @@ -309,6 +319,7 @@ bool Time::Exploded::HasValidValues() const { // clang-format on } +#if !defined(MOZ_ZUCCHINI) std::string TimeFormatHTTP(base::Time time) { base::Time::Exploded exploded; time.UTCExplode(&exploded); @@ -317,5 +328,6 @@ std::string TimeFormatHTTP(base::Time time) { exploded.day_of_month, kMonthName[exploded.month - 1], exploded.year, exploded.hour, exploded.minute, exploded.second); } +#endif // !defined(MOZ_ZUCCHINI) } // namespace base diff --git a/base/time/time.h b/base/time/time.h index 42d812b3ab52..25dec5d11aa3 100644 --- a/base/time/time.h +++ b/base/time/time.h @@ -785,6 +785,7 @@ class BASE_EXPORT Time : public time_internal::TimeBase