| Index: src/i18n.h
|
| diff --git a/src/i18n.h b/src/i18n.h
|
| index f89d005b00c844309d925768f231c0bde94ca514..69a612120ce088f3ee60331b3b028e0f67bd2828 100644
|
| --- a/src/i18n.h
|
| +++ b/src/i18n.h
|
| @@ -6,6 +6,7 @@
|
| #ifndef V8_I18N_H_
|
| #define V8_I18N_H_
|
|
|
| +#include "src/base/timezone-cache.h"
|
| #include "src/objects.h"
|
| #include "unicode/uversion.h"
|
|
|
| @@ -14,6 +15,7 @@ class BreakIterator;
|
| class Collator;
|
| class DecimalFormat;
|
| class SimpleDateFormat;
|
| +class TimeZone;
|
| }
|
|
|
| namespace v8 {
|
| @@ -128,6 +130,54 @@ class V8BreakIterator {
|
| V8BreakIterator();
|
| };
|
|
|
| +// ICUTimezoneCache calls out to ICU for TimezoneCache
|
| +// functionality in a straightforward way.
|
| +class ICUTimezoneCache : public base::TimezoneCache {
|
| + public:
|
| + ICUTimezoneCache();
|
| +
|
| + ~ICUTimezoneCache() override;
|
| +
|
| + const char* LocalTimezone(double time_ms) override;
|
| +
|
| + double DaylightSavingsOffset(double time_ms) override;
|
| +
|
| + double LocalTimeOffset() override;
|
| +
|
| + void Clear() override;
|
| +
|
| + private:
|
| + icu::TimeZone* GetTimeZone();
|
| +
|
| + bool GetOffsets(double time_ms, int32_t* raw_offset, int32_t* dst_offset);
|
| +
|
| + icu::TimeZone* timezone_;
|
| +
|
| + static const int32_t kMaxTimezoneChars = 20;
|
| + char timezone_name_[kMaxTimezoneChars];
|
| + char dst_timezone_name_[kMaxTimezoneChars];
|
| +};
|
| +
|
| +// ICUOSTimezoneCache defers to the OS TimezoneCache
|
| +// for LocalTimezone if ICU provides a timezone name
|
| +// which starts with GMT. Otherwise, it uses ICU for
|
| +// all operaitons. The issue here is that CLDR declines
|
| +// to specify short names for many time zones, when the
|
| +// OS often does know an appropriate short name.
|
| +class ICUOSTimezoneCache : public ICUTimezoneCache {
|
| + public:
|
| + ICUOSTimezoneCache();
|
| +
|
| + ~ICUOSTimezoneCache() override;
|
| +
|
| + const char* LocalTimezone(double time_ms) override;
|
| +
|
| + void Clear() override;
|
| +
|
| + private:
|
| + TimezoneCache* os_tz_cache_;
|
| +};
|
| +
|
| } // namespace internal
|
| } // namespace v8
|
|
|
|
|