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

Side by Side Diff: base/sys_info_posix.cc

Issue 243102: Convert base dependencies to use sys_string_conversions instead of the ICU... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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/string_util.h ('k') | base/system_monitor_unittest.cc » ('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) 2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2008 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/file_util.h"
6 #include "base/sys_info.h" 5 #include "base/sys_info.h"
7 #include "base/basictypes.h"
8 6
9 #include <errno.h> 7 #include <errno.h>
10 #include <string.h> 8 #include <string.h>
11 #include <sys/statvfs.h> 9 #include <sys/statvfs.h>
12 #include <sys/utsname.h> 10 #include <sys/utsname.h>
13 #include <unistd.h> 11 #include <unistd.h>
14 12
15 #if defined(OS_MACOSX) 13 #if defined(OS_MACOSX)
16 #include <ApplicationServices/ApplicationServices.h> 14 #include <ApplicationServices/ApplicationServices.h>
17 #include <mach/mach_host.h> 15 #include <mach/mach_host.h>
18 #include <mach/mach_init.h> 16 #include <mach/mach_init.h>
19 #endif 17 #endif
20 18
21 #if defined(OS_OPENBSD) 19 #if defined(OS_OPENBSD)
22 #include <sys/param.h> 20 #include <sys/param.h>
23 #include <sys/sysctl.h> 21 #include <sys/sysctl.h>
24 #endif 22 #endif
25 23
24 #include "base/basictypes.h"
25 #include "base/file_util.h"
26 #include "base/logging.h" 26 #include "base/logging.h"
27 #include "base/string_util.h" 27 #include "base/utf_string_conversions.h"
28 28
29 namespace base { 29 namespace base {
30 30
31 int SysInfo::NumberOfProcessors() { 31 int SysInfo::NumberOfProcessors() {
32 #if defined(OS_OPENBSD) 32 #if defined(OS_OPENBSD)
33 int mib[] = { CTL_HW, HW_NCPU }; 33 int mib[] = { CTL_HW, HW_NCPU };
34 int ncpu; 34 int ncpu;
35 size_t size = sizeof(ncpu); 35 size_t size = sizeof(ncpu);
36 if (sysctl(mib, 2, &ncpu, &size, NULL, 0) == -1) { 36 if (sysctl(mib, 2, &ncpu, &size, NULL, 0) == -1) {
37 NOTREACHED(); 37 NOTREACHED();
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 bool SysInfo::HasEnvVar(const wchar_t* var) { 98 bool SysInfo::HasEnvVar(const wchar_t* var) {
99 std::string var_utf8 = WideToUTF8(std::wstring(var)); 99 std::string var_utf8 = WideToUTF8(std::wstring(var));
100 return getenv(var_utf8.c_str()) != NULL; 100 return getenv(var_utf8.c_str()) != NULL;
101 } 101 }
102 102
103 // static 103 // static
104 std::wstring SysInfo::GetEnvVar(const wchar_t* var) { 104 std::wstring SysInfo::GetEnvVar(const wchar_t* var) {
105 std::string var_utf8 = WideToUTF8(std::wstring(var)); 105 std::string var_utf8 = WideToUTF8(std::wstring(var));
106 char* value = getenv(var_utf8.c_str()); 106 char* value = getenv(var_utf8.c_str());
107 if (!value) { 107 if (!value) {
108 return L""; 108 return std::wstring();
109 } else { 109 } else {
110 return UTF8ToWide(value); 110 return UTF8ToWide(value);
111 } 111 }
112 } 112 }
113 113
114 // static 114 // static
115 std::string SysInfo::OperatingSystemName() { 115 std::string SysInfo::OperatingSystemName() {
116 utsname info; 116 utsname info;
117 if (uname(&info) < 0) { 117 if (uname(&info) < 0) {
118 NOTREACHED(); 118 NOTREACHED();
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 file_util::ReadFileToString(FilePath("/proc/sys/kernel/shmmax"), &contents); 216 file_util::ReadFileToString(FilePath("/proc/sys/kernel/shmmax"), &contents);
217 limit = strtoul(contents.c_str(), NULL, 0); 217 limit = strtoul(contents.c_str(), NULL, 0);
218 limit_valid = true; 218 limit_valid = true;
219 } 219 }
220 220
221 return limit; 221 return limit;
222 } 222 }
223 #endif 223 #endif
224 224
225 } // namespace base 225 } // namespace base
OLDNEW
« no previous file with comments | « base/string_util.h ('k') | base/system_monitor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698