| OLD | NEW |
| 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 Loading... |
| 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 |
| OLD | NEW |