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

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: Update 1 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
« no previous file with comments | « chrome/browser/chromeos/login/existing_user_controller.cc ('k') | chromeos/dbus/cryptohome_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..f45d1a2cbea5eccb5894500f2ce3cd4cf3d178a9 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::CryptohomeClient::kNotReadyAsyncId) {
+ 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::CryptohomeClient::kNotReadyAsyncId) {
+ base::MessageLoopProxy::current()->PostTask(
+ FROM_HERE, base::Bind(callback,
+ false, // return status
+ std::string()));
+ return;
+ }
if (async_id == 0) {
LOG(ERROR) << error;
return;
« no previous file with comments | « chrome/browser/chromeos/login/existing_user_controller.cc ('k') | chromeos/dbus/cryptohome_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698