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

Side by Side Diff: download_action.cc

Issue 4111006: AU: No need to calculate SHA-256 on the payload twice for delta updates. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git
Patch Set: Created 10 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "update_engine/download_action.h" 5 #include "update_engine/download_action.h"
6 #include <errno.h> 6 #include <errno.h>
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 #include <glib.h> 10 #include <glib.h>
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 int length) { 116 int length) {
117 bytes_received_ += length; 117 bytes_received_ += length;
118 if (delegate_) 118 if (delegate_)
119 delegate_->BytesReceived(bytes_received_, install_plan_.size); 119 delegate_->BytesReceived(bytes_received_, install_plan_.size);
120 if (writer_ && writer_->Write(bytes, length) < 0) { 120 if (writer_ && writer_->Write(bytes, length) < 0) {
121 LOG(ERROR) << "Write error -- terminating processing."; 121 LOG(ERROR) << "Write error -- terminating processing.";
122 TerminateProcessing(); 122 TerminateProcessing();
123 processor_->ActionComplete(this, kActionCodeDownloadWriteError); 123 processor_->ActionComplete(this, kActionCodeDownloadWriteError);
124 return; 124 return;
125 } 125 }
126 omaha_hash_calculator_.Update(bytes, length); 126 // DeltaPerformer checks the hashes for delta updates.
127 if (install_plan_.is_full_update) {
128 omaha_hash_calculator_.Update(bytes, length);
129 }
127 } 130 }
128 131
129 namespace { 132 namespace {
130 void FlushLinuxCaches() { 133 void FlushLinuxCaches() {
131 vector<string> command; 134 vector<string> command;
132 command.push_back("/bin/sync"); 135 command.push_back("/bin/sync");
133 int rc; 136 int rc;
134 LOG(INFO) << "FlushLinuxCaches-sync..."; 137 LOG(INFO) << "FlushLinuxCaches-sync...";
135 Subprocess::SynchronousExec(command, &rc); 138 Subprocess::SynchronousExec(command, &rc);
136 LOG(INFO) << "FlushLinuxCaches-drop_caches..."; 139 LOG(INFO) << "FlushLinuxCaches-drop_caches...";
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 188
186 FlushLinuxCaches(); 189 FlushLinuxCaches();
187 190
188 // Write the path to the output pipe if we're successful. 191 // Write the path to the output pipe if we're successful.
189 if (code == kActionCodeSuccess && HasOutputPipe()) 192 if (code == kActionCodeSuccess && HasOutputPipe())
190 SetOutputObject(GetInputObject()); 193 SetOutputObject(GetInputObject());
191 processor_->ActionComplete(this, code); 194 processor_->ActionComplete(this, code);
192 } 195 }
193 196
194 }; // namespace {} 197 }; // namespace {}
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698