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

Unified Diff: base/sys_info_win.cc

Issue 2052663003: Move implementation of QuotaManager.getVolumeInfo to base::SysInfo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: base/sys_info_win.cc
diff --git a/base/sys_info_win.cc b/base/sys_info_win.cc
index d2c7bcddc148d1693946fbb26086f676f85b1423..9f5d86d347c1b5d0aa20272af299a7338c30f340 100644
--- a/base/sys_info_win.cc
+++ b/base/sys_info_win.cc
@@ -66,6 +66,21 @@ int64_t SysInfo::AmountOfFreeDiskSpace(const FilePath& path) {
return rv < 0 ? std::numeric_limits<int64_t>::max() : rv;
Dan Beam 2016/06/09 17:20:13 what about this logic?
fukino 2016/06/10 01:33:36 Added the logic inside GetDiskSpaceInfo to cover t
}
+// static
+bool SysInfo::GetDiskSpaceInfo(const FilePath& path,
+ int64_t* available_bytes,
+ int64_t* total_bytes) {
+ ThreadRestrictions::AssertIOAllowed();
+
+ ULARGE_INTEGER available, total, free;
+ if (!GetDiskFreeSpaceExW(path.value().c_str(), &available, &total, &free))
+ return false;
+
+ *available_bytes = static_cast<int64_t>(available.QuadPart);
+ *total_bytes = static_cast<int64_t>(total.QuadPart);
+ return true;
+}
+
std::string SysInfo::OperatingSystemName() {
return "Windows NT";
}

Powered by Google App Engine
This is Rietveld 408576698