| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium 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 BASE_SYS_INFO_INTERNAL_H_ | 5 #ifndef BASE_SYS_INFO_INTERNAL_H_ |
| 6 #define BASE_SYS_INFO_INTERNAL_H_ | 6 #define BASE_SYS_INFO_INTERNAL_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | |
| 9 | |
| 10 namespace base { | 8 namespace base { |
| 11 | 9 |
| 12 namespace internal { | 10 namespace internal { |
| 13 | 11 |
| 14 template<typename T, T (*F)(void)> | 12 template<typename T, T (*F)(void)> |
| 15 class LazySysInfoValue { | 13 class LazySysInfoValue { |
| 16 public: | 14 public: |
| 17 LazySysInfoValue() | 15 LazySysInfoValue() |
| 18 : value_(F()) { } | 16 : value_(F()) { } |
| 19 | 17 |
| 20 ~LazySysInfoValue() { } | 18 ~LazySysInfoValue() { } |
| 21 | 19 |
| 22 T value() { return value_; } | 20 T value() { return value_; } |
| 23 | 21 |
| 24 private: | 22 private: |
| 25 const T value_; | 23 const T value_; |
| 26 | 24 |
| 27 DISALLOW_COPY_AND_ASSIGN(LazySysInfoValue); | 25 DISALLOW_COPY_AND_ASSIGN(LazySysInfoValue); |
| 28 }; | 26 }; |
| 29 | 27 |
| 30 } // namespace internal | 28 } // namespace internal |
| 31 | 29 |
| 32 } // namespace base | 30 } // namespace base |
| 33 | 31 |
| 34 #endif // BASE_SYS_INFO_INTERNAL_H_ | 32 #endif // BASE_SYS_INFO_INTERNAL_H_ |
| OLD | NEW |