diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-16 03:10:07 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-16 03:10:07 +0000 |
commit | 9742508529581c44056a836d10fa6cfd76ecca7b (patch) | |
tree | 6097ddf43758a19f18edf4c02b55d89616c90310 /base | |
parent | 6df6ec02bbb09f5c81e4bf9189bd7237eb2c4e1f (diff) | |
download | chromium_src-9742508529581c44056a836d10fa6cfd76ecca7b.zip chromium_src-9742508529581c44056a836d10fa6cfd76ecca7b.tar.gz chromium_src-9742508529581c44056a836d10fa6cfd76ecca7b.tar.bz2 |
Remove USE_LINUX_BREAKPAD ifdef since we don't need it for chromium anymore.
See thread "[chromium-dev] PSA: Breakpad is now compiled into
Chromium by default on Linux' for background
TBR=sbc@chromium.org, thakis@chromium.org, thestig@chromium.org
Review URL: https://codereview.chromium.org/18770006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@211755 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/process/memory.h | 6 | ||||
-rw-r--r-- | base/process/memory_linux.cc | 4 | ||||
-rw-r--r-- | base/process_util_linux.cc | 51 |
3 files changed, 53 insertions, 8 deletions
diff --git a/base/process/memory.h b/base/process/memory.h index d115a81..2ad1e50 100644 --- a/base/process/memory.h +++ b/base/process/memory.h @@ -31,10 +31,6 @@ BASE_EXPORT void EnableTerminationOnHeapCorruption(); // Turns on process termination if memory runs out. BASE_EXPORT void EnableTerminationOnOutOfMemory(); -#if defined(USE_LINUX_BREAKPAD) -BASE_EXPORT extern size_t g_oom_size; -#endif - #if defined(OS_WIN) // Returns the module handle to which an address belongs. The reference count // of the module is not incremented. @@ -42,6 +38,8 @@ BASE_EXPORT HMODULE GetModuleFromAddress(void* address); #endif #if defined(OS_LINUX) || defined(OS_ANDROID) +BASE_EXPORT extern size_t g_oom_size; + // The maximum allowed value for the OOM score. const int kMaxOomScore = 1000; diff --git a/base/process/memory_linux.cc b/base/process/memory_linux.cc index ac43042..f81429b 100644 --- a/base/process/memory_linux.cc +++ b/base/process/memory_linux.cc @@ -14,16 +14,12 @@ namespace base { -#if defined(USE_LINUX_BREAKPAD) size_t g_oom_size = 0U; -#endif namespace { void OnNoMemorySize(size_t size) { -#if defined(USE_LINUX_BREAKPAD) g_oom_size = size; -#endif if (size != 0) LOG(FATAL) << "Out of memory, size = " << size; diff --git a/base/process_util_linux.cc b/base/process_util_linux.cc new file mode 100644 index 0000000..b76f8c1 --- /dev/null +++ b/base/process_util_linux.cc @@ -0,0 +1,51 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "base/process_util.h" + +#include <dirent.h> +#include <malloc.h> +#include <sys/time.h> +#include <sys/types.h> +#include <unistd.h> + +#include "base/file_util.h" +#include "base/logging.h" +#include "base/process/internal_linux.h" +#include "base/strings/string_number_conversions.h" +#include "base/strings/string_split.h" +#include "base/strings/string_util.h" +#include "base/sys_info.h" +#include "base/threading/thread_restrictions.h" + +namespace base { + +size_t g_oom_size = 0U; + +const char kProcSelfExe[] = "/proc/self/exe"; + +ProcessId GetParentProcessId(ProcessHandle process) { + ProcessId pid = + internal::ReadProcStatsAndGetFieldAsInt(process, internal::VM_PPID); + if (pid) + return pid; + return -1; +} + +FilePath GetProcessExecutablePath(ProcessHandle process) { + FilePath stat_file = internal::GetProcPidDir(process).Append("exe"); + FilePath exe_name; + if (!file_util::ReadSymbolicLink(stat_file, &exe_name)) { + // No such process. Happens frequently in e.g. TerminateAllChromeProcesses + return FilePath(); + } + return exe_name; +} + +int GetNumberOfThreads(ProcessHandle process) { + return internal::ReadProcStatsAndGetFieldAsInt(process, + internal::VM_NUMTHREADS); +} + +} // namespace base |