OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 | 4 |
5 #ifndef V8_DATE_H_ | 5 #ifndef V8_DATE_H_ |
6 #define V8_DATE_H_ | 6 #define V8_DATE_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/base/platform/platform.h" | 9 #include "src/base/platform/platform.h" |
10 #include "src/base/timezone-cache.h" | 10 #include "src/base/timezone-cache.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 // Conservative upper bound on time that can be stored in JSDate | 32 // Conservative upper bound on time that can be stored in JSDate |
33 // before UTC conversion. | 33 // before UTC conversion. |
34 static const int64_t kMaxTimeBeforeUTCInMs = kMaxTimeInMs + kMsPerMonth; | 34 static const int64_t kMaxTimeBeforeUTCInMs = kMaxTimeInMs + kMsPerMonth; |
35 | 35 |
36 // Sentinel that denotes an invalid local offset. | 36 // Sentinel that denotes an invalid local offset. |
37 static const int kInvalidLocalOffsetInMs = kMaxInt; | 37 static const int kInvalidLocalOffsetInMs = kMaxInt; |
38 // Sentinel that denotes an invalid cache stamp. | 38 // Sentinel that denotes an invalid cache stamp. |
39 // It is an invariant of DateCache that cache stamp is non-negative. | 39 // It is an invariant of DateCache that cache stamp is non-negative. |
40 static const int kInvalidStamp = -1; | 40 static const int kInvalidStamp = -1; |
41 | 41 |
42 DateCache(); | 42 DateCache() : stamp_(0), tz_cache_(base::OS::CreateTimezoneCache()) { |
| 43 ResetDateCache(); |
| 44 } |
43 | 45 |
44 virtual ~DateCache() { | 46 virtual ~DateCache() { |
45 delete tz_cache_; | 47 delete tz_cache_; |
46 tz_cache_ = NULL; | 48 tz_cache_ = NULL; |
47 } | 49 } |
48 | 50 |
49 | 51 |
50 // Clears cached timezone information and increments the cache stamp. | 52 // Clears cached timezone information and increments the cache stamp. |
51 void ResetDateCache(); | 53 void ResetDateCache(); |
52 | 54 |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 const char* tz_name_; | 285 const char* tz_name_; |
284 const char* dst_tz_name_; | 286 const char* dst_tz_name_; |
285 | 287 |
286 base::TimezoneCache* tz_cache_; | 288 base::TimezoneCache* tz_cache_; |
287 }; | 289 }; |
288 | 290 |
289 } // namespace internal | 291 } // namespace internal |
290 } // namespace v8 | 292 } // namespace v8 |
291 | 293 |
292 #endif | 294 #endif |
OLD | NEW |