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

Unified Diff: chrome/test/chrome_process_util.cc

Issue 119289: Enable zygote manager by default. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/zygote_manager.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/chrome_process_util.cc
===================================================================
--- chrome/test/chrome_process_util.cc (revision 17847)
+++ chrome/test/chrome_process_util.cc (working copy)
@@ -77,13 +77,33 @@
if (browser_pid < 0)
return result;
- ChromeProcessFilter filter(browser_pid);
+ // Normally, the browser is the parent process for all the renderers
+ base::ProcessId parent_pid = browser_pid;
+
+#if defined(OS_LINUX)
+ // But if the browser's parent is the same executable as the browser,
+ // then it's the zygote manager, and it's the parent for all the renderers.
+ base::ProcessId manager_pid = base::GetParentProcessId(browser_pid);
+ FilePath selfPath = base::GetProcessExecutablePath(browser_pid);
+ FilePath managerPath = base::GetProcessExecutablePath(manager_pid);
+ if (!selfPath.empty() && !managerPath.empty() && selfPath == managerPath) {
+ LOG(INFO) << "Zygote manager in use.";
+ parent_pid = manager_pid;
+ }
+#endif
+
+ ChromeProcessFilter filter(parent_pid);
base::NamedProcessIterator it(chrome::kBrowserProcessExecutableName, &filter);
const ProcessEntry* process_entry;
while ((process_entry = it.NextProcessEntry())) {
#if defined(OS_WIN)
result.push_back(process_entry->th32ProcessID);
+#elif defined(OS_LINUX)
+ // Don't count the zygote manager, that screws up unit tests,
+ // and it will exit cleanly on its own when first client exits.
+ if (process_entry->pid != manager_pid)
+ result.push_back(process_entry->pid);
#elif defined(OS_POSIX)
result.push_back(process_entry->pid);
#endif
« no previous file with comments | « base/zygote_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698