update_engine: Use libchromeos to launch subprocesses.

The Subprocess class handles the execution of suprocesses in the
update_engine such as the post-install script and bspatch operations.

This patch migrates this class from using glib functions to use
libchromeos classes with equivalent functionality.

Callsites and unittests were updated to match the new interface.

BUG=chromium:499886
TEST=Unittest still pass. Deployed on link and cros flash another image
using a delta payload.

Change-Id: Ia64d39734e220675113f393a6049e9a9b0fe8409
Reviewed-on: https://chromium-review.googlesource.com/288837
Trybot-Ready: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
diff --git a/update_attempter.cc b/update_attempter.cc
index a1b2f11..3afe2ac 100644
--- a/update_attempter.cc
+++ b/update_attempter.cc
@@ -1220,13 +1220,21 @@
   // the script runtime.
   update_boot_flags_running_ = true;
   LOG(INFO) << "Updating boot flags...";
-  vector<string> cmd{set_good_kernel_cmd_};
-  if (!Subprocess::Get().Exec(cmd, StaticCompleteUpdateBootFlags, this)) {
-    CompleteUpdateBootFlags(1);
+  vector<string> cmd{"/usr/sbin/chromeos-setgoodkernel"};
+  if (skip_set_good_kernel_) {
+    CompleteUpdateBootFlags(1, "Skipping the call to set");
+  } else {
+    if (!Subprocess::Get().Exec(cmd,
+                                Bind(&UpdateAttempter::CompleteUpdateBootFlags,
+                                     base::Unretained(this)))) {
+      CompleteUpdateBootFlags(
+          1, "Failed to launch process to mark kernel as good");
+    }
   }
 }
 
-void UpdateAttempter::CompleteUpdateBootFlags(int return_code) {
+void UpdateAttempter::CompleteUpdateBootFlags(int return_code,
+                                              const string& output) {
   update_boot_flags_running_ = false;
   updated_boot_flags_ = true;
   if (start_action_processor_) {
@@ -1234,13 +1242,6 @@
   }
 }
 
-void UpdateAttempter::StaticCompleteUpdateBootFlags(
-    int return_code,
-    const string& output,
-    void* p) {
-  reinterpret_cast<UpdateAttempter*>(p)->CompleteUpdateBootFlags(return_code);
-}
-
 void UpdateAttempter::BroadcastStatus() {
   if (!dbus_service_) {
     return;