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

Unified Diff: chromeos/cryptohome/async_method_caller.cc

Issue 880303003: Cryptohome: Notify about error in async calls if cryptohome is not ready yet. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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/cryptohome/async_method_caller.cc
diff --git a/chromeos/cryptohome/async_method_caller.cc b/chromeos/cryptohome/async_method_caller.cc
index 0b137b035fee2fd0e3bbecc45ba1f193ef4da49d..33cba221bfb45da393127b182e0ebdaf47bb73d1 100644
--- a/chromeos/cryptohome/async_method_caller.cc
+++ b/chromeos/cryptohome/async_method_caller.cc
@@ -308,10 +308,17 @@ class AsyncMethodCallerImpl : public AsyncMethodCaller {
base::Bind(it->second.data_callback, return_status, return_data));
data_callback_map_.erase(it);
}
-
// Registers a callback which is called when the result for AsyncXXX is ready.
void RegisterAsyncCallback(
Callback callback, const char* error, int async_id) {
+ if (async_id == chromeos::kCryptohomeNotReadyAsyncId) {
+ base::MessageLoopProxy::current()->PostTask(
+ FROM_HERE, base::Bind(callback,
+ false, // return status
+ cryptohome::MOUNT_ERROR_FATAL));
+ return;
+ }
+
if (async_id == 0) {
LOG(ERROR) << error;
return;
@@ -325,6 +332,13 @@ class AsyncMethodCallerImpl : public AsyncMethodCaller {
// Registers a callback which is called when the result for AsyncXXX is ready.
void RegisterAsyncDataCallback(
DataCallback callback, const char* error, int async_id) {
+ if (async_id == chromeos::kCryptohomeNotReadyAsyncId) {
+ base::MessageLoopProxy::current()->PostTask(
+ FROM_HERE, base::Bind(callback,
+ false, // return status
+ std::string()));
Daniel Erat 2015/01/28 18:01:46 nit: is there a reason for not using MOUNT_ERROR_F
Denis Kuznetsov (DE-MUC) 2015/01/28 19:45:26 This callback expects std::string() instead of enu
+ return;
+ }
if (async_id == 0) {
LOG(ERROR) << error;
return;

Powered by Google App Engine
This is Rietveld 408576698