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() : stamp_(0), tz_cache_(base::OS::CreateTimezoneCache()) { | 42 DateCache(); |
43 ResetDateCache(); | |
44 } | |
45 | 43 |
46 virtual ~DateCache() { | 44 virtual ~DateCache() { |
47 delete tz_cache_; | 45 delete tz_cache_; |
48 tz_cache_ = NULL; | 46 tz_cache_ = NULL; |
49 } | 47 } |
50 | 48 |
51 | 49 |
52 // Clears cached timezone information and increments the cache stamp. | 50 // Clears cached timezone information and increments the cache stamp. |
53 void ResetDateCache(); | 51 void ResetDateCache(); |
54 | 52 |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 const char* tz_name_; | 283 const char* tz_name_; |
286 const char* dst_tz_name_; | 284 const char* dst_tz_name_; |
287 | 285 |
288 base::TimezoneCache* tz_cache_; | 286 base::TimezoneCache* tz_cache_; |
289 }; | 287 }; |
290 | 288 |
291 } // namespace internal | 289 } // namespace internal |
292 } // namespace v8 | 290 } // namespace v8 |
293 | 291 |
294 #endif | 292 #endif |
OLD | NEW |