diff options
-rw-r--r-- | chrome/browser/browser_process_impl.cc | 6 | ||||
-rw-r--r-- | chrome/browser/metrics/thread_watcher.cc | 19 | ||||
-rw-r--r-- | chrome/browser/metrics/thread_watcher.h | 3 | ||||
-rw-r--r-- | tools/valgrind/memcheck/suppressions.txt | 27 |
4 files changed, 15 insertions, 40 deletions
diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc index ca2f048..21d502e 100644 --- a/chrome/browser/browser_process_impl.cc +++ b/chrome/browser/browser_process_impl.cc @@ -225,6 +225,9 @@ BrowserProcessImpl::~BrowserProcessImpl() { // processes so this has to happen before stopping the IO thread. GpuProcessHostUIShim::DestroyAll(); + // Stop the watchdog thread before stopping other threads. + watchdog_thread_.reset(); + // Need to stop io_thread_ before resource_dispatcher_host_, since // io_thread_ may still deref ResourceDispatcherHost and handle resource // request before going away. @@ -267,9 +270,6 @@ BrowserProcessImpl::~BrowserProcessImpl() { // Now OK to destroy NotificationService. main_notification_service_.reset(); - // Stop the watchdog thread after stopping other threads. - watchdog_thread_.reset(); - g_browser_process = NULL; } diff --git a/chrome/browser/metrics/thread_watcher.cc b/chrome/browser/metrics/thread_watcher.cc index 2b0da7e..536402d 100644 --- a/chrome/browser/metrics/thread_watcher.cc +++ b/chrome/browser/metrics/thread_watcher.cc @@ -2,13 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "chrome/browser/metrics/thread_watcher.h" + #include <math.h> // ceil +#include "base/debug/alias.h" #include "base/string_tokenizer.h" #include "base/threading/thread_restrictions.h" #include "build/build_config.h" #include "chrome/browser/metrics/metrics_service.h" -#include "chrome/browser/metrics/thread_watcher.h" #include "chrome/common/chrome_switches.h" #include "content/common/notification_service.h" @@ -29,6 +31,7 @@ ThreadWatcher::ThreadWatcher(const BrowserThread::ID& thread_id, uint32 live_threads_threshold) : thread_id_(thread_id), thread_name_(thread_name), + watched_loop_(BrowserThread::GetMessageLoopProxyForThread(thread_id)), sleep_time_(sleep_time), unresponsive_time_(unresponsive_time), ping_time_(base::TimeTicks::Now()), @@ -141,8 +144,7 @@ void ThreadWatcher::PostPingMessage() { // Send a ping message to the watched thread. Task* callback_task = method_factory_.NewRunnableMethod( &ThreadWatcher::OnPongMessage, ping_sequence_number_); - if (BrowserThread::PostTask( - thread_id(), + if (watched_loop_->PostTask( FROM_HERE, NewRunnableFunction( &ThreadWatcher::OnPingMessage, thread_id_, callback_task))) { @@ -292,10 +294,10 @@ void ThreadWatcher::GotNoResponse() { // Crash the browser if the watched thread is to be crashed on hang and if the // number of other threads responding is equal to live_threads_threshold_. - if (crash_on_hang_ && responding_thread_count == live_threads_threshold_) { - int* crash = NULL; - CHECK(crash + thread_id_); - } + int thread_id = thread_id_; + base::debug::Alias(&thread_id); + if (crash_on_hang_ && responding_thread_count == live_threads_threshold_) + CHECK(false); hung_processing_complete_ = true; } @@ -486,9 +488,6 @@ void ThreadWatcherList::StartWatching( uint32 live_threads_threshold) { DCHECK(WatchDogThread::CurrentlyOnWatchDogThread()); - if (!BrowserThread::IsMessageLoopValid(thread_id)) - return; - std::set<std::string>::const_iterator it = crash_on_hang_thread_names.find(thread_name); bool crash_on_hang = (it != crash_on_hang_thread_names.end()); diff --git a/chrome/browser/metrics/thread_watcher.h b/chrome/browser/metrics/thread_watcher.h index a53316c..a66a837 100644 --- a/chrome/browser/metrics/thread_watcher.h +++ b/chrome/browser/metrics/thread_watcher.h @@ -199,6 +199,9 @@ class ThreadWatcher { // The name of the thread being watched. const std::string thread_name_; + // Used to post messages to watched thread. + scoped_refptr<base::MessageLoopProxy> watched_loop_; + // It is the sleep time between the receipt of a pong message back, and the // sending of another ping message. const base::TimeDelta sleep_time_; diff --git a/tools/valgrind/memcheck/suppressions.txt b/tools/valgrind/memcheck/suppressions.txt index 7a295aa..fb9485f 100644 --- a/tools/valgrind/memcheck/suppressions.txt +++ b/tools/valgrind/memcheck/suppressions.txt @@ -4397,33 +4397,6 @@ fun:_ZN11TabContents15NavigateToEntryERK15NavigationEntryN20NavigationController10ReloadTypeE } { - bug_83343 - Memcheck:Leak - fun:_Znw* - ... - fun:_ZN13ThreadWatcher13StartWatchingERKN13BrowserThread2IDERKSsRKN4base9TimeDeltaES9_ - fun:_ZN17ThreadWatcherList16StartWatchingAllEv - fun:_Z18DispatchToFunctionIPFvvEEvT_RK6Tuple0 - fun:_ZN16RunnableFunctionIPFvvE6Tuple0E3RunEv - fun:_ZN12_GLOBAL__N_118TaskClosureAdapter3RunEv - fun:_ZN4base8internal8Invoker1ILb0ENS0_15InvokerStorage1IMN12_GLOBAL__N_118TaskClosureAdapterEFvvEPS4_EES6_E8DoInvokeEPNS0_18InvokerStorageBaseE - fun:_ZNK4base8CallbackIFvvEE3RunEv - fun:_ZN11MessageLoop7RunTaskERKNS_11PendingTaskE -} -{ - bug_83430 - Memcheck:Leak - fun:_Znw* - fun:*NewRunnable* - fun:_ZN13ThreadWatcher15PostPingMessageEv - fun:_Z16DispatchToMethodI13ThreadWatcherMS0_FvvEEvPT_T0_RK6Tuple0 - fun:_ZN27ScopedRunnableMethodFactoryI13ThreadWatcherE14RunnableMethodIMS0_FvvE6Tuple0E3RunEv - fun:_ZN12_GLOBAL__N_118TaskClosureAdapter3RunEv - fun:_ZN4base8internal8Invoker1ILb0ENS0_15InvokerStorage1IMN12_GLOBAL__N_118TaskClosureAdapterEFvvEPS4_EES6_E8DoInvokeEPNS0_18InvokerStorageBaseE - fun:_ZNK4base8CallbackIFvvEE3RunEv - fun:_ZN11MessageLoop7RunTaskERKNS_11PendingTaskE -} -{ bug_83566 Memcheck:Addr4 fun:_ZN7WebCore*V8Entr*Callback11handleEvent* |