OLD | NEW |
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/sys_info.h" | 5 #include "base/sys_info.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 MEMORYSTATUSEX memory_info; | 22 MEMORYSTATUSEX memory_info; |
23 memory_info.dwLength = sizeof(memory_info); | 23 memory_info.dwLength = sizeof(memory_info); |
24 if (!GlobalMemoryStatusEx(&memory_info)) { | 24 if (!GlobalMemoryStatusEx(&memory_info)) { |
25 NOTREACHED(); | 25 NOTREACHED(); |
26 return 0; | 26 return 0; |
27 } | 27 } |
28 | 28 |
29 return static_cast<int64>(memory_info.ullTotalPhys); | 29 return static_cast<int64>(memory_info.ullTotalPhys); |
30 } | 30 } |
31 | 31 |
| 32 // static |
| 33 int64 SysInfo::AmountOfFreeDiskSpace(const std::wstring& path) { |
| 34 ULARGE_INTEGER available, total, free; |
| 35 if (!GetDiskFreeSpaceExW(path.c_str(), &available, &total, &free)) { |
| 36 return 0; |
| 37 } |
| 38 return static_cast<int64>(available.QuadPart); |
| 39 } |
| 40 |
32 } // namespace base | 41 } // namespace base |
OLD | NEW |