From e3a753f17bac62738b0dbf0b36510f767b081e4b Mon Sep 17 00:00:00 2001 From: pasko Date: Wed, 9 Sep 2015 05:56:41 -0700 Subject: [PATCH] cygprofile: increase timeouts to allow showing web contents Also doing a fork() changes thread id (syscall gettid), which breaks the assumptions in cygprofile.cc, disabled a fork in library_prefetcher. Verified: with these changes the instrumented build is able to display the contents of 'https://google.com'. It does not finish loading though, which is probably due to some other timeouts. BUG=503613 Review URL: https://codereview.chromium.org/1325053009 Cr-Commit-Position: refs/heads/master@{#347918} --- base/android/library_loader/library_prefetcher.cc | 7 +++++++ build/common.gypi | 3 ++- content/browser/renderer_host/compositor_impl_android.cc | 5 +++-- content/gpu/gpu_main.cc | 4 ++++ 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/base/android/library_loader/library_prefetcher.cc b/base/android/library_loader/library_prefetcher.cc index 9b54843fc832..118e80cc0e7a 100644 --- a/base/android/library_loader/library_prefetcher.cc +++ b/base/android/library_loader/library_prefetcher.cc @@ -118,6 +118,12 @@ bool NativeLibraryPrefetcher::FindRanges(std::vector* ranges) { // static bool NativeLibraryPrefetcher::ForkAndPrefetchNativeLibrary() { + // Avoid forking with cygprofile instrumentation because the latter performs + // memory allocations. +#if defined(CYGPROFILE_INSTRUMENTATION) + return false; +#endif + // Looking for ranges is done before the fork, to avoid syscalls and/or memory // allocations in the forked process. The child process inherits the lock // state of its parent thread. It cannot rely on being able to acquire any @@ -126,6 +132,7 @@ bool NativeLibraryPrefetcher::ForkAndPrefetchNativeLibrary() { std::vector ranges; if (!FindRanges(&ranges)) return false; + pid_t pid = fork(); if (pid == 0) { setpriority(PRIO_PROCESS, 0, kBackgroundPriority); diff --git a/build/common.gypi b/build/common.gypi index 7900d9449b92..08d1e2a626d6 100644 --- a/build/common.gypi +++ b/build/common.gypi @@ -4634,9 +4634,10 @@ 'cflags': [ '-finstrument-functions', # Allow mmx intrinsics to inline, so that the - #0 compiler can expand the intrinsics. + # compiler can expand the intrinsics. '-finstrument-functions-exclude-file-list=mmintrin.h', ], + 'defines': ['CYGPROFILE_INSTRUMENTATION'], }], ['_toolset=="target" and OS=="android"', { 'cflags': [ diff --git a/content/browser/renderer_host/compositor_impl_android.cc b/content/browser/renderer_host/compositor_impl_android.cc index 146e041d81e9..f4ae15040b22 100644 --- a/content/browser/renderer_host/compositor_impl_android.cc +++ b/content/browser/renderer_host/compositor_impl_android.cc @@ -596,8 +596,9 @@ void CompositorImpl::OnGpuChannelTimeout() { void CompositorImpl::RequestNewOutputSurface() { output_surface_request_pending_ = true; -#if defined(ADDRESS_SANITIZER) || defined(THREAD_SANITIZER) || defined(SYZYASAN) - const int64 kGpuChannelTimeoutInSeconds = 30; +#if defined(ADDRESS_SANITIZER) || defined(THREAD_SANITIZER) || \ + defined(SYZYASAN) || defined(CYGPROFILE_INSTRUMENTATION) + const int64 kGpuChannelTimeoutInSeconds = 40; #else const int64 kGpuChannelTimeoutInSeconds = 10; #endif diff --git a/content/gpu/gpu_main.cc b/content/gpu/gpu_main.cc index 8606afe82cfc..e7ce06e5a26c 100644 --- a/content/gpu/gpu_main.cc +++ b/content/gpu/gpu_main.cc @@ -75,7 +75,11 @@ #include #endif +#if defined(CYGPROFILE_INSTRUMENTATION) +const int kGpuTimeout = 30000; +#else const int kGpuTimeout = 10000; +#endif namespace content { -- 2.11.4.GIT