AU: DBus support.
A few changes to support dbus in the Update Engine daemon:
- SConstruct: build marshaller for the dbus signal.
- Update Attempter: respond to dbus calls and broadcast status on dbus
signal.
- Update Engine Client: flag to listen for status updates.
- Also, cleanup outdated code in Omaha Response Handler.
BUG=None
TEST=attached unittests/on device tests
Review URL: http://codereview.chromium.org/2037002
diff --git a/download_action.cc b/download_action.cc
index eee25cc..4787ee2 100644
--- a/download_action.cc
+++ b/download_action.cc
@@ -19,7 +19,9 @@
DownloadAction::DownloadAction(HttpFetcher* http_fetcher)
: writer_(NULL),
- http_fetcher_(http_fetcher) {}
+ http_fetcher_(http_fetcher),
+ delegate_(NULL),
+ bytes_received_(0) {}
DownloadAction::~DownloadAction() {}
@@ -29,6 +31,7 @@
// Get the InstallPlan and read it
CHECK(HasInputObject());
install_plan_ = GetInputObject();
+ bytes_received_ = 0;
install_plan_.Dump();
@@ -84,6 +87,9 @@
void DownloadAction::ReceivedBytes(HttpFetcher *fetcher,
const char* bytes,
int length) {
+ bytes_received_ += length;
+ if (delegate_)
+ delegate_->BytesReceived(bytes_received_, install_plan_.size);
int rc = writer_->Write(bytes, length);
TEST_AND_RETURN(rc >= 0);
omaha_hash_calculator_.Update(bytes, length);
@@ -94,9 +100,9 @@
vector<string> command;
command.push_back("/bin/sync");
int rc;
- LOG(INFO) << "FlushLinuxCaches/sync...";
+ LOG(INFO) << "FlushLinuxCaches-sync...";
Subprocess::SynchronousExec(command, &rc);
- LOG(INFO) << "FlushLinuxCaches/drop_caches...";
+ LOG(INFO) << "FlushLinuxCaches-drop_caches...";
const char* const drop_cmd = "3\n";
utils::WriteFile("/proc/sys/vm/drop_caches", drop_cmd, strlen(drop_cmd));