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

Unified Diff: chromeos/dbus/cryptohome_client.cc

Issue 2136023002: arc: Abort booting ARC if the device is critically low on disk space. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 4 years, 5 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: chromeos/dbus/cryptohome_client.cc
diff --git a/chromeos/dbus/cryptohome_client.cc b/chromeos/dbus/cryptohome_client.cc
index 86fe5b7e65ab7ff67ad86c151812aee85abde460..2608496e47528afbf972afb4f54266fab0303c17 100644
--- a/chromeos/dbus/cryptohome_client.cc
+++ b/chromeos/dbus/cryptohome_client.cc
@@ -168,6 +168,15 @@ class CryptohomeClientImpl : public CryptohomeClient {
}
// CryptohomeClient override.
+ void GetFreeDiskSpace(const GetFreeDiskSpaceCallback& callback) override {
+ dbus::MethodCall method_call(cryptohome::kCryptohomeInterface,
+ cryptohome::kCryptohomeGetFreeDiskSpace);
+ proxy_->CallMethod(&method_call, kTpmDBusTimeoutMs,
+ base::Bind(&CryptohomeClientImpl::OnGetFreeDiskSpace,
+ weak_ptr_factory_.GetWeakPtr(), callback));
+ }
+
+ // CryptohomeClient override.
void GetSystemSalt(const GetSystemSaltCallback& callback) override {
dbus::MethodCall method_call(cryptohome::kCryptohomeInterface,
cryptohome::kCryptohomeGetSystemSalt);
@@ -973,6 +982,22 @@ class CryptohomeClientImpl : public CryptohomeClient {
callback.Run(async_id);
}
+ // Handles the result of GetFreeDiskSpace().
+ void OnGetFreeDiskSpace(const GetFreeDiskSpaceCallback& callback,
+ dbus::Response* response) {
+ if (!response) {
+ callback.Run(DBUS_METHOD_CALL_FAILURE, 0);
+ return;
+ }
+ dbus::MessageReader reader(response);
+ uint64_t disk_free_bytes = 0;
+ if (!reader.PopUint64(&disk_free_bytes)) {
+ LOG(ERROR) << "Invalid response: " << response->ToString();
+ return;
hidehiko 2016/07/14 07:39:40 isn't it necessary to invoke callback.Run(FAILURE,
Shuhei Takahashi 2016/07/14 08:44:27 Yup, I think that's good to call failure callback.
+ }
+ callback.Run(DBUS_METHOD_CALL_SUCCESS, disk_free_bytes);
+ }
+
// Handles the result of GetSystemSalt().
void OnGetSystemSalt(const GetSystemSaltCallback& callback,
dbus::Response* response) {

Powered by Google App Engine
This is Rietveld 408576698