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 #include "chrome/browser/component_updater/component_patcher_operation_out_of_pr
ocess.h" | 5 #include "chrome/browser/component_updater/component_patcher_operation_out_of_pr
ocess.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "base/bind.h" | 9 #include "base/bind.h" |
8 #include "base/callback.h" | 10 #include "base/callback.h" |
9 #include "base/files/file.h" | 11 #include "base/files/file.h" |
10 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
11 #include "base/sequenced_task_runner.h" | 13 #include "base/sequenced_task_runner.h" |
12 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
13 #include "chrome/grit/generated_resources.h" | 15 #include "chrome/grit/generated_resources.h" |
| 16 #include "components/update_client/component_patcher_operation.h" |
14 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
15 #include "ui/base/l10n/l10n_util.h" | 18 #include "ui/base/l10n/l10n_util.h" |
16 | 19 |
17 namespace component_updater { | 20 namespace component_updater { |
18 | 21 |
19 ChromeOutOfProcessPatcher::ChromeOutOfProcessPatcher() = default; | 22 ChromeOutOfProcessPatcher::ChromeOutOfProcessPatcher() = default; |
20 | 23 |
21 ChromeOutOfProcessPatcher::~ChromeOutOfProcessPatcher() = default; | 24 ChromeOutOfProcessPatcher::~ChromeOutOfProcessPatcher() = default; |
22 | 25 |
23 void ChromeOutOfProcessPatcher::Patch( | 26 void ChromeOutOfProcessPatcher::Patch( |
24 const std::string& operation, | 27 const std::string& operation, |
25 scoped_refptr<base::SequencedTaskRunner> task_runner, | 28 const scoped_refptr<base::SequencedTaskRunner>& task_runner, |
26 const base::FilePath& input_path, | 29 const base::FilePath& input_path, |
27 const base::FilePath& patch_path, | 30 const base::FilePath& patch_path, |
28 const base::FilePath& output_path, | 31 const base::FilePath& output_path, |
29 base::Callback<void(int result)> callback) { | 32 const base::Callback<void(int result)>& callback) { |
30 DCHECK(task_runner); | 33 DCHECK(task_runner); |
31 DCHECK(!callback.is_null()); | 34 DCHECK(!callback.is_null()); |
32 | 35 |
33 task_runner_ = std::move(task_runner); | 36 task_runner_ = task_runner; |
34 callback_ = callback; | 37 callback_ = callback; |
35 | 38 |
36 base::File input_file(input_path, | 39 base::File input_file(input_path, |
37 base::File::FLAG_OPEN | base::File::FLAG_READ); | 40 base::File::FLAG_OPEN | base::File::FLAG_READ); |
38 base::File patch_file(patch_path, | 41 base::File patch_file(patch_path, |
39 base::File::FLAG_OPEN | base::File::FLAG_READ); | 42 base::File::FLAG_OPEN | base::File::FLAG_READ); |
40 base::File output_file(output_path, base::File::FLAG_CREATE | | 43 base::File output_file(output_path, base::File::FLAG_CREATE | |
41 base::File::FLAG_WRITE | | 44 base::File::FLAG_WRITE | |
42 base::File::FLAG_EXCLUSIVE_WRITE); | 45 base::File::FLAG_EXCLUSIVE_WRITE); |
43 | 46 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 } | 86 } |
84 | 87 |
85 void ChromeOutOfProcessPatcher::PatchDone(int result) { | 88 void ChromeOutOfProcessPatcher::PatchDone(int result) { |
86 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 89 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
87 | 90 |
88 utility_process_mojo_client_.reset(); // Terminate the utility process. | 91 utility_process_mojo_client_.reset(); // Terminate the utility process. |
89 task_runner_->PostTask(FROM_HERE, base::Bind(callback_, result)); | 92 task_runner_->PostTask(FROM_HERE, base::Bind(callback_, result)); |
90 } | 93 } |
91 | 94 |
92 } // namespace component_updater | 95 } // namespace component_updater |
OLD | NEW |