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

Unified Diff: base/sys_info_linux.cc

Issue 1000933002: sys_info_linux: positive return value of MaxSharedMemorySize for 32-bit build on 64-bit host. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed useless file. Created 5 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 | « base/sys_info_freebsd.cc ('k') | base/sys_info_openbsd.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/sys_info_linux.cc
diff --git a/base/sys_info_linux.cc b/base/sys_info_linux.cc
index c698f911db516fdb3a178ecb9e1c15ac18e0ce35..1bbfe9c604e0f422efe4e990e8fab8d69f2df84b 100644
--- a/base/sys_info_linux.cc
+++ b/base/sys_info_linux.cc
@@ -9,6 +9,7 @@
#include "base/files/file_util.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
+#include "base/numerics/safe_conversions.h"
#include "base/strings/string_number_conversions.h"
#include "base/sys_info_internal.h"
@@ -28,7 +29,7 @@ int64 AmountOfPhysicalMemory() {
return AmountOfMemory(_SC_PHYS_PAGES);
}
-size_t MaxSharedMemorySize() {
+uint64 MaxSharedMemorySize() {
std::string contents;
base::ReadFileToString(base::FilePath("/proc/sys/kernel/shmmax"), &contents);
DCHECK(!contents.empty());
@@ -40,18 +41,15 @@ size_t MaxSharedMemorySize() {
if (!base::StringToUint64(contents, &limit)) {
limit = 0;
}
- if (limit > std::numeric_limits<size_t>::max()) {
- limit = 0;
- }
DCHECK_GT(limit, 0u);
- return static_cast<size_t>(limit);
+ return limit;
}
base::LazyInstance<
base::internal::LazySysInfoValue<int64, AmountOfPhysicalMemory> >::Leaky
g_lazy_physical_memory = LAZY_INSTANCE_INITIALIZER;
base::LazyInstance<
- base::internal::LazySysInfoValue<size_t, MaxSharedMemorySize> >::Leaky
+ base::internal::LazySysInfoValue<uint64, MaxSharedMemorySize> >::Leaky
g_lazy_max_shared_memory = LAZY_INSTANCE_INITIALIZER;
} // namespace
@@ -69,7 +67,7 @@ int64 SysInfo::AmountOfPhysicalMemory() {
}
// static
-size_t SysInfo::MaxSharedMemorySize() {
+uint64 SysInfo::MaxSharedMemorySize() {
return g_lazy_max_shared_memory.Get().value();
}
« no previous file with comments | « base/sys_info_freebsd.cc ('k') | base/sys_info_openbsd.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698