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

Unified Diff: update_attempter.cc

Issue 3131022: AU: Update status to DOWNLOADING only after receiving some bytes from server. (Closed) Base URL: http://src.chromium.org/git/update_engine.git
Patch Set: review feedback Created 10 years, 4 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 | « update_attempter.h ('k') | update_engine_client.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: update_attempter.cc
diff --git a/update_attempter.cc b/update_attempter.cc
index a099d7c737144868bf704b4fc9eb387072ab34f9..2adb2455da56c228ed1269ab2073fe95ef8bd001 100644
--- a/update_attempter.cc
+++ b/update_attempter.cc
@@ -121,6 +121,7 @@ UpdateAttempter::UpdateAttempter(PrefsInterface* prefs,
metrics_lib_(metrics_lib),
priority_(utils::kProcessPriorityNormal),
manage_priority_source_(NULL),
+ download_active_(false),
status_(UPDATE_STATUS_IDLE),
download_progress_(0.0),
last_checked_time_(0),
@@ -319,7 +320,11 @@ void UpdateAttempter::ActionCompleted(ActionProcessor* processor,
}
// Find out which action completed.
if (type == OmahaResponseHandlerAction::StaticType()) {
- SetStatusAndNotify(UPDATE_STATUS_DOWNLOADING);
+ // Note that the status will be updated to DOWNLOADING when some
+ // bytes get actually downloaded from the server and the
+ // BytesReceived callback is invoked. This avoids notifying the
+ // user that a download has started in cases when the server and
+ // the client are unable to initiate the download.
OmahaResponseHandlerAction* omaha_response_handler_action =
dynamic_cast<OmahaResponseHandlerAction*>(action);
CHECK(omaha_response_handler_action);
@@ -347,8 +352,13 @@ void UpdateAttempter::ResumeUpdating() {
NOTIMPLEMENTED();
}
+void UpdateAttempter::SetDownloadStatus(bool active) {
+ download_active_ = active;
+ LOG(INFO) << "Download status: " << (active ? "active" : "inactive");
+}
+
void UpdateAttempter::BytesReceived(uint64_t bytes_received, uint64_t total) {
- if (status_ != UPDATE_STATUS_DOWNLOADING) {
+ if (!download_active_) {
LOG(ERROR) << "BytesReceived called while not downloading.";
return;
}
« no previous file with comments | « update_attempter.h ('k') | update_engine_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698