| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // This file declares util functions for setup project. | 5 // This file declares util functions for setup project. |
| 6 | 6 |
| 7 #include "chrome/installer/setup/setup_util.h" | 7 #include "chrome/installer/setup/setup_util.h" |
| 8 | 8 |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 // Try Courgette first. Courgette checks the patch file first and fails | 29 // Try Courgette first. Courgette checks the patch file first and fails |
| 30 // quickly if the patch file does not have a valid Courgette header. | 30 // quickly if the patch file does not have a valid Courgette header. |
| 31 courgette::Status patch_status = | 31 courgette::Status patch_status = |
| 32 courgette::ApplyEnsemblePatch(src.value().c_str(), | 32 courgette::ApplyEnsemblePatch(src.value().c_str(), |
| 33 patch.value().c_str(), | 33 patch.value().c_str(), |
| 34 dest.value().c_str()); | 34 dest.value().c_str()); |
| 35 if (patch_status == courgette::C_OK) | 35 if (patch_status == courgette::C_OK) |
| 36 return 0; | 36 return 0; |
| 37 | 37 |
| 38 VLOG(1) << "Failed to apply patch " << patch.value() << " using courgette."; | 38 VLOG(1) << "Failed to apply patch " << patch.value() |
| 39 << " using courgette. err=" << patch_status; |
| 40 |
| 41 // If we ran out of memory or disk space, then these are likely the errors |
| 42 // we will see. If we run into them, return an error and stay on the |
| 43 // 'ENSEMBLE_PATCHING' update stage. |
| 44 if (patch_status == courgette::C_DISASSEMBLY_FAILED || |
| 45 patch_status == courgette::C_STREAM_ERROR) { |
| 46 return MEM_ERROR; |
| 47 } |
| 39 | 48 |
| 40 if (installer_state != NULL) | 49 if (installer_state != NULL) |
| 41 installer_state->UpdateStage(installer::BINARY_PATCHING); | 50 installer_state->UpdateStage(installer::BINARY_PATCHING); |
| 42 | 51 |
| 43 return ApplyBinaryPatch(src.value().c_str(), patch.value().c_str(), | 52 return ApplyBinaryPatch(src.value().c_str(), patch.value().c_str(), |
| 44 dest.value().c_str()); | 53 dest.value().c_str()); |
| 45 } | 54 } |
| 46 | 55 |
| 47 Version* GetMaxVersionFromArchiveDir(const FilePath& chrome_path) { | 56 Version* GetMaxVersionFromArchiveDir(const FilePath& chrome_path) { |
| 48 VLOG(1) << "Looking for Chrome version folder under " << chrome_path.value(); | 57 VLOG(1) << "Looking for Chrome version folder under " << chrome_path.value(); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 BY_HANDLE_FILE_INFORMATION info = {}; | 145 BY_HANDLE_FILE_INFORMATION info = {}; |
| 137 | 146 |
| 138 return (OpenForInfo(program, &handle) && | 147 return (OpenForInfo(program, &handle) && |
| 139 GetInfo(handle, &info) && | 148 GetInfo(handle, &info) && |
| 140 info.dwVolumeSerialNumber == file_info_.dwVolumeSerialNumber && | 149 info.dwVolumeSerialNumber == file_info_.dwVolumeSerialNumber && |
| 141 info.nFileIndexHigh == file_info_.nFileIndexHigh && | 150 info.nFileIndexHigh == file_info_.nFileIndexHigh && |
| 142 info.nFileIndexLow == file_info_.nFileIndexLow); | 151 info.nFileIndexLow == file_info_.nFileIndexLow); |
| 143 } | 152 } |
| 144 | 153 |
| 145 } // namespace installer | 154 } // namespace installer |
| OLD | NEW |