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 CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_PATCHER_OPERATION_OUT_OF_PROC
ESS_H_ | 5 #ifndef CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_PATCHER_OPERATION_OUT_OF_PROC
ESS_H_ |
6 #define CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_PATCHER_OPERATION_OUT_OF_PROC
ESS_H_ | 6 #define CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_PATCHER_OPERATION_OUT_OF_PROC
ESS_H_ |
7 | 7 |
| 8 #include <memory> |
8 #include <string> | 9 #include <string> |
9 | 10 |
10 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
11 #include "base/macros.h" | 12 #include "base/macros.h" |
12 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
13 #include "chrome/common/file_patcher.mojom.h" | 14 #include "chrome/common/file_patcher.mojom.h" |
14 #include "components/update_client/component_patcher_operation.h" | 15 #include "components/update_client/out_of_process_patcher.h" |
15 #include "content/public/browser/utility_process_mojo_client.h" | 16 #include "content/public/browser/utility_process_mojo_client.h" |
16 | 17 |
17 namespace base { | 18 namespace base { |
18 class FilePath; | 19 class FilePath; |
19 class SequencedTaskRunner; | 20 class SequencedTaskRunner; |
20 } // namespace base | 21 } // namespace base |
21 | 22 |
22 namespace component_updater { | 23 namespace component_updater { |
23 | 24 |
24 class ChromeOutOfProcessPatcher : public update_client::OutOfProcessPatcher { | 25 class ChromeOutOfProcessPatcher : public update_client::OutOfProcessPatcher { |
25 public: | 26 public: |
26 ChromeOutOfProcessPatcher(); | 27 ChromeOutOfProcessPatcher(); |
27 | 28 |
28 // update_client::OutOfProcessPatcher: | 29 // update_client::OutOfProcessPatcher: |
29 void Patch(const std::string& operation, | 30 void Patch(const std::string& operation, |
30 scoped_refptr<base::SequencedTaskRunner> task_runner, | 31 const scoped_refptr<base::SequencedTaskRunner>& task_runner, |
31 const base::FilePath& input_path, | 32 const base::FilePath& input_path, |
32 const base::FilePath& patch_path, | 33 const base::FilePath& patch_path, |
33 const base::FilePath& output_path, | 34 const base::FilePath& output_path, |
34 base::Callback<void(int result)> callback) override; | 35 const base::Callback<void(int result)>& callback) override; |
35 | 36 |
36 private: | 37 private: |
37 ~ChromeOutOfProcessPatcher() override; | 38 ~ChromeOutOfProcessPatcher() override; |
38 | 39 |
39 // Perform a patch operation using chrome::mojom::FilePatcher. | 40 // Perform a patch operation using chrome::mojom::FilePatcher. |
40 void PatchOnIOThread(const std::string& operation, | 41 void PatchOnIOThread(const std::string& operation, |
41 base::File input_file, | 42 base::File input_file, |
42 base::File patch_file, | 43 base::File patch_file, |
43 base::File output_file); | 44 base::File output_file); |
44 | 45 |
45 // Patch operation result handler. | 46 // Patch operation result handler. |
46 void PatchDone(int result); | 47 void PatchDone(int result); |
47 | 48 |
48 // Used to signal the operation result back to the Patch() requester. | 49 // Used to signal the operation result back to the Patch() requester. |
49 scoped_refptr<base::SequencedTaskRunner> task_runner_; | 50 scoped_refptr<base::SequencedTaskRunner> task_runner_; |
50 base::Callback<void(int result)> callback_; | 51 base::Callback<void(int result)> callback_; |
51 | 52 |
52 // Utility process used to perform out-of-process file patching. | 53 // Utility process used to perform out-of-process file patching. |
53 std::unique_ptr<content::UtilityProcessMojoClient<chrome::mojom::FilePatcher>> | 54 std::unique_ptr<content::UtilityProcessMojoClient<chrome::mojom::FilePatcher>> |
54 utility_process_mojo_client_; | 55 utility_process_mojo_client_; |
55 | 56 |
56 DISALLOW_COPY_AND_ASSIGN(ChromeOutOfProcessPatcher); | 57 DISALLOW_COPY_AND_ASSIGN(ChromeOutOfProcessPatcher); |
57 }; | 58 }; |
58 | 59 |
59 } // namespace component_updater | 60 } // namespace component_updater |
60 | 61 |
61 #endif // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_PATCHER_OPERATION_OUT_OF_P
ROCESS_H_ | 62 #endif // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_PATCHER_OPERATION_OUT_OF_P
ROCESS_H_ |
OLD | NEW |