diff options
author | jochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-20 11:14:51 +0000 |
---|---|---|
committer | jochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-20 11:14:51 +0000 |
commit | c15d1e7756cee2b7febad6ab4e550165238ef514 (patch) | |
tree | 4556fb81d66e675088854bdb00b3d58d845f5e9a /base/sys_info_linux.cc | |
parent | 947e336d09cf625bfe6d14b973aa3411acebe477 (diff) | |
download | chromium_src-c15d1e7756cee2b7febad6ab4e550165238ef514.zip chromium_src-c15d1e7756cee2b7febad6ab4e550165238ef514.tar.gz chromium_src-c15d1e7756cee2b7febad6ab4e550165238ef514.tar.bz2 |
Cache the numberOfProcessors value on posix and expose it to blink
We need to cache the value, so we can request it from blink after
the sandbox was already turned on.
BUG=321060
R=jam@chromium.org,mark@chromium.org,jamesr@chromium.org
Review URL: https://codereview.chromium.org/67373006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@236224 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/sys_info_linux.cc')
-rw-r--r-- | base/sys_info_linux.cc | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/base/sys_info_linux.cc b/base/sys_info_linux.cc index d7c9f10..6f1e5eb 100644 --- a/base/sys_info_linux.cc +++ b/base/sys_info_linux.cc @@ -10,6 +10,7 @@ #include "base/lazy_instance.h" #include "base/logging.h" #include "base/strings/string_number_conversions.h" +#include "base/sys_info_internal.h" namespace { @@ -47,25 +48,11 @@ size_t MaxSharedMemorySize() { return static_cast<size_t>(limit); } -template<typename T, T (*F)(void)> -class LazySysInfoValue { - public: - LazySysInfoValue() - : value_(F()) { } - - ~LazySysInfoValue() { } - - T value() { return value_; } - - private: - const T value_; - - DISALLOW_COPY_AND_ASSIGN(LazySysInfoValue); -}; - -base::LazyInstance<LazySysInfoValue<int64, AmountOfPhysicalMemory> >::Leaky +base::LazyInstance< + base::internal::LazySysInfoValue<int64, AmountOfPhysicalMemory> >::Leaky g_lazy_physical_memory = LAZY_INSTANCE_INITIALIZER; -base::LazyInstance<LazySysInfoValue<size_t, MaxSharedMemorySize> >::Leaky +base::LazyInstance< + base::internal::LazySysInfoValue<size_t, MaxSharedMemorySize> >::Leaky g_lazy_max_shared_memory = LAZY_INSTANCE_INITIALIZER; } // namespace |