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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" |
| 11 #include "base/files/file_path.h" |
10 #include "chrome/common/chrome_utility_messages.h" | 12 #include "chrome/common/chrome_utility_messages.h" |
11 #include "components/component_updater/component_updater_service.h" | 13 #include "components/component_updater/component_updater_service.h" |
12 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
13 #include "content/public/browser/utility_process_host.h" | 15 #include "content/public/browser/utility_process_host.h" |
14 #include "content/public/browser/utility_process_host_client.h" | 16 #include "content/public/browser/utility_process_host_client.h" |
15 #include "courgette/courgette.h" | 17 #include "courgette/courgette.h" |
16 #include "courgette/third_party/bsdiff.h" | 18 #include "courgette/third_party/bsdiff.h" |
17 #include "ipc/ipc_message_macros.h" | 19 #include "ipc/ipc_message_macros.h" |
18 | 20 |
19 namespace component_updater { | 21 namespace component_updater { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 79 |
78 ChromeOutOfProcessPatcher::ChromeOutOfProcessPatcher() { | 80 ChromeOutOfProcessPatcher::ChromeOutOfProcessPatcher() { |
79 } | 81 } |
80 | 82 |
81 ChromeOutOfProcessPatcher::~ChromeOutOfProcessPatcher() { | 83 ChromeOutOfProcessPatcher::~ChromeOutOfProcessPatcher() { |
82 } | 84 } |
83 | 85 |
84 void ChromeOutOfProcessPatcher::Patch( | 86 void ChromeOutOfProcessPatcher::Patch( |
85 const std::string& operation, | 87 const std::string& operation, |
86 scoped_refptr<base::SequencedTaskRunner> task_runner, | 88 scoped_refptr<base::SequencedTaskRunner> task_runner, |
87 base::FilePath& input_abs_path, | 89 const base::FilePath& input_abs_path, |
88 base::FilePath& patch_abs_path, | 90 const base::FilePath& patch_abs_path, |
89 base::FilePath& output_abs_path, | 91 const base::FilePath& output_abs_path, |
90 base::Callback<void(int result)> callback) { | 92 base::Callback<void(int result)> callback) { |
91 host_ = new PatchHost(callback, task_runner); | 93 host_ = new PatchHost(callback, task_runner); |
92 scoped_ptr<IPC::Message> patch_message; | 94 scoped_ptr<IPC::Message> patch_message; |
93 if (operation == kBsdiff) { | 95 if (operation == kBsdiff) { |
94 patch_message.reset(new ChromeUtilityMsg_PatchFileBsdiff( | 96 patch_message.reset(new ChromeUtilityMsg_PatchFileBsdiff( |
95 input_abs_path, patch_abs_path, output_abs_path)); | 97 input_abs_path, patch_abs_path, output_abs_path)); |
96 } else if (operation == kCourgette) { | 98 } else if (operation == kCourgette) { |
97 patch_message.reset(new ChromeUtilityMsg_PatchFileCourgette( | 99 patch_message.reset(new ChromeUtilityMsg_PatchFileCourgette( |
98 input_abs_path, patch_abs_path, output_abs_path)); | 100 input_abs_path, patch_abs_path, output_abs_path)); |
99 } else { | 101 } else { |
100 NOTREACHED(); | 102 NOTREACHED(); |
101 } | 103 } |
102 | 104 |
103 content::BrowserThread::PostTask( | 105 content::BrowserThread::PostTask( |
104 content::BrowserThread::IO, | 106 content::BrowserThread::IO, |
105 FROM_HERE, | 107 FROM_HERE, |
106 base::Bind( | 108 base::Bind( |
107 &PatchHost::StartProcess, host_, base::Passed(&patch_message))); | 109 &PatchHost::StartProcess, host_, base::Passed(&patch_message))); |
108 } | 110 } |
109 | 111 |
110 } // namespace component_updater | 112 } // namespace component_updater |
OLD | NEW |