OLD | NEW |
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 "content/browser/child_process_launcher.h" | 5 #include "content/browser/child_process_launcher.h" |
6 | 6 |
7 #include <utility> // For std::pair. | 7 #include <utility> // For std::pair. |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 // ref counted object allows us to automatically terminate the process when the | 41 // ref counted object allows us to automatically terminate the process when the |
42 // parent class destructs, while still holding on to state that we need. | 42 // parent class destructs, while still holding on to state that we need. |
43 class ChildProcessLauncher::Context | 43 class ChildProcessLauncher::Context |
44 : public base::RefCountedThreadSafe<ChildProcessLauncher::Context> { | 44 : public base::RefCountedThreadSafe<ChildProcessLauncher::Context> { |
45 public: | 45 public: |
46 Context() | 46 Context() |
47 : client_(NULL), | 47 : client_(NULL), |
48 client_thread_id_(BrowserThread::UI), | 48 client_thread_id_(BrowserThread::UI), |
49 termination_status_(base::TERMINATION_STATUS_NORMAL_TERMINATION), | 49 termination_status_(base::TERMINATION_STATUS_NORMAL_TERMINATION), |
50 exit_code_(content::RESULT_CODE_NORMAL_EXIT), | 50 exit_code_(content::RESULT_CODE_NORMAL_EXIT), |
51 starting_(true), | 51 starting_(true) |
52 terminate_child_on_shutdown_(true) | |
53 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) | 52 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) |
54 , zygote_(false) | 53 , zygote_(false) |
55 #endif | 54 #endif |
56 { | 55 { |
| 56 #if defined(OS_POSIX) |
| 57 terminate_child_on_shutdown_ = !CommandLine::ForCurrentProcess()-> |
| 58 HasSwitch(switches::kRendererCleanExit); |
| 59 #else |
| 60 terminate_child_on_shutdown_ = true; |
| 61 #endif |
57 } | 62 } |
58 | 63 |
59 void Launch( | 64 void Launch( |
60 #if defined(OS_WIN) | 65 #if defined(OS_WIN) |
61 const FilePath& exposed_dir, | 66 const FilePath& exposed_dir, |
62 #elif defined(OS_POSIX) | 67 #elif defined(OS_POSIX) |
63 bool use_zygote, | 68 bool use_zygote, |
64 const base::EnvironmentVector& environ, | 69 const base::EnvironmentVector& environ, |
65 int ipcfd, | 70 int ipcfd, |
66 #endif | 71 #endif |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 base::Bind( | 384 base::Bind( |
380 &ChildProcessLauncher::Context::SetProcessBackgrounded, | 385 &ChildProcessLauncher::Context::SetProcessBackgrounded, |
381 GetHandle(), background)); | 386 GetHandle(), background)); |
382 } | 387 } |
383 | 388 |
384 void ChildProcessLauncher::SetTerminateChildOnShutdown( | 389 void ChildProcessLauncher::SetTerminateChildOnShutdown( |
385 bool terminate_on_shutdown) { | 390 bool terminate_on_shutdown) { |
386 if (context_) | 391 if (context_) |
387 context_->set_terminate_child_on_shutdown(terminate_on_shutdown); | 392 context_->set_terminate_child_on_shutdown(terminate_on_shutdown); |
388 } | 393 } |
OLD | NEW |