| 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> |
| 11 | 11 |
| 12 #include <google/protobuf/repeated_field.h> | 12 #include <google/protobuf/repeated_field.h> |
| 13 | 13 |
| 14 #include "update_engine/file_writer.h" | 14 #include "update_engine/file_writer.h" |
| 15 #include "update_engine/omaha_hash_calculator.h" | 15 #include "update_engine/omaha_hash_calculator.h" |
| 16 #include "update_engine/update_metadata.pb.h" | 16 #include "update_engine/update_metadata.pb.h" |
| 17 | 17 |
| 18 namespace chromeos_update_engine { | 18 namespace chromeos_update_engine { |
| 19 | 19 |
| 20 class PrefsInterface; |
| 21 |
| 20 // This class performs the actions in a delta update synchronously. The delta | 22 // This class performs the actions in a delta update synchronously. The delta |
| 21 // update itself should be passed in in chunks as it is received. | 23 // update itself should be passed in in chunks as it is received. |
| 22 | 24 |
| 23 class DeltaPerformer : public FileWriter { | 25 class DeltaPerformer : public FileWriter { |
| 24 public: | 26 public: |
| 25 DeltaPerformer() | 27 DeltaPerformer(PrefsInterface* prefs) |
| 26 : fd_(-1), | 28 : prefs_(prefs), |
| 29 fd_(-1), |
| 27 kernel_fd_(-1), | 30 kernel_fd_(-1), |
| 28 manifest_valid_(false), | 31 manifest_valid_(false), |
| 29 next_operation_num_(0), | 32 next_operation_num_(0), |
| 30 buffer_offset_(0), | 33 buffer_offset_(0), |
| 31 block_size_(0) {} | 34 block_size_(0) {} |
| 32 | 35 |
| 33 // Opens the kernel. Should be called before or after Open(), but before | 36 // Opens the kernel. Should be called before or after Open(), but before |
| 34 // Write(). The kernel file will be close()d when Close() is called. | 37 // Write(). The kernel file will be close()d when Close() is called. |
| 35 bool OpenKernel(const char* kernel_path); | 38 bool OpenKernel(const char* kernel_path); |
| 36 | 39 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 95 |
| 93 // Returns true if the payload signature message has been extracted from | 96 // Returns true if the payload signature message has been extracted from |
| 94 // |operation|, false otherwise. | 97 // |operation|, false otherwise. |
| 95 bool ExtractSignatureMessage( | 98 bool ExtractSignatureMessage( |
| 96 const DeltaArchiveManifest_InstallOperation& operation); | 99 const DeltaArchiveManifest_InstallOperation& operation); |
| 97 | 100 |
| 98 // Discard |count| bytes from the beginning of buffer_. If |do_hash| is true, | 101 // Discard |count| bytes from the beginning of buffer_. If |do_hash| is true, |
| 99 // updates the hash calculator with these bytes before discarding them. | 102 // updates the hash calculator with these bytes before discarding them. |
| 100 void DiscardBufferHeadBytes(size_t count, bool do_hash); | 103 void DiscardBufferHeadBytes(size_t count, bool do_hash); |
| 101 | 104 |
| 105 bool ResetUpdateProgress(); |
| 106 bool CheckpointUpdateProgress(); |
| 107 |
| 108 // Update Engine preference store. |
| 109 PrefsInterface* prefs_; |
| 110 |
| 102 // File descriptor of open device. | 111 // File descriptor of open device. |
| 103 int fd_; | 112 int fd_; |
| 104 | 113 |
| 105 // File descriptor of the kernel device | 114 // File descriptor of the kernel device |
| 106 int kernel_fd_; | 115 int kernel_fd_; |
| 107 | 116 |
| 108 std::string path_; // Path that fd_ refers to. | 117 std::string path_; // Path that fd_ refers to. |
| 109 std::string kernel_path_; // Path that kernel_fd_ refers to. | 118 std::string kernel_path_; // Path that kernel_fd_ refers to. |
| 110 | 119 |
| 111 DeltaArchiveManifest manifest_; | 120 DeltaArchiveManifest manifest_; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 130 | 139 |
| 131 // Signatures message blob extracted directly from the payload. | 140 // Signatures message blob extracted directly from the payload. |
| 132 std::vector<char> signatures_message_data_; | 141 std::vector<char> signatures_message_data_; |
| 133 | 142 |
| 134 DISALLOW_COPY_AND_ASSIGN(DeltaPerformer); | 143 DISALLOW_COPY_AND_ASSIGN(DeltaPerformer); |
| 135 }; | 144 }; |
| 136 | 145 |
| 137 } // namespace chromeos_update_engine | 146 } // namespace chromeos_update_engine |
| 138 | 147 |
| 139 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_DELTA_PERFORMER_H__ | 148 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_DELTA_PERFORMER_H__ |
| OLD | NEW |