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

Side by Side Diff: components/update_client/component_patcher_operation.cc

Issue 2031193002: [Courgette] Refactor BSDiff namespaces and bsdiff::search() interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync. Created 4 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 unified diff | Download patch
« no previous file with comments | « chrome/utility/chrome_content_utility_client.cc ('k') | courgette/bsdiff_memory_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium 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 "components/update_client/component_patcher_operation.h" 5 #include "components/update_client/component_patcher_operation.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 if (out_of_process_patcher_.get()) { 201 if (out_of_process_patcher_.get()) {
202 out_of_process_patcher_->Patch( 202 out_of_process_patcher_->Patch(
203 operation_, GetTaskRunner(), input_abs_path_, patch_abs_path_, 203 operation_, GetTaskRunner(), input_abs_path_, patch_abs_path_,
204 output_abs_path_, 204 output_abs_path_,
205 base::Bind(&DeltaUpdateOpPatch::DonePatching, this, callback)); 205 base::Bind(&DeltaUpdateOpPatch::DonePatching, this, callback));
206 return; 206 return;
207 } 207 }
208 208
209 if (operation_ == kBsdiff) { 209 if (operation_ == kBsdiff) {
210 DonePatching(callback, 210 DonePatching(callback,
211 courgette::ApplyBinaryPatch(input_abs_path_, patch_abs_path_, 211 bsdiff::ApplyBinaryPatch(input_abs_path_, patch_abs_path_,
212 output_abs_path_)); 212 output_abs_path_));
213 } else if (operation_ == kCourgette) { 213 } else if (operation_ == kCourgette) {
214 DonePatching(callback, courgette::ApplyEnsemblePatch( 214 DonePatching(callback, courgette::ApplyEnsemblePatch(
215 input_abs_path_.value().c_str(), 215 input_abs_path_.value().c_str(),
216 patch_abs_path_.value().c_str(), 216 patch_abs_path_.value().c_str(),
217 output_abs_path_.value().c_str())); 217 output_abs_path_.value().c_str()));
218 } else { 218 } else {
219 NOTREACHED(); 219 NOTREACHED();
220 } 220 }
221 } 221 }
222 222
223 void DeltaUpdateOpPatch::DonePatching( 223 void DeltaUpdateOpPatch::DonePatching(
224 const ComponentUnpacker::Callback& callback, 224 const ComponentUnpacker::Callback& callback,
225 int result) { 225 int result) {
226 if (operation_ == kBsdiff) { 226 if (operation_ == kBsdiff) {
227 if (result == courgette::OK) { 227 if (result == bsdiff::OK) {
228 callback.Run(ComponentUnpacker::kNone, 0); 228 callback.Run(ComponentUnpacker::kNone, 0);
229 } else { 229 } else {
230 callback.Run(ComponentUnpacker::kDeltaOperationFailure, 230 callback.Run(ComponentUnpacker::kDeltaOperationFailure,
231 result + kBsdiffErrorOffset); 231 result + kBsdiffErrorOffset);
232 } 232 }
233 } else if (operation_ == kCourgette) { 233 } else if (operation_ == kCourgette) {
234 if (result == courgette::C_OK) { 234 if (result == courgette::C_OK) {
235 callback.Run(ComponentUnpacker::kNone, 0); 235 callback.Run(ComponentUnpacker::kNone, 0);
236 } else { 236 } else {
237 callback.Run(ComponentUnpacker::kDeltaOperationFailure, 237 callback.Run(ComponentUnpacker::kDeltaOperationFailure,
238 result + kCourgetteErrorOffset); 238 result + kCourgetteErrorOffset);
239 } 239 }
240 } else { 240 } else {
241 NOTREACHED(); 241 NOTREACHED();
242 } 242 }
243 } 243 }
244 244
245 } // namespace update_client 245 } // namespace update_client
OLDNEW
« no previous file with comments | « chrome/utility/chrome_content_utility_client.cc ('k') | courgette/bsdiff_memory_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698