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

Unified Diff: update_attempter.cc

Issue 5835004: AU: MultiHttpFetcher cleanup/rewrite (Closed) Base URL: http://git.chromium.org/git/update_engine.git@master
Patch Set: fixes for review/merge latest trunk Created 10 years 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 | « multi_range_http_fetcher.cc ('k') | no next file » | 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 85500e61e65e6c4dafc027a7d3113165030a0f8a..813968718b84b0ef27eb8409e2b768c7dd762215 100644
--- a/update_attempter.cc
+++ b/update_attempter.cc
@@ -22,7 +22,7 @@
#include "update_engine/download_action.h"
#include "update_engine/filesystem_copier_action.h"
#include "update_engine/libcurl_http_fetcher.h"
-#include "update_engine/multi_http_fetcher.h"
+#include "update_engine/multi_range_http_fetcher.h"
#include "update_engine/omaha_request_action.h"
#include "update_engine/omaha_request_params.h"
#include "update_engine/omaha_response_handler_action.h"
@@ -185,8 +185,8 @@ void UpdateAttempter::Update(const std::string& app_version,
OmahaEvent::kTypeUpdateDownloadStarted),
new LibcurlHttpFetcher(GetProxyResolver())));
shared_ptr<DownloadAction> download_action(
- new DownloadAction(prefs_, new MultiHttpFetcher<LibcurlHttpFetcher>(
- GetProxyResolver())));
+ new DownloadAction(prefs_, new MultiRangeHTTPFetcher(
+ new LibcurlHttpFetcher(GetProxyResolver()))));
shared_ptr<OmahaRequestAction> download_finished_action(
new OmahaRequestAction(prefs_,
omaha_request_params_,
@@ -554,15 +554,14 @@ void UpdateAttempter::MarkDeltaUpdateFailure() {
}
void UpdateAttempter::SetupDownload() {
- MultiHttpFetcher<LibcurlHttpFetcher>* fetcher =
- dynamic_cast<MultiHttpFetcher<LibcurlHttpFetcher>*>(
- download_action_->http_fetcher());
- MultiHttpFetcher<LibcurlHttpFetcher>::RangesVect ranges;
+ MultiRangeHTTPFetcher* fetcher =
+ dynamic_cast<MultiRangeHTTPFetcher*>(download_action_->http_fetcher());
+ fetcher->ClearRanges();
if (response_handler_action_->install_plan().is_resume) {
// Resuming an update so fetch the update manifest metadata first.
int64_t manifest_metadata_size = 0;
prefs_->GetInt64(kPrefsManifestMetadataSize, &manifest_metadata_size);
- ranges.push_back(make_pair(0, manifest_metadata_size));
+ fetcher->AddRange(0, manifest_metadata_size);
// If there're remaining unprocessed data blobs, fetch them. Be careful not
// to request data beyond the end of the payload to avoid 416 HTTP response
// error codes.
@@ -570,12 +569,11 @@ void UpdateAttempter::SetupDownload() {
prefs_->GetInt64(kPrefsUpdateStateNextDataOffset, &next_data_offset);
uint64_t resume_offset = manifest_metadata_size + next_data_offset;
if (resume_offset < response_handler_action_->install_plan().size) {
- ranges.push_back(make_pair(resume_offset, -1));
+ fetcher->AddRange(resume_offset, -1);
}
} else {
- ranges.push_back(make_pair(0, -1));
+ fetcher->AddRange(0, -1);
}
- fetcher->set_ranges(ranges);
}
} // namespace chromeos_update_engine
« no previous file with comments | « multi_range_http_fetcher.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698