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

Side by Side Diff: chrome/browser/child_process_launcher.cc

Issue 536009: Revert 35888 - Mac: Other approach for IPCing child task_ts.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/browser.cc ('k') | 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/child_process_launcher.h" 5 #include "chrome/browser/child_process_launcher.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/scoped_ptr.h" 9 #include "base/scoped_ptr.h"
10 #include "base/thread.h" 10 #include "base/thread.h"
11 #include "chrome/browser/chrome_thread.h" 11 #include "chrome/browser/chrome_thread.h"
12 #include "chrome/common/chrome_descriptors.h" 12 #include "chrome/common/chrome_descriptors.h"
13 #include "chrome/common/chrome_switches.h" 13 #include "chrome/common/chrome_switches.h"
14 #include "chrome/common/process_watcher.h" 14 #include "chrome/common/process_watcher.h"
15 #include "chrome/common/result_codes.h" 15 #include "chrome/common/result_codes.h"
16 16
17 #if defined(OS_WIN) 17 #if defined(OS_WIN)
18 #include "chrome/browser/sandbox_policy.h" 18 #include "chrome/browser/sandbox_policy.h"
19 #elif defined(OS_LINUX) 19 #elif defined(OS_LINUX)
20 #include "base/singleton.h" 20 #include "base/singleton.h"
21 #include "chrome/browser/crash_handler_host_linux.h" 21 #include "chrome/browser/crash_handler_host_linux.h"
22 #include "chrome/browser/zygote_host_linux.h" 22 #include "chrome/browser/zygote_host_linux.h"
23 #include "chrome/browser/renderer_host/render_sandbox_host_linux.h" 23 #include "chrome/browser/renderer_host/render_sandbox_host_linux.h"
24 #endif 24 #endif
25 25
26 #if defined(OS_MACOSX)
27 #include "chrome/browser/mach_broker_mac.h"
28 #endif
29
30 #if defined(OS_POSIX) 26 #if defined(OS_POSIX)
31 #include "base/global_descriptors_posix.h" 27 #include "base/global_descriptors_posix.h"
32 #endif 28 #endif
33 29
34 // Having the functionality of ChildProcessLauncher be in an internal 30 // Having the functionality of ChildProcessLauncher be in an internal
35 // ref counted object allows us to automatically terminate the process when the 31 // ref counted object allows us to automatically terminate the process when the
36 // parent class destructs, while still holding on to state that we need. 32 // parent class destructs, while still holding on to state that we need.
37 class ChildProcessLauncher::Context 33 class ChildProcessLauncher::Context
38 : public base::RefCountedThreadSafe<ChildProcessLauncher::Context> { 34 : public base::RefCountedThreadSafe<ChildProcessLauncher::Context> {
39 public: 35 public:
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 Singleton<RenderSandboxHostLinux>()->GetRendererSocket(); 156 Singleton<RenderSandboxHostLinux>()->GetRendererSocket();
161 fds_to_map.push_back(std::make_pair( 157 fds_to_map.push_back(std::make_pair(
162 sandbox_fd, 158 sandbox_fd,
163 kSandboxIPCChannel + base::GlobalDescriptors::kBaseDescriptor)); 159 kSandboxIPCChannel + base::GlobalDescriptors::kBaseDescriptor));
164 } 160 }
165 #endif // defined(OS_LINUX) 161 #endif // defined(OS_LINUX)
166 162
167 // Actually launch the app. 163 // Actually launch the app.
168 if (!base::LaunchApp(cmd_line->argv(), env, fds_to_map, false, &handle)) 164 if (!base::LaunchApp(cmd_line->argv(), env, fds_to_map, false, &handle))
169 handle = base::kNullProcessHandle; 165 handle = base::kNullProcessHandle;
170
171
172 #if defined(OS_MACOSX)
173 task_t foobar(pid_t pid);
174 MachBroker::instance()->RegisterPid(
175 handle,
176 MachBroker::MachInfo().SetTask(foobar(handle)));
177 #endif
178 } 166 }
179 #endif 167 #endif
180 168
181 ChromeThread::PostTask( 169 ChromeThread::PostTask(
182 client_thread_id_, FROM_HERE, 170 client_thread_id_, FROM_HERE,
183 NewRunnableMethod( 171 NewRunnableMethod(
184 this, 172 this,
185 &ChildProcessLauncher::Context::Notify, 173 &ChildProcessLauncher::Context::Notify,
186 #if defined(OS_LINUX) 174 #if defined(OS_LINUX)
187 zygote, 175 zygote,
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 if (child_exited) 303 if (child_exited)
316 context_->process_.Close(); 304 context_->process_.Close();
317 305
318 return did_crash; 306 return did_crash;
319 } 307 }
320 308
321 void ChildProcessLauncher::SetProcessBackgrounded(bool background) { 309 void ChildProcessLauncher::SetProcessBackgrounded(bool background) {
322 DCHECK(!context_->starting_); 310 DCHECK(!context_->starting_);
323 context_->process_.SetProcessBackgrounded(background); 311 context_->process_.SetProcessBackgrounded(background);
324 } 312 }
OLDNEW
« no previous file with comments | « chrome/browser/browser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698