OLD | NEW |
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/common/child_process_host.h" | 5 #include "chrome/common/child_process_host.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 Singleton<ChildProcessList>::get()->remove(this); | 78 Singleton<ChildProcessList>::get()->remove(this); |
79 | 79 |
80 resource_dispatcher_host_->CancelRequestsForProcess(id()); | 80 resource_dispatcher_host_->CancelRequestsForProcess(id()); |
81 | 81 |
82 if (handle()) | 82 if (handle()) |
83 ProcessWatcher::EnsureProcessTerminated(handle()); | 83 ProcessWatcher::EnsureProcessTerminated(handle()); |
84 } | 84 } |
85 | 85 |
86 // static | 86 // static |
87 FilePath ChildProcessHost::GetChildPath() { | 87 FilePath ChildProcessHost::GetChildPath() { |
88 static FilePath child_path; | 88 FilePath child_path; |
89 | |
90 if (!child_path.empty()) | |
91 return child_path; | |
92 | 89 |
93 child_path = CommandLine::ForCurrentProcess()->GetSwitchValuePath( | 90 child_path = CommandLine::ForCurrentProcess()->GetSwitchValuePath( |
94 switches::kBrowserSubprocessPath); | 91 switches::kBrowserSubprocessPath); |
95 if (!child_path.empty()) | 92 if (!child_path.empty()) |
96 return child_path; | 93 return child_path; |
97 | 94 |
98 #if !defined(OS_MACOSX) | 95 #if !defined(OS_MACOSX) |
99 // On most platforms, the child executable is the same as the current | 96 // On most platforms, the child executable is the same as the current |
100 // executable. | 97 // executable. |
101 PathService::Get(base::FILE_EXE, &child_path); | 98 PathService::Get(base::FILE_EXE, &child_path); |
102 #else | 99 #else |
103 // On the Mac, the child executable lives at a predefined location within | 100 // On the Mac, the child executable lives at a predefined location within |
104 // the app bundle's versioned directory. | 101 // the app bundle's versioned directory. |
105 child_path = chrome::GetVersionedDirectory().Append( | 102 child_path = chrome::GetVersionedDirectory(). |
106 FilePath::FromWStringHack(chrome::kHelperProcessExecutablePath)); | 103 Append(chrome::kHelperProcessExecutablePath); |
107 #endif // OS_MACOSX | 104 #endif // OS_MACOSX |
108 | 105 |
109 return child_path; | 106 return child_path; |
110 } | 107 } |
111 | 108 |
112 // static | 109 // static |
113 void ChildProcessHost::SetCrashReporterCommandLine(CommandLine* command_line) { | 110 void ChildProcessHost::SetCrashReporterCommandLine(CommandLine* command_line) { |
114 #if defined(USE_LINUX_BREAKPAD) | 111 #if defined(USE_LINUX_BREAKPAD) |
115 const bool unattended = (getenv("CHROME_HEADLESS") != NULL); | 112 const bool unattended = (getenv("CHROME_HEADLESS") != NULL); |
116 if (unattended || GoogleUpdateSettings::GetCollectStatsConsent()) { | 113 if (unattended || GoogleUpdateSettings::GetCollectStatsConsent()) { |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 | 269 |
273 return *iterator_; | 270 return *iterator_; |
274 } while (true); | 271 } while (true); |
275 | 272 |
276 return NULL; | 273 return NULL; |
277 } | 274 } |
278 | 275 |
279 bool ChildProcessHost::Iterator::Done() { | 276 bool ChildProcessHost::Iterator::Done() { |
280 return iterator_ == Singleton<ChildProcessList>::get()->end(); | 277 return iterator_ == Singleton<ChildProcessList>::get()->end(); |
281 } | 278 } |
OLD | NEW |