AU: Make proxy resolution asynchronous.
This doesn't change proxy resolution overall (we still use settings
stored in the session manager), but it changes the implementation in
the updater to be asynchronous. The clients of the proxy resolver now
give a callback to be called when the proxies are known.
This is anticipation of a switch to using Chrome to resolve proxies,
which will need to be asynchronous.
BUG=chromium-os:12079
TEST=unittests; tested update on device w/ and w/o proxy settings
Review URL: http://codereview.chromium.org/6516026
Change-Id: Icc5c08e3abf4381be55d8d555020d4c630a07fd6
diff --git a/utils.cc b/utils.cc
index 7206171..502b0d1 100644
--- a/utils.cc
+++ b/utils.cc
@@ -26,6 +26,7 @@
#include <base/string_util.h>
#include <base/logging.h>
#include <cros_boot_mode/boot_mode.h>
+#include <google/protobuf/stubs/common.h>
#include <rootdev/rootdev.h>
#include "update_engine/file_writer.h"
@@ -551,6 +552,13 @@
return base::RandInt(min, max);
}
+gboolean GlibRunClosure(gpointer data) {
+ google::protobuf::Closure* callback =
+ reinterpret_cast<google::protobuf::Closure*>(data);
+ callback->Run();
+ return FALSE;
+}
+
const char* const kStatefulPartition = "/mnt/stateful_partition";
} // namespace utils