| 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 #ifndef COMPONENTS_COMPONENT_UPDATER_COMPONENT_PATCHER_OPERATION_H_ | 5 #ifndef COMPONENTS_COMPONENT_UPDATER_COMPONENT_PATCHER_OPERATION_H_ |
| 6 #define COMPONENTS_COMPONENT_UPDATER_COMPONENT_PATCHER_OPERATION_H_ | 6 #define COMPONENTS_COMPONENT_UPDATER_COMPONENT_PATCHER_OPERATION_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 // A 'copy' operation takes a file currently residing on the disk and moves it | 81 // A 'copy' operation takes a file currently residing on the disk and moves it |
| 82 // into the unpacking directory: this represents "no change" in the file being | 82 // into the unpacking directory: this represents "no change" in the file being |
| 83 // installed. | 83 // installed. |
| 84 class DeltaUpdateOpCopy : public DeltaUpdateOp { | 84 class DeltaUpdateOpCopy : public DeltaUpdateOp { |
| 85 public: | 85 public: |
| 86 DeltaUpdateOpCopy(); | 86 DeltaUpdateOpCopy(); |
| 87 | 87 |
| 88 private: | 88 private: |
| 89 virtual ~DeltaUpdateOpCopy(); | 89 ~DeltaUpdateOpCopy() override; |
| 90 | 90 |
| 91 // Overrides of DeltaUpdateOp. | 91 // Overrides of DeltaUpdateOp. |
| 92 virtual ComponentUnpacker::Error DoParseArguments( | 92 ComponentUnpacker::Error DoParseArguments( |
| 93 const base::DictionaryValue* command_args, | 93 const base::DictionaryValue* command_args, |
| 94 const base::FilePath& input_dir, | 94 const base::FilePath& input_dir, |
| 95 ComponentInstaller* installer) override; | 95 ComponentInstaller* installer) override; |
| 96 | 96 |
| 97 virtual void DoRun(const ComponentUnpacker::Callback& callback) override; | 97 void DoRun(const ComponentUnpacker::Callback& callback) override; |
| 98 | 98 |
| 99 base::FilePath input_abs_path_; | 99 base::FilePath input_abs_path_; |
| 100 | 100 |
| 101 DISALLOW_COPY_AND_ASSIGN(DeltaUpdateOpCopy); | 101 DISALLOW_COPY_AND_ASSIGN(DeltaUpdateOpCopy); |
| 102 }; | 102 }; |
| 103 | 103 |
| 104 // A 'create' operation takes a full file that was sent in the delta update | 104 // A 'create' operation takes a full file that was sent in the delta update |
| 105 // archive and moves it into the unpacking directory: this represents the | 105 // archive and moves it into the unpacking directory: this represents the |
| 106 // addition of a new file, or a file so different that no bandwidth could be | 106 // addition of a new file, or a file so different that no bandwidth could be |
| 107 // saved by transmitting a differential update. | 107 // saved by transmitting a differential update. |
| 108 class DeltaUpdateOpCreate : public DeltaUpdateOp { | 108 class DeltaUpdateOpCreate : public DeltaUpdateOp { |
| 109 public: | 109 public: |
| 110 DeltaUpdateOpCreate(); | 110 DeltaUpdateOpCreate(); |
| 111 | 111 |
| 112 private: | 112 private: |
| 113 virtual ~DeltaUpdateOpCreate(); | 113 ~DeltaUpdateOpCreate() override; |
| 114 | 114 |
| 115 // Overrides of DeltaUpdateOp. | 115 // Overrides of DeltaUpdateOp. |
| 116 virtual ComponentUnpacker::Error DoParseArguments( | 116 ComponentUnpacker::Error DoParseArguments( |
| 117 const base::DictionaryValue* command_args, | 117 const base::DictionaryValue* command_args, |
| 118 const base::FilePath& input_dir, | 118 const base::FilePath& input_dir, |
| 119 ComponentInstaller* installer) override; | 119 ComponentInstaller* installer) override; |
| 120 | 120 |
| 121 virtual void DoRun(const ComponentUnpacker::Callback& callback) override; | 121 void DoRun(const ComponentUnpacker::Callback& callback) override; |
| 122 | 122 |
| 123 base::FilePath patch_abs_path_; | 123 base::FilePath patch_abs_path_; |
| 124 | 124 |
| 125 DISALLOW_COPY_AND_ASSIGN(DeltaUpdateOpCreate); | 125 DISALLOW_COPY_AND_ASSIGN(DeltaUpdateOpCreate); |
| 126 }; | 126 }; |
| 127 | 127 |
| 128 // An interface an embedder may fulfill to enable out-of-process patching. | 128 // An interface an embedder may fulfill to enable out-of-process patching. |
| 129 class OutOfProcessPatcher | 129 class OutOfProcessPatcher |
| 130 : public base::RefCountedThreadSafe<OutOfProcessPatcher> { | 130 : public base::RefCountedThreadSafe<OutOfProcessPatcher> { |
| 131 public: | 131 public: |
| (...skipping 14 matching lines...) Expand all Loading... |
| 146 // and a bsdiff- or Courgette-format patch file provided in the delta update | 146 // and a bsdiff- or Courgette-format patch file provided in the delta update |
| 147 // package, and run bsdiff or Courgette to construct an output file in the | 147 // package, and run bsdiff or Courgette to construct an output file in the |
| 148 // unpacking directory. | 148 // unpacking directory. |
| 149 class DeltaUpdateOpPatch : public DeltaUpdateOp { | 149 class DeltaUpdateOpPatch : public DeltaUpdateOp { |
| 150 public: | 150 public: |
| 151 // |out_of_process_patcher| may be NULL. | 151 // |out_of_process_patcher| may be NULL. |
| 152 DeltaUpdateOpPatch(const std::string& operation, | 152 DeltaUpdateOpPatch(const std::string& operation, |
| 153 scoped_refptr<OutOfProcessPatcher> out_of_process_patcher); | 153 scoped_refptr<OutOfProcessPatcher> out_of_process_patcher); |
| 154 | 154 |
| 155 private: | 155 private: |
| 156 virtual ~DeltaUpdateOpPatch(); | 156 ~DeltaUpdateOpPatch() override; |
| 157 | 157 |
| 158 // Overrides of DeltaUpdateOp. | 158 // Overrides of DeltaUpdateOp. |
| 159 virtual ComponentUnpacker::Error DoParseArguments( | 159 ComponentUnpacker::Error DoParseArguments( |
| 160 const base::DictionaryValue* command_args, | 160 const base::DictionaryValue* command_args, |
| 161 const base::FilePath& input_dir, | 161 const base::FilePath& input_dir, |
| 162 ComponentInstaller* installer) override; | 162 ComponentInstaller* installer) override; |
| 163 | 163 |
| 164 virtual void DoRun(const ComponentUnpacker::Callback& callback) override; | 164 void DoRun(const ComponentUnpacker::Callback& callback) override; |
| 165 | 165 |
| 166 // |success_code| is the code that indicates a successful patch. | 166 // |success_code| is the code that indicates a successful patch. |
| 167 // |result| is the code the patching operation returned. | 167 // |result| is the code the patching operation returned. |
| 168 void DonePatching(const ComponentUnpacker::Callback& callback, int result); | 168 void DonePatching(const ComponentUnpacker::Callback& callback, int result); |
| 169 | 169 |
| 170 std::string operation_; | 170 std::string operation_; |
| 171 scoped_refptr<OutOfProcessPatcher> out_of_process_patcher_; | 171 scoped_refptr<OutOfProcessPatcher> out_of_process_patcher_; |
| 172 base::FilePath patch_abs_path_; | 172 base::FilePath patch_abs_path_; |
| 173 base::FilePath input_abs_path_; | 173 base::FilePath input_abs_path_; |
| 174 | 174 |
| 175 DISALLOW_COPY_AND_ASSIGN(DeltaUpdateOpPatch); | 175 DISALLOW_COPY_AND_ASSIGN(DeltaUpdateOpPatch); |
| 176 }; | 176 }; |
| 177 | 177 |
| 178 DeltaUpdateOp* CreateDeltaUpdateOp( | 178 DeltaUpdateOp* CreateDeltaUpdateOp( |
| 179 const std::string& operation, | 179 const std::string& operation, |
| 180 scoped_refptr<OutOfProcessPatcher> out_of_process_patcher); | 180 scoped_refptr<OutOfProcessPatcher> out_of_process_patcher); |
| 181 | 181 |
| 182 } // namespace component_updater | 182 } // namespace component_updater |
| 183 | 183 |
| 184 #endif // COMPONENTS_COMPONENT_UPDATER_COMPONENT_PATCHER_OPERATION_H_ | 184 #endif // COMPONENTS_COMPONENT_UPDATER_COMPONENT_PATCHER_OPERATION_H_ |
| OLD | NEW |