OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // limitations under the License. | 4 // limitations under the License. |
5 | 5 |
6 #ifndef V8_I18N_H_ | 6 #ifndef V8_I18N_H_ |
7 #define V8_I18N_H_ | 7 #define V8_I18N_H_ |
8 | 8 |
| 9 #include "src/base/timezone-cache.h" |
9 #include "src/objects.h" | 10 #include "src/objects.h" |
10 #include "unicode/uversion.h" | 11 #include "unicode/uversion.h" |
11 | 12 |
12 namespace U_ICU_NAMESPACE { | 13 namespace U_ICU_NAMESPACE { |
13 class BreakIterator; | 14 class BreakIterator; |
14 class Collator; | 15 class Collator; |
15 class DecimalFormat; | 16 class DecimalFormat; |
16 class SimpleDateFormat; | 17 class SimpleDateFormat; |
| 18 class TimeZone; |
17 } | 19 } |
18 | 20 |
19 namespace v8 { | 21 namespace v8 { |
20 namespace internal { | 22 namespace internal { |
21 | 23 |
22 template <typename T> | 24 template <typename T> |
23 class Handle; | 25 class Handle; |
24 | 26 |
25 class DateFormat { | 27 class DateFormat { |
26 public: | 28 public: |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 | 123 |
122 // Layout description. | 124 // Layout description. |
123 static const int kBreakIterator = JSObject::kHeaderSize; | 125 static const int kBreakIterator = JSObject::kHeaderSize; |
124 static const int kUnicodeString = kBreakIterator + kPointerSize; | 126 static const int kUnicodeString = kBreakIterator + kPointerSize; |
125 static const int kSize = kUnicodeString + kPointerSize; | 127 static const int kSize = kUnicodeString + kPointerSize; |
126 | 128 |
127 private: | 129 private: |
128 V8BreakIterator(); | 130 V8BreakIterator(); |
129 }; | 131 }; |
130 | 132 |
| 133 // ICUTimezoneCache calls out to ICU for TimezoneCache |
| 134 // functionality in a straightforward way. |
| 135 class ICUTimezoneCache : public base::TimezoneCache { |
| 136 public: |
| 137 ICUTimezoneCache(); |
| 138 |
| 139 ~ICUTimezoneCache() override; |
| 140 |
| 141 const char* LocalTimezone(double time_ms) override; |
| 142 |
| 143 double DaylightSavingsOffset(double time_ms) override; |
| 144 |
| 145 double LocalTimeOffset() override; |
| 146 |
| 147 void Clear() override; |
| 148 |
| 149 private: |
| 150 icu::TimeZone* GetTimeZone(); |
| 151 |
| 152 bool GetOffsets(double time_ms, int32_t* raw_offset, int32_t* dst_offset); |
| 153 |
| 154 icu::TimeZone* timezone_; |
| 155 |
| 156 static const int32_t kMaxTimezoneChars = 100; |
| 157 char timezone_name_[kMaxTimezoneChars]; |
| 158 char dst_timezone_name_[kMaxTimezoneChars]; |
| 159 }; |
| 160 |
131 } // namespace internal | 161 } // namespace internal |
132 } // namespace v8 | 162 } // namespace v8 |
133 | 163 |
134 #endif // V8_I18N_H_ | 164 #endif // V8_I18N_H_ |
OLD | NEW |