Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <windows.h> | 9 #include <windows.h> |
| 10 #include <stddef.h> | 10 #include <stddef.h> |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 30 #include "chrome/installer/setup/setup_constants.h" | 30 #include "chrome/installer/setup/setup_constants.h" |
| 31 #include "chrome/installer/util/app_registration_data.h" | 31 #include "chrome/installer/util/app_registration_data.h" |
| 32 #include "chrome/installer/util/google_update_constants.h" | 32 #include "chrome/installer/util/google_update_constants.h" |
| 33 #include "chrome/installer/util/installation_state.h" | 33 #include "chrome/installer/util/installation_state.h" |
| 34 #include "chrome/installer/util/installer_state.h" | 34 #include "chrome/installer/util/installer_state.h" |
| 35 #include "chrome/installer/util/master_preferences.h" | 35 #include "chrome/installer/util/master_preferences.h" |
| 36 #include "chrome/installer/util/master_preferences_constants.h" | 36 #include "chrome/installer/util/master_preferences_constants.h" |
| 37 #include "chrome/installer/util/util_constants.h" | 37 #include "chrome/installer/util/util_constants.h" |
| 38 #include "courgette/courgette.h" | 38 #include "courgette/courgette.h" |
| 39 #include "courgette/third_party/bsdiff/bsdiff.h" | 39 #include "courgette/third_party/bsdiff/bsdiff.h" |
| 40 #include "third_party/bspatch/mbspatch.h" | |
| 41 | 40 |
| 42 namespace installer { | 41 namespace installer { |
| 43 | 42 |
| 44 namespace { | 43 namespace { |
| 45 | 44 |
| 46 // Returns true if product |type| cam be meaningfully installed without the | 45 // Returns true if product |type| cam be meaningfully installed without the |
| 47 // --multi-install flag. | 46 // --multi-install flag. |
| 48 bool SupportsSingleInstall(BrowserDistribution::Type type) { | 47 bool SupportsSingleInstall(BrowserDistribution::Type type) { |
| 49 return (type == BrowserDistribution::CHROME_BROWSER || | 48 return (type == BrowserDistribution::CHROME_BROWSER || |
| 50 type == BrowserDistribution::CHROME_FRAME); | 49 type == BrowserDistribution::CHROME_FRAME); |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 80 int BsdiffPatchFiles(const base::FilePath& src, | 79 int BsdiffPatchFiles(const base::FilePath& src, |
| 81 const base::FilePath& patch, | 80 const base::FilePath& patch, |
| 82 const base::FilePath& dest) { | 81 const base::FilePath& dest) { |
| 83 VLOG(1) << "Applying bsdiff patch " << patch.value() | 82 VLOG(1) << "Applying bsdiff patch " << patch.value() |
| 84 << " to file " << src.value() | 83 << " to file " << src.value() |
| 85 << " and generating file " << dest.value(); | 84 << " and generating file " << dest.value(); |
| 86 | 85 |
| 87 if (src.empty() || patch.empty() || dest.empty()) | 86 if (src.empty() || patch.empty() || dest.empty()) |
| 88 return installer::PATCH_INVALID_ARGUMENTS; | 87 return installer::PATCH_INVALID_ARGUMENTS; |
| 89 | 88 |
| 90 const int patch_status = courgette::ApplyBinaryPatch(src, patch, dest); | 89 const int patch_status = bsdiff::ApplyBinaryPatch(src, patch, dest); |
| 91 const int exit_code = patch_status != OK ? | 90 const int exit_code = patch_status != bsdiff::OK ? |
|
huangs
2016/06/03 05:12:05
This was Frankenstein before: Using BSDiff from Co
grt (UTC plus 2)
2016/06/03 15:58:36
Maybe we can get rid of the use of mbspatch in arc
Michael Moss
2016/06/03 16:40:20
Correct, we've only had 3-stage for many months no
| |
| 92 patch_status + kBsdiffErrorOffset : 0; | 91 patch_status + kBsdiffErrorOffset : 0; |
| 93 | 92 |
| 94 LOG_IF(ERROR, exit_code) | 93 LOG_IF(ERROR, exit_code) |
| 95 << "Failed to apply bsdiff patch " << patch.value() | 94 << "Failed to apply bsdiff patch " << patch.value() |
| 96 << " to file " << src.value() << " and generating file " << dest.value() | 95 << " to file " << src.value() << " and generating file " << dest.value() |
| 97 << ". err=" << exit_code; | 96 << ". err=" << exit_code; |
| 98 | 97 |
| 99 return exit_code; | 98 return exit_code; |
| 100 } | 99 } |
| 101 | 100 |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 584 } | 583 } |
| 585 | 584 |
| 586 ScopedTokenPrivilege::~ScopedTokenPrivilege() { | 585 ScopedTokenPrivilege::~ScopedTokenPrivilege() { |
| 587 if (is_enabled_ && previous_privileges_.PrivilegeCount != 0) { | 586 if (is_enabled_ && previous_privileges_.PrivilegeCount != 0) { |
| 588 ::AdjustTokenPrivileges(token_.Get(), FALSE, &previous_privileges_, | 587 ::AdjustTokenPrivileges(token_.Get(), FALSE, &previous_privileges_, |
| 589 sizeof(TOKEN_PRIVILEGES), NULL, NULL); | 588 sizeof(TOKEN_PRIVILEGES), NULL, NULL); |
| 590 } | 589 } |
| 591 } | 590 } |
| 592 | 591 |
| 593 } // namespace installer | 592 } // namespace installer |
| OLD | NEW |