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

Side by Side Diff: chrome/browser/extensions/api/messaging/native_process_launcher_posix.cc

Issue 845853003: Update chrome/browser/extensions to use the new version of LaunchProcess. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/extensions/api/messaging/native_process_launcher.h" 5 #include "chrome/browser/extensions/api/messaging/native_process_launcher.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/files/scoped_file.h" 9 #include "base/files/scoped_file.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 fd_map.push_back(std::make_pair(write_pipe_read_fd.get(), STDIN_FILENO)); 74 fd_map.push_back(std::make_pair(write_pipe_read_fd.get(), STDIN_FILENO));
75 75
76 base::LaunchOptions options; 76 base::LaunchOptions options;
77 options.fds_to_remap = &fd_map; 77 options.fds_to_remap = &fd_map;
78 78
79 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) 79 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
80 // Don't use no_new_privs mode, e.g. in case the host needs to use sudo. 80 // Don't use no_new_privs mode, e.g. in case the host needs to use sudo.
81 options.allow_new_privs = true; 81 options.allow_new_privs = true;
82 #endif 82 #endif
83 83
84 base::ProcessHandle process_handle; 84 base::Process local_process = base::LaunchProcess(command_line, options);
85 if (!base::LaunchProcess(command_line, options, &process_handle)) { 85 if (!local_process.IsValid()) {
86 LOG(ERROR) << "Error launching process"; 86 LOG(ERROR) << "Error launching process";
87 return false; 87 return false;
88 } 88 }
89 89
90 // We will not be reading from the write pipe, nor writing from the read pipe. 90 // We will not be reading from the write pipe, nor writing from the read pipe.
91 write_pipe_read_fd.reset(); 91 write_pipe_read_fd.reset();
92 read_pipe_write_fd.reset(); 92 read_pipe_write_fd.reset();
93 93
94 *process = base::Process(process_handle); 94 *process = local_process.Pass();
95 *read_file = base::File(read_pipe_read_fd.release()); 95 *read_file = base::File(read_pipe_read_fd.release());
96 *write_file = base::File(write_pipe_write_fd.release()); 96 *write_file = base::File(write_pipe_write_fd.release());
97 97
98 return true; 98 return true;
99 } 99 }
100 100
101 } // namespace extensions 101 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698