summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormnaganov@chromium.org <mnaganov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-19 01:35:07 +0000
committermnaganov@chromium.org <mnaganov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-19 01:35:07 +0000
commita2f57e2cbfffa257ef542aa44807ee5d616cd15d (patch)
tree1d7c36c4f9a399d21acc1e4847e29e25adf73f0d
parent7484f69f0abf650342a963424d3a6874483e9a17 (diff)
downloadchromium_src-a2f57e2cbfffa257ef542aa44807ee5d616cd15d.zip
chromium_src-a2f57e2cbfffa257ef542aa44807ee5d616cd15d.tar.gz
chromium_src-a2f57e2cbfffa257ef542aa44807ee5d616cd15d.tar.bz2
Enable DMP for system Chromium WebView on Android
A couple of tweaks are needed in order to enable compiling inside the Android tree. Review URL: https://chromiumcodereview.appspot.com/18314006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@212490 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--android_webview/android_webview.gyp9
-rw-r--r--base/allocator/allocator.gyp5
-rwxr-xr-xbuild/android/envsetup_functions.sh5
-rw-r--r--third_party/tcmalloc/chromium/src/base/linux_syscall_support.h2
-rw-r--r--third_party/tcmalloc/chromium/src/heap-profiler.cc2
-rw-r--r--third_party/tcmalloc/chromium/src/libc_override_gcc_and_weak.h5
-rw-r--r--third_party/tcmalloc/chromium/src/malloc_hook_mmap_linux.h2
7 files changed, 29 insertions, 1 deletions
diff --git a/android_webview/android_webview.gyp b/android_webview/android_webview.gyp
index 90a134c..68669ce 100644
--- a/android_webview/android_webview.gyp
+++ b/android_webview/android_webview.gyp
@@ -16,6 +16,15 @@
'dependencies': [
'android_webview_common',
],
+ 'conditions': [
+ # The general approach is to allow the executable target to choose
+ # the allocator, but as in the WebView case we are building a library
+ # only, put the dependency on the allocator here
+ [ 'android_webview_build==1 and android_use_tcmalloc==1', {
+ 'dependencies': [
+ '../base/allocator/allocator.gyp:allocator', ],
+ }],
+ ],
'ldflags': [
# fix linking to hidden symbols and re-enable this (crbug.com/157326)
'-Wl,--no-fatal-warnings'
diff --git a/base/allocator/allocator.gyp b/base/allocator/allocator.gyp
index 4febed2..ef98d09 100644
--- a/base/allocator/allocator.gyp
+++ b/base/allocator/allocator.gyp
@@ -429,6 +429,11 @@
'-Wl,-u_ZN15HeapLeakChecker12IgnoreObjectEPKv,-u_ZN15HeapLeakChecker14UnIgnoreObjectEPKv',
]},
}],
+ # Need to distinguish a non-SDK build for Android WebView
+ # due to differences in C include files.
+ ['OS=="android" and android_webview_build==1', {
+ 'defines': ['ANDROID_NON_SDK_BUILD'],
+ }],
[ 'use_vtable_verify==1', {
'cflags': [
'-fvtable-verify=preinit',
diff --git a/build/android/envsetup_functions.sh b/build/android/envsetup_functions.sh
index 55f7b55d..d1a894b 100755
--- a/build/android/envsetup_functions.sh
+++ b/build/android/envsetup_functions.sh
@@ -297,6 +297,11 @@ ${ANDROID_SDK_VERSION}
DEFINES+=" android_sdk_tools=\$(PWD)/${ANDROID_SDK_TOOLS}"
DEFINES+=" android_sdk_version=${ANDROID_SDK_VERSION}"
DEFINES+=" android_toolchain=${ANDROID_TOOLCHAIN}"
+ if [[ -n "$CHROME_ANDROID_WEBVIEW_ENABLE_DMPROF" ]]; then
+ DEFINES+=" disable_debugallocation=1"
+ DEFINES+=" android_full_debug=1"
+ DEFINES+=" android_use_tcmalloc=1"
+ fi
export GYP_DEFINES="${DEFINES}"
export GYP_GENERATORS="android"
diff --git a/third_party/tcmalloc/chromium/src/base/linux_syscall_support.h b/third_party/tcmalloc/chromium/src/base/linux_syscall_support.h
index bdbc4b7..ac1e797 100644
--- a/third_party/tcmalloc/chromium/src/base/linux_syscall_support.h
+++ b/third_party/tcmalloc/chromium/src/base/linux_syscall_support.h
@@ -157,7 +157,9 @@ extern "C" {
#include <sys/types.h>
#if defined(__ANDROID__)
#include <sys/syscall.h>
+#ifndef ANDROID_NON_SDK_BUILD
#include <sys/linux-syscalls.h>
+#endif
#else
#include <syscall.h>
#endif
diff --git a/third_party/tcmalloc/chromium/src/heap-profiler.cc b/third_party/tcmalloc/chromium/src/heap-profiler.cc
index 0b07a5e..eb993a5 100644
--- a/third_party/tcmalloc/chromium/src/heap-profiler.cc
+++ b/third_party/tcmalloc/chromium/src/heap-profiler.cc
@@ -654,7 +654,7 @@ static void HeapProfilerInit() {
return;
}
// We do a uid check so we don't write out files in a setuid executable.
-#ifdef HAVE_GETEUID
+#if !defined(__ANDROID__) && defined(HAVE_GETEUID)
if (getuid() != geteuid()) {
RAW_LOG(WARNING, ("HeapProfiler: ignoring " HEAPPROFILE " because "
"program seems to be setuid\n"));
diff --git a/third_party/tcmalloc/chromium/src/libc_override_gcc_and_weak.h b/third_party/tcmalloc/chromium/src/libc_override_gcc_and_weak.h
index 3b858ca..feefe0c 100644
--- a/third_party/tcmalloc/chromium/src/libc_override_gcc_and_weak.h
+++ b/third_party/tcmalloc/chromium/src/libc_override_gcc_and_weak.h
@@ -94,7 +94,12 @@ extern "C" {
struct mallinfo mallinfo(void) __THROW ALIAS(tc_mallinfo);
#endif
size_t malloc_size(void* p) __THROW ALIAS(tc_malloc_size);
+#if defined(__ANDROID__) && defined(ANDROID_NON_SDK_BUILD)
+ // In Android tree this function is defined differently than in the NDK.
+ size_t malloc_usable_size(const void* p) __THROW ALIAS(tc_malloc_size);
+#else
size_t malloc_usable_size(void* p) __THROW ALIAS(tc_malloc_size);
+#endif
} // extern "C"
#undef ALIAS
diff --git a/third_party/tcmalloc/chromium/src/malloc_hook_mmap_linux.h b/third_party/tcmalloc/chromium/src/malloc_hook_mmap_linux.h
index 9bdcf5a..ee36efb 100644
--- a/third_party/tcmalloc/chromium/src/malloc_hook_mmap_linux.h
+++ b/third_party/tcmalloc/chromium/src/malloc_hook_mmap_linux.h
@@ -42,7 +42,9 @@
#include <unistd.h>
#if defined(__ANDROID__)
#include <sys/syscall.h>
+#ifndef ANDROID_NON_SDK_BUILD
#include <sys/linux-syscalls.h>
+#endif
#else
#include <syscall.h>
#endif