| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "base/sys_info.h" | 5 #include "base/sys_info.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 contents.erase(contents.length() - 1); | 36 contents.erase(contents.length() - 1); |
| 37 } | 37 } |
| 38 | 38 |
| 39 uint64 limit; | 39 uint64 limit; |
| 40 if (!base::StringToUint64(contents, &limit)) { | 40 if (!base::StringToUint64(contents, &limit)) { |
| 41 limit = 0; | 41 limit = 0; |
| 42 } | 42 } |
| 43 if (limit > std::numeric_limits<size_t>::max()) { | 43 if (limit > std::numeric_limits<size_t>::max()) { |
| 44 limit = 0; | 44 limit = 0; |
| 45 } | 45 } |
| 46 DCHECK(limit > 0); | 46 DCHECK_GT(limit, 0u); |
| 47 return static_cast<size_t>(limit); | 47 return static_cast<size_t>(limit); |
| 48 } | 48 } |
| 49 | 49 |
| 50 base::LazyInstance< | 50 base::LazyInstance< |
| 51 base::internal::LazySysInfoValue<int64, AmountOfPhysicalMemory> >::Leaky | 51 base::internal::LazySysInfoValue<int64, AmountOfPhysicalMemory> >::Leaky |
| 52 g_lazy_physical_memory = LAZY_INSTANCE_INITIALIZER; | 52 g_lazy_physical_memory = LAZY_INSTANCE_INITIALIZER; |
| 53 base::LazyInstance< | 53 base::LazyInstance< |
| 54 base::internal::LazySysInfoValue<size_t, MaxSharedMemorySize> >::Leaky | 54 base::internal::LazySysInfoValue<size_t, MaxSharedMemorySize> >::Leaky |
| 55 g_lazy_max_shared_memory = LAZY_INSTANCE_INITIALIZER; | 55 g_lazy_max_shared_memory = LAZY_INSTANCE_INITIALIZER; |
| 56 | 56 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 if (line.compare(0, strlen(kCpuModelPrefix), kCpuModelPrefix) == 0) { | 90 if (line.compare(0, strlen(kCpuModelPrefix), kCpuModelPrefix) == 0) { |
| 91 size_t pos = line.find(": "); | 91 size_t pos = line.find(": "); |
| 92 return line.substr(pos + 2); | 92 return line.substr(pos + 2); |
| 93 } | 93 } |
| 94 } | 94 } |
| 95 } | 95 } |
| 96 return std::string(); | 96 return std::string(); |
| 97 } | 97 } |
| 98 | 98 |
| 99 } // namespace base | 99 } // namespace base |
| OLD | NEW |