"Make Chrome your default browser" should now appear as a checkbox at the bottom...
[chromium-blink-merge.git] / base / sys_info_win.cc
blob2d3c2032c13bc7c5dc59bbf8412364184d4e5cbc
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
3 // found in the LICENSE file.
5 #include "base/sys_info.h"
7 #include <windows.h>
9 #include "base/logging.h"
11 namespace base {
13 // static
14 int SysInfo::NumberOfProcessors() {
15 SYSTEM_INFO info;
16 GetSystemInfo(&info);
17 return static_cast<int>(info.dwNumberOfProcessors);
20 // static
21 int64 SysInfo::AmountOfPhysicalMemory() {
22 MEMORYSTATUSEX memory_info;
23 memory_info.dwLength = sizeof(memory_info);
24 if (!GlobalMemoryStatusEx(&memory_info)) {
25 NOTREACHED();
26 return 0;
29 int64 rv = static_cast<int64>(memory_info.ullTotalPhys);
30 if (rv < 0)
31 rv = kint64max;
32 return rv;
35 // static
36 int64 SysInfo::AmountOfFreeDiskSpace(const std::wstring& path) {
37 ULARGE_INTEGER available, total, free;
38 if (!GetDiskFreeSpaceExW(path.c_str(), &available, &total, &free)) {
39 return -1;
41 int64 rv = static_cast<int64>(available.QuadPart);
42 if (rv < 0)
43 rv = kint64max;
44 return rv;
47 } // namespace base