Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(492)

Side by Side Diff: chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_runner_win.cc

Issue 2950153002: Improve process launch handle sharing API. (Closed)
Patch Set: Fix Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/safe_browsing/chrome_cleaner/chrome_cleaner_runner_win. h" 5 #include "chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_runner_win. h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/base_paths.h" 9 #include "base/base_paths.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 ChromeCleanerRunner::ProcessStatus 144 ChromeCleanerRunner::ProcessStatus
145 ChromeCleanerRunner::LaunchAndWaitForExitOnBackgroundThread() { 145 ChromeCleanerRunner::LaunchAndWaitForExitOnBackgroundThread() {
146 mojo::edk::OutgoingBrokerClientInvitation invitation; 146 mojo::edk::OutgoingBrokerClientInvitation invitation;
147 std::string mojo_pipe_token = mojo::edk::GenerateRandomToken(); 147 std::string mojo_pipe_token = mojo::edk::GenerateRandomToken();
148 mojo::ScopedMessagePipeHandle mojo_pipe = 148 mojo::ScopedMessagePipeHandle mojo_pipe =
149 invitation.AttachMessagePipe(mojo_pipe_token); 149 invitation.AttachMessagePipe(mojo_pipe_token);
150 cleaner_command_line_.AppendSwitchASCII( 150 cleaner_command_line_.AppendSwitchASCII(
151 chrome_cleaner::kChromeMojoPipeTokenSwitch, mojo_pipe_token); 151 chrome_cleaner::kChromeMojoPipeTokenSwitch, mojo_pipe_token);
152 152
153 mojo::edk::PlatformChannelPair channel; 153 mojo::edk::PlatformChannelPair channel;
154 base::HandlesToInheritVector handles_to_inherit;
155 channel.PrepareToPassClientHandleToChildProcess(&cleaner_command_line_,
156 &handles_to_inherit);
157 base::LaunchOptions launch_options; 154 base::LaunchOptions launch_options;
158 launch_options.handles_to_inherit = &handles_to_inherit; 155 channel.PrepareToPassClientHandleToChildProcess(
156 &cleaner_command_line_, &launch_options.handles_to_inherit);
159 157
160 base::Process cleaner_process = 158 base::Process cleaner_process =
161 g_test_delegate 159 g_test_delegate
162 ? g_test_delegate->LaunchTestProcess(cleaner_command_line_, 160 ? g_test_delegate->LaunchTestProcess(cleaner_command_line_,
163 launch_options) 161 launch_options)
164 : base::LaunchProcess(cleaner_command_line_, launch_options); 162 : base::LaunchProcess(cleaner_command_line_, launch_options);
165 163
166 if (!cleaner_process.IsValid()) 164 if (!cleaner_process.IsValid())
167 return ProcessStatus(LaunchStatus::kLaunchFailed); 165 return ProcessStatus(LaunchStatus::kLaunchFailed);
168 166
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 FROM_HERE, base::BindOnce(std::move(on_process_done_), process_status)); 226 FROM_HERE, base::BindOnce(std::move(on_process_done_), process_status));
229 } 227 }
230 } 228 }
231 229
232 void SetChromeCleanerRunnerTestDelegateForTesting( 230 void SetChromeCleanerRunnerTestDelegateForTesting(
233 ChromeCleanerRunnerTestDelegate* test_delegate) { 231 ChromeCleanerRunnerTestDelegate* test_delegate) {
234 g_test_delegate = test_delegate; 232 g_test_delegate = test_delegate;
235 } 233 }
236 234
237 } // namespace safe_browsing 235 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698