summaryrefslogtreecommitdiffstats
path: root/content/browser/zygote_host_linux.cc
diff options
context:
space:
mode:
authorstevenjb@google.com <stevenjb@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-11 20:29:35 +0000
committerstevenjb@google.com <stevenjb@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-11 20:29:35 +0000
commit768e4ff6892503dfbff4d06e7098e751dd28e85b (patch)
treed5eac772aac1bd5655cf4bb1bca4548b1a5bb4bf /content/browser/zygote_host_linux.cc
parent36a787fbe42c40cb491688ed9f3790293859b3ea (diff)
downloadchromium_src-768e4ff6892503dfbff4d06e7098e751dd28e85b.zip
chromium_src-768e4ff6892503dfbff4d06e7098e751dd28e85b.tar.gz
chromium_src-768e4ff6892503dfbff4d06e7098e751dd28e85b.tar.bz2
Enable tcmalloc profiling and heap dump.
BUG=chromium-os:18876 TEST=See issue. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=96054 Review URL: http://codereview.chromium.org/7528016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96444 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/zygote_host_linux.cc')
-rw-r--r--content/browser/zygote_host_linux.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/content/browser/zygote_host_linux.cc b/content/browser/zygote_host_linux.cc
index aea94a59..42ee6da 100644
--- a/content/browser/zygote_host_linux.cc
+++ b/content/browser/zygote_host_linux.cc
@@ -30,6 +30,10 @@
#include "content/common/unix_domain_socket_posix.h"
#include "sandbox/linux/suid/suid_unsafe_environment_variables.h"
+#if defined(USE_TCMALLOC)
+#include "third_party/tcmalloc/chromium/src/google/heap-profiler.h"
+#endif
+
static void SaveSUIDUnsafeEnvironmentVariables() {
// The ELF loader will clear many environment variables so we save them to
// different names here so that the SUID sandbox can resolve them for the
@@ -308,6 +312,13 @@ void ZygoteHost::AdjustRendererOOMScore(base::ProcessHandle pid, int score) {
}
if (using_suid_sandbox_ && !selinux) {
+#if defined(USE_TCMALLOC)
+ // If heap profiling is running, these processes are not exiting, at least
+ // on ChromeOS. The easiest thing to do is not launch them when profiling.
+ // TODO(stevenjb): Investigate further and fix.
+ if (IsHeapProfilerRunning())
+ return;
+#endif
std::vector<std::string> adj_oom_score_cmdline;
adj_oom_score_cmdline.push_back(sandbox_binary_);
adj_oom_score_cmdline.push_back(base::kAdjustOOMScoreSwitch);