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

Side by Side Diff: src/i18n.h

Issue 2724373002: [date] Add ICU backend for timezone info behind a flag (Closed)
Patch Set: or {} Created 3 years, 8 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 unified diff | Download patch
« no previous file with comments | « src/flag-definitions.h ('k') | src/i18n.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 const UChar* GetUCharBufferFromFlat(const String::FlatContent& flat, 133 const UChar* GetUCharBufferFromFlat(const String::FlatContent& flat,
132 std::unique_ptr<uc16[]>* dest, 134 std::unique_ptr<uc16[]>* dest,
133 int32_t length); 135 int32_t length);
134 MUST_USE_RESULT Object* LocaleConvertCase(Handle<String> s, Isolate* isolate, 136 MUST_USE_RESULT Object* LocaleConvertCase(Handle<String> s, Isolate* isolate,
135 bool is_to_upper, const char* lang); 137 bool is_to_upper, const char* lang);
136 MUST_USE_RESULT Object* ConvertToLower(Handle<String> s, Isolate* isolate); 138 MUST_USE_RESULT Object* ConvertToLower(Handle<String> s, Isolate* isolate);
137 MUST_USE_RESULT Object* ConvertToUpper(Handle<String> s, Isolate* isolate); 139 MUST_USE_RESULT Object* ConvertToUpper(Handle<String> s, Isolate* isolate);
138 MUST_USE_RESULT Object* ConvertCase(Handle<String> s, bool is_upper, 140 MUST_USE_RESULT Object* ConvertCase(Handle<String> s, bool is_upper,
139 Isolate* isolate); 141 Isolate* isolate);
140 142
143 // ICUTimezoneCache calls out to ICU for TimezoneCache
144 // functionality in a straightforward way.
145 class ICUTimezoneCache : public base::TimezoneCache {
146 public:
147 ICUTimezoneCache();
148
149 ~ICUTimezoneCache() override;
150
151 const char* LocalTimezone(double time_ms) override;
152
153 double DaylightSavingsOffset(double time_ms) override;
154
155 double LocalTimeOffset() override;
156
157 void Clear() override;
158
159 private:
160 icu::TimeZone* GetTimeZone();
161
162 bool GetOffsets(double time_ms, int32_t* raw_offset, int32_t* dst_offset);
163
164 icu::TimeZone* timezone_;
165
166 static const int32_t kMaxTimezoneChars = 100;
167 char timezone_name_[kMaxTimezoneChars];
168 char dst_timezone_name_[kMaxTimezoneChars];
169 };
170
141 } // namespace internal 171 } // namespace internal
142 } // namespace v8 172 } // namespace v8
143 173
144 #endif // V8_I18N_H_ 174 #endif // V8_I18N_H_
OLDNEW
« no previous file with comments | « src/flag-definitions.h ('k') | src/i18n.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698