update_engine: Migrate time-based glib main loop calls to MessageLoop.

This patch replaces most calls to g_idle_add* and g_timeout_add* with
the equivalent MessageLoop::Post*Task(). To maintain compatibility with
unittests running the main loop and doing I/O we instantiate a
GlibMessageLoop for those tests.

BUG=chromium:499886
TEST=unittests still pass.

Change-Id: Ic87ba69bc47391ac3c36d1bfc3ca28d069666af1
Reviewed-on: https://chromium-review.googlesource.com/281197
Reviewed-by: Alex Vakulenko <[email protected]>
Tested-by: Alex Deymo <[email protected]>
Commit-Queue: Alex Deymo <[email protected]>
Trybot-Ready: Alex Deymo <[email protected]>
diff --git a/download_action.h b/download_action.h
index 52efb46..0d51d9a 100644
--- a/download_action.h
+++ b/download_action.h
@@ -69,11 +69,11 @@
   std::string Type() const override { return StaticType(); }
 
   // HttpFetcherDelegate methods (see http_fetcher.h)
-  void ReceivedBytes(HttpFetcher *fetcher,
+  void ReceivedBytes(HttpFetcher* fetcher,
                      const void* bytes, size_t length) override;
   void SeekToOffset(off_t offset) override;
-  void TransferComplete(HttpFetcher *fetcher, bool successful) override;
-  void TransferTerminated(HttpFetcher *fetcher) override;
+  void TransferComplete(HttpFetcher* fetcher, bool successful) override;
+  void TransferTerminated(HttpFetcher* fetcher) override;
 
   DownloadActionDelegate* delegate() const { return delegate_; }
   void set_delegate(DownloadActionDelegate* delegate) {
@@ -103,7 +103,7 @@
   //
   // This method does nothing if SetupP2PSharingFd() hasn't been
   // called or if CloseP2PSharingFd() has been called.
-  void WriteToP2PFile(const void *data, size_t length, off_t file_offset);
+  void WriteToP2PFile(const void* data, size_t length, off_t file_offset);
 
   // The InstallPlan passed in
   InstallPlan install_plan_;