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

Unified Diff: src/date.h

Issue 2726253002: [date] Add a cache for timezone names to DateCache (Closed)
Patch Set: Rebase Created 3 years, 9 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 | « no previous file | src/date.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/date.h
diff --git a/src/date.h b/src/date.h
index 1a3b65638ce951909429613a1f4fd46345f46a80..5de2b84408634ef7b223ec7af3f3376cf7b73a74 100644
--- a/src/date.h
+++ b/src/date.h
@@ -93,7 +93,12 @@ class DateCache {
if (time_ms < 0 || time_ms > kMaxEpochTimeInMs) {
time_ms = EquivalentTime(time_ms);
}
- return tz_cache_->LocalTimezone(static_cast<double>(time_ms));
+ bool is_dst = DaylightSavingsOffsetInMs(time_ms) != 0;
+ const char** name = is_dst ? &dst_tz_name_ : &tz_name_;
+ if (*name == nullptr) {
+ *name = tz_cache_->LocalTimezone(static_cast<double>(time_ms));
+ }
+ return *name;
}
// ECMA 262 - 15.9.5.26
@@ -276,6 +281,10 @@ class DateCache {
int ymd_month_;
int ymd_day_;
+ // Timezone name cache
+ const char* tz_name_;
+ const char* dst_tz_name_;
+
base::TimezoneCache* tz_cache_;
};
« no previous file with comments | « no previous file | src/date.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698