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

Side by Side Diff: base/sys_info_linux.cc

Issue 10113009: Set Android/V8 memory limits from dalvik.vm.heapsize. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add comment about highUsageDeltaMB. Created 8 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/sys_info.h ('k') | webkit/glue/webkitplatformsupport_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/file_util.h" 9 #include "base/file_util.h"
10 #include "base/lazy_instance.h"
10 #include "base/logging.h" 11 #include "base/logging.h"
11 #include "base/string_number_conversions.h" 12 #include "base/string_number_conversions.h"
13 #if defined(OS_ANDROID)
14 #include "base/android/dalvik_heap_size.h"
15 #endif
12 16
13 namespace base { 17 namespace base {
14 18
19 #if defined(OS_ANDROID)
20 static base::LazyInstance<android::DalvikHeapSize> g_dalvik_heap_size =
darin (slow to review) 2012/05/16 23:55:03 nit: shouldn't this be in a sys_info_android.cc fi
ulan 2012/05/18 10:24:06 Done. I am not sure if __system_property_get is t
21 LAZY_INSTANCE_INITIALIZER;
22
23 int SysInfo::DalvikHeapSizeMB() {
24 return g_dalvik_heap_size.Get().HeapSizeMB();
25 }
26 #endif
27
15 int64 SysInfo::AmountOfPhysicalMemory() { 28 int64 SysInfo::AmountOfPhysicalMemory() {
16 long pages = sysconf(_SC_PHYS_PAGES); 29 long pages = sysconf(_SC_PHYS_PAGES);
17 long page_size = sysconf(_SC_PAGE_SIZE); 30 long page_size = sysconf(_SC_PAGE_SIZE);
18 if (pages == -1 || page_size == -1) { 31 if (pages == -1 || page_size == -1) {
19 NOTREACHED(); 32 NOTREACHED();
20 return 0; 33 return 0;
21 } 34 }
22 35
23 return static_cast<int64>(pages) * page_size; 36 return static_cast<int64>(pages) * page_size;
24 } 37 }
(...skipping 15 matching lines...) Expand all
40 limit_valid = true; 53 limit_valid = true;
41 } else { 54 } else {
42 NOTREACHED(); 55 NOTREACHED();
43 return 0; 56 return 0;
44 } 57 }
45 } 58 }
46 return static_cast<size_t>(limit); 59 return static_cast<size_t>(limit);
47 } 60 }
48 61
49 } // namespace base 62 } // namespace base
OLDNEW
« no previous file with comments | « base/sys_info.h ('k') | webkit/glue/webkitplatformsupport_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698