| OLD | NEW |
| 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 "base/files/file_path.h" | 5 #include "base/files/file_path.h" |
| 6 #include "base/metrics/field_trial.h" | 6 #include "base/metrics/field_trial.h" |
| 7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "base/win/scoped_handle.h" | 9 #include "base/win/scoped_handle.h" |
| 10 #include "base/win/win_util.h" | 10 #include "base/win/win_util.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 &process.process); | 79 &process.process); |
| 80 return process; | 80 return process; |
| 81 } | 81 } |
| 82 | 82 |
| 83 void ChildProcessLauncherHelper::AfterLaunchOnLauncherThread( | 83 void ChildProcessLauncherHelper::AfterLaunchOnLauncherThread( |
| 84 const ChildProcessLauncherHelper::Process& process, | 84 const ChildProcessLauncherHelper::Process& process, |
| 85 const base::LaunchOptions& options) { | 85 const base::LaunchOptions& options) { |
| 86 DCHECK_CURRENTLY_ON(BrowserThread::PROCESS_LAUNCHER); | 86 DCHECK_CURRENTLY_ON(BrowserThread::PROCESS_LAUNCHER); |
| 87 } | 87 } |
| 88 | 88 |
| 89 // static | |
| 90 base::TerminationStatus ChildProcessLauncherHelper::GetTerminationStatus( | 89 base::TerminationStatus ChildProcessLauncherHelper::GetTerminationStatus( |
| 91 const ChildProcessLauncherHelper::Process& process, | 90 const ChildProcessLauncherHelper::Process& process, |
| 92 bool known_dead, | 91 bool known_dead, |
| 93 int* exit_code) { | 92 int* exit_code) { |
| 94 return base::GetTerminationStatus(process.process.Handle(), exit_code); | 93 return base::GetTerminationStatus(process.process.Handle(), exit_code); |
| 95 } | 94 } |
| 96 | 95 |
| 97 // static | 96 // static |
| 98 bool ChildProcessLauncherHelper::TerminateProcess( | 97 bool ChildProcessLauncherHelper::TerminateProcess( |
| 99 const base::Process& process, int exit_code, bool wait) { | 98 const base::Process& process, int exit_code, bool wait) { |
| 100 return process.Terminate(exit_code, wait); | 99 return process.Terminate(exit_code, wait); |
| 101 } | 100 } |
| 102 | 101 |
| 103 void ChildProcessLauncherHelper::ForceNormalProcessTerminationSync( | 102 void ChildProcessLauncherHelper::ForceNormalProcessTerminationSync( |
| 104 ChildProcessLauncherHelper::Process process) { | 103 ChildProcessLauncherHelper::Process process) { |
| 105 DCHECK_CURRENTLY_ON(BrowserThread::PROCESS_LAUNCHER); | 104 DCHECK_CURRENTLY_ON(BrowserThread::PROCESS_LAUNCHER); |
| 106 // Client has gone away, so just kill the process. Using exit code 0 means | 105 // Client has gone away, so just kill the process. Using exit code 0 means |
| 107 // that UMA won't treat this as a crash. | 106 // that UMA won't treat this as a crash. |
| 108 process.process.Terminate(RESULT_CODE_NORMAL_EXIT, false); | 107 process.process.Terminate(RESULT_CODE_NORMAL_EXIT, false); |
| 109 } | 108 } |
| 110 | 109 |
| 111 // static | |
| 112 void ChildProcessLauncherHelper::SetProcessBackgroundedOnLauncherThread( | 110 void ChildProcessLauncherHelper::SetProcessBackgroundedOnLauncherThread( |
| 113 base::Process process, bool background) { | 111 base::Process process, bool background) { |
| 114 DCHECK_CURRENTLY_ON(BrowserThread::PROCESS_LAUNCHER); | 112 DCHECK_CURRENTLY_ON(BrowserThread::PROCESS_LAUNCHER); |
| 115 if (process.CanBackgroundProcesses()) | 113 if (process.CanBackgroundProcesses()) |
| 116 process.SetProcessBackgrounded(background); | 114 process.SetProcessBackgrounded(background); |
| 117 } | 115 } |
| 118 | 116 |
| 119 // static | 117 // static |
| 120 void ChildProcessLauncherHelper::SetRegisteredFilesForService( | 118 void ChildProcessLauncherHelper::SetRegisteredFilesForService( |
| 121 const std::string& service_name, | 119 const std::string& service_name, |
| 122 catalog::RequiredFileMap required_files) { | 120 catalog::RequiredFileMap required_files) { |
| 123 // No file passing from the manifest on Windows yet. | 121 // No file passing from the manifest on Windows yet. |
| 124 DCHECK(required_files.empty()); | 122 DCHECK(required_files.empty()); |
| 125 } | 123 } |
| 126 | 124 |
| 127 // static | 125 // static |
| 128 void ChildProcessLauncherHelper::ResetRegisteredFilesForTesting() {} | 126 void ChildProcessLauncherHelper::ResetRegisteredFilesForTesting() {} |
| 129 | 127 |
| 130 } // namespace internal | 128 } // namespace internal |
| 131 } // namespace content | 129 } // namespace content |
| OLD | NEW |