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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/zygote_manager.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/test/chrome_process_util.h" 5 #include "chrome/test/chrome_process_util.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/process_util.h" 9 #include "base/process_util.h"
10 #include "base/time.h" 10 #include "base/time.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 base::CloseProcessHandle(*it); 70 base::CloseProcessHandle(*it);
71 } 71 }
72 72
73 ChromeProcessList GetRunningChromeProcesses(const FilePath& data_dir) { 73 ChromeProcessList GetRunningChromeProcesses(const FilePath& data_dir) {
74 ChromeProcessList result; 74 ChromeProcessList result;
75 75
76 base::ProcessId browser_pid = ChromeBrowserProcessId(data_dir); 76 base::ProcessId browser_pid = ChromeBrowserProcessId(data_dir);
77 if (browser_pid < 0) 77 if (browser_pid < 0)
78 return result; 78 return result;
79 79
80 ChromeProcessFilter filter(browser_pid); 80 // Normally, the browser is the parent process for all the renderers
81 base::ProcessId parent_pid = browser_pid;
82
83 #if defined(OS_LINUX)
84 // But if the browser's parent is the same executable as the browser,
85 // then it's the zygote manager, and it's the parent for all the renderers.
86 base::ProcessId manager_pid = base::GetParentProcessId(browser_pid);
87 FilePath selfPath = base::GetProcessExecutablePath(browser_pid);
88 FilePath managerPath = base::GetProcessExecutablePath(manager_pid);
89 if (!selfPath.empty() && !managerPath.empty() && selfPath == managerPath) {
90 LOG(INFO) << "Zygote manager in use.";
91 parent_pid = manager_pid;
92 }
93 #endif
94
95 ChromeProcessFilter filter(parent_pid);
81 base::NamedProcessIterator it(chrome::kBrowserProcessExecutableName, &filter); 96 base::NamedProcessIterator it(chrome::kBrowserProcessExecutableName, &filter);
82 97
83 const ProcessEntry* process_entry; 98 const ProcessEntry* process_entry;
84 while ((process_entry = it.NextProcessEntry())) { 99 while ((process_entry = it.NextProcessEntry())) {
85 #if defined(OS_WIN) 100 #if defined(OS_WIN)
86 result.push_back(process_entry->th32ProcessID); 101 result.push_back(process_entry->th32ProcessID);
102 #elif defined(OS_LINUX)
103 // Don't count the zygote manager, that screws up unit tests,
104 // and it will exit cleanly on its own when first client exits.
105 if (process_entry->pid != manager_pid)
106 result.push_back(process_entry->pid);
87 #elif defined(OS_POSIX) 107 #elif defined(OS_POSIX)
88 result.push_back(process_entry->pid); 108 result.push_back(process_entry->pid);
89 #endif 109 #endif
90 } 110 }
91 111
92 return result; 112 return result;
93 } 113 }
OLDNEW
« 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