| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium OS 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 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_DELTA_PERFORMER_H__ | 5 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_DELTA_PERFORMER_H__ |
| 6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_DELTA_PERFORMER_H__ | 6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_DELTA_PERFORMER_H__ |
| 7 | 7 |
| 8 #include <inttypes.h> | 8 #include <inttypes.h> |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 uint64_t block_size, | 76 uint64_t block_size, |
| 77 uint64_t full_length, | 77 uint64_t full_length, |
| 78 std::string* positions_string); | 78 std::string* positions_string); |
| 79 | 79 |
| 80 // Returns true if a previous update attempt can be continued based on the | 80 // Returns true if a previous update attempt can be continued based on the |
| 81 // persistent preferences and the new update check response hash. | 81 // persistent preferences and the new update check response hash. |
| 82 static bool CanResumeUpdate(PrefsInterface* prefs, | 82 static bool CanResumeUpdate(PrefsInterface* prefs, |
| 83 std::string update_check_response_hash); | 83 std::string update_check_response_hash); |
| 84 | 84 |
| 85 // Resets the persistent update progress state to indicate that an update | 85 // Resets the persistent update progress state to indicate that an update |
| 86 // can't be resumed. Returns true on success, false otherwise. | 86 // can't be resumed. Performs a quick update-in-progress reset if |quick| is |
| 87 static bool ResetUpdateProgress(PrefsInterface* prefs); | 87 // true, otherwise resets all progress-related update state. Returns true on |
| 88 // success, false otherwise. |
| 89 static bool ResetUpdateProgress(PrefsInterface* prefs, bool quick); |
| 88 | 90 |
| 89 private: | 91 private: |
| 90 // Returns true if enough of the delta file has been passed via Write() | 92 // Returns true if enough of the delta file has been passed via Write() |
| 91 // to be able to perform a given install operation. | 93 // to be able to perform a given install operation. |
| 92 bool CanPerformInstallOperation( | 94 bool CanPerformInstallOperation( |
| 93 const DeltaArchiveManifest_InstallOperation& operation); | 95 const DeltaArchiveManifest_InstallOperation& operation); |
| 94 | 96 |
| 95 // Returns true on success. | 97 // Returns true on success. |
| 96 bool PerformInstallOperation( | 98 bool PerformInstallOperation( |
| 97 const DeltaArchiveManifest_InstallOperation& operation); | 99 const DeltaArchiveManifest_InstallOperation& operation); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 113 const DeltaArchiveManifest_InstallOperation& operation); | 115 const DeltaArchiveManifest_InstallOperation& operation); |
| 114 | 116 |
| 115 // Updates the hash calculator with |count| bytes at the head of |buffer_| and | 117 // Updates the hash calculator with |count| bytes at the head of |buffer_| and |
| 116 // then discards them. | 118 // then discards them. |
| 117 void DiscardBufferHeadBytes(size_t count); | 119 void DiscardBufferHeadBytes(size_t count); |
| 118 | 120 |
| 119 // Checkpoints the update progress into persistent storage to allow this | 121 // Checkpoints the update progress into persistent storage to allow this |
| 120 // update attempt to be resumed after reboot. | 122 // update attempt to be resumed after reboot. |
| 121 bool CheckpointUpdateProgress(); | 123 bool CheckpointUpdateProgress(); |
| 122 | 124 |
| 125 // Primes the required update state. Returns true if the update state was |
| 126 // successfully initialized to a saved resume state or if the update is a new |
| 127 // update. Returns false otherwise. |
| 128 bool PrimeUpdateState(); |
| 129 |
| 123 // Update Engine preference store. | 130 // Update Engine preference store. |
| 124 PrefsInterface* prefs_; | 131 PrefsInterface* prefs_; |
| 125 | 132 |
| 126 // File descriptor of open device. | 133 // File descriptor of open device. |
| 127 int fd_; | 134 int fd_; |
| 128 | 135 |
| 129 // File descriptor of the kernel device | 136 // File descriptor of the kernel device |
| 130 int kernel_fd_; | 137 int kernel_fd_; |
| 131 | 138 |
| 132 std::string path_; // Path that fd_ refers to. | 139 std::string path_; // Path that fd_ refers to. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 161 | 168 |
| 162 // Signatures message blob extracted directly from the payload. | 169 // Signatures message blob extracted directly from the payload. |
| 163 std::vector<char> signatures_message_data_; | 170 std::vector<char> signatures_message_data_; |
| 164 | 171 |
| 165 DISALLOW_COPY_AND_ASSIGN(DeltaPerformer); | 172 DISALLOW_COPY_AND_ASSIGN(DeltaPerformer); |
| 166 }; | 173 }; |
| 167 | 174 |
| 168 } // namespace chromeos_update_engine | 175 } // namespace chromeos_update_engine |
| 169 | 176 |
| 170 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_DELTA_PERFORMER_H__ | 177 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_DELTA_PERFORMER_H__ |
| OLD | NEW |