| 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" |
| 11 #include "base/files/file_util.h" | 11 #include "base/files/file_util.h" |
| 12 #include "base/files/memory_mapped_file.h" | 12 #include "base/files/memory_mapped_file.h" |
| 13 #include "base/location.h" | 13 #include "base/location.h" |
| 14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
| 15 #include "components/update_client/out_of_process_patcher.h" |
| 15 #include "components/update_client/update_client.h" | 16 #include "components/update_client/update_client.h" |
| 16 #include "components/update_client/update_client_errors.h" | 17 #include "components/update_client/update_client_errors.h" |
| 17 #include "components/update_client/utils.h" | 18 #include "components/update_client/utils.h" |
| 18 #include "courgette/courgette.h" | 19 #include "courgette/courgette.h" |
| 19 #include "courgette/third_party/bsdiff/bsdiff.h" | 20 #include "courgette/third_party/bsdiff/bsdiff.h" |
| 20 | 21 |
| 21 namespace update_client { | 22 namespace update_client { |
| 22 | 23 |
| 23 namespace { | 24 namespace { |
| 24 | 25 |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 | 163 |
| 163 void DeltaUpdateOpCreate::DoRun(const ComponentPatcher::Callback& callback) { | 164 void DeltaUpdateOpCreate::DoRun(const ComponentPatcher::Callback& callback) { |
| 164 if (!base::Move(patch_abs_path_, output_abs_path_)) | 165 if (!base::Move(patch_abs_path_, output_abs_path_)) |
| 165 callback.Run(UnpackerError::kDeltaOperationFailure, 0); | 166 callback.Run(UnpackerError::kDeltaOperationFailure, 0); |
| 166 else | 167 else |
| 167 callback.Run(UnpackerError::kNone, 0); | 168 callback.Run(UnpackerError::kNone, 0); |
| 168 } | 169 } |
| 169 | 170 |
| 170 DeltaUpdateOpPatch::DeltaUpdateOpPatch( | 171 DeltaUpdateOpPatch::DeltaUpdateOpPatch( |
| 171 const std::string& operation, | 172 const std::string& operation, |
| 172 scoped_refptr<OutOfProcessPatcher> out_of_process_patcher) | 173 const scoped_refptr<OutOfProcessPatcher>& out_of_process_patcher) |
| 173 : operation_(operation), out_of_process_patcher_(out_of_process_patcher) { | 174 : operation_(operation), out_of_process_patcher_(out_of_process_patcher) { |
| 174 DCHECK(operation == kBsdiff || operation == kCourgette); | 175 DCHECK(operation == kBsdiff || operation == kCourgette); |
| 175 } | 176 } |
| 176 | 177 |
| 177 DeltaUpdateOpPatch::~DeltaUpdateOpPatch() { | 178 DeltaUpdateOpPatch::~DeltaUpdateOpPatch() { |
| 178 } | 179 } |
| 179 | 180 |
| 180 UnpackerError DeltaUpdateOpPatch::DoParseArguments( | 181 UnpackerError DeltaUpdateOpPatch::DoParseArguments( |
| 181 const base::DictionaryValue* command_args, | 182 const base::DictionaryValue* command_args, |
| 182 const base::FilePath& input_dir, | 183 const base::FilePath& input_dir, |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 } else { | 236 } else { |
| 236 callback.Run(UnpackerError::kDeltaOperationFailure, | 237 callback.Run(UnpackerError::kDeltaOperationFailure, |
| 237 result + kCourgetteErrorOffset); | 238 result + kCourgetteErrorOffset); |
| 238 } | 239 } |
| 239 } else { | 240 } else { |
| 240 NOTREACHED(); | 241 NOTREACHED(); |
| 241 } | 242 } |
| 242 } | 243 } |
| 243 | 244 |
| 244 } // namespace update_client | 245 } // namespace update_client |
| OLD | NEW |