diff options
author | Steve Block <steveblock@google.com> | 2011-10-06 15:04:07 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2011-10-07 15:01:12 +0100 |
commit | 28480d4f48373da735986b2a75e099d3cfddab3e (patch) | |
tree | 571364963e8fdb229661a67dc8b095498633f5e8 /base | |
parent | 9306e92a0b28f7c70a3e29272141b0e271452479 (diff) | |
download | external_chromium-28480d4f48373da735986b2a75e099d3cfddab3e.zip external_chromium-28480d4f48373da735986b2a75e099d3cfddab3e.tar.gz external_chromium-28480d4f48373da735986b2a75e099d3cfddab3e.tar.bz2 |
Add more logging to Thread and WaitableEvent to help debugging
Bug: 5244039
Change-Id: I385642faf33ec9f3875cfd035c9500e7342ca17d
Diffstat (limited to 'base')
-rw-r--r-- | base/synchronization/waitable_event_posix.cc | 9 | ||||
-rw-r--r-- | base/threading/thread.cc | 27 |
2 files changed, 36 insertions, 0 deletions
diff --git a/base/synchronization/waitable_event_posix.cc b/base/synchronization/waitable_event_posix.cc index ae03ead..640026b 100644 --- a/base/synchronization/waitable_event_posix.cc +++ b/base/synchronization/waitable_event_posix.cc @@ -150,7 +150,16 @@ class SyncWaiter : public WaitableEvent::Waiter { }; bool WaitableEvent::Wait() { +#if defined(ANDROID) + // For debugging. See http://b/5244039 + bool result = TimedWait(TimeDelta::FromSeconds(-1)); + if (!result) { + LOG(INFO) << "TimedWait() with infinite timeout should never fail!"; + } + return result; +#else return TimedWait(TimeDelta::FromSeconds(-1)); +#endif } bool WaitableEvent::TimedWait(const TimeDelta& max_time) { diff --git a/base/threading/thread.cc b/base/threading/thread.cc index cf5fc45..2f10adf 100644 --- a/base/threading/thread.cc +++ b/base/threading/thread.cc @@ -69,6 +69,12 @@ bool Thread::StartWithOptions(const Options& options) { SetThreadWasQuitProperly(false); StartupData startup_data(options); +#if defined(ANDROID) + // For debugging. See http://b/5244039 + LOG(INFO) << "StartWithOptions() created startup_data, this=" << this + << ", startup_data.event.IsSignaled()=" + << startup_data.event.IsSignaled(); +#endif startup_data_ = &startup_data; if (!PlatformThread::Create(options.stack_size, this, &thread_)) { @@ -83,11 +89,20 @@ bool Thread::StartWithOptions(const Options& options) { } // Wait for the thread to start and initialize message_loop_ +#if defined(ANDROID) + // For debugging. See http://b/5244039 + LOG(INFO) << "StartWithOptions() waiting for thread to start, this=" << this + << ", startup_data.event.IsSignaled()=" + << startup_data.event.IsSignaled(); +#endif startup_data.event.Wait(); // set it to NULL so we don't keep a pointer to some object on the stack. #if defined(ANDROID) // For debugging. See http://b/5244039 + LOG(INFO) << "StartWithOptions() clearing startup_data_, this=" << this + << ", startup_data.event.IsSignaled()=" + << startup_data.event.IsSignaled(); startup_data_ = reinterpret_cast<StartupData*>(0xbbadbeef); #else startup_data_ = NULL; @@ -152,6 +167,12 @@ bool Thread::GetThreadWasQuitProperly() { void Thread::ThreadMain() { { +#if defined(ANDROID) + // For debugging. See http://b/5244039 + LOG(INFO) << "ThreadMain() starting, this=" << this + << ", startup_data_->event.IsSignaled()=" + << startup_data_->event.IsSignaled(); +#endif // The message loop for this thread. MessageLoop message_loop(startup_data_->options.message_loop_type); @@ -167,6 +188,12 @@ void Thread::ThreadMain() { // Let's do this before signaling we are started. Init(); +#if defined(ANDROID) + // For debugging. See http://b/5244039 + LOG(INFO) << "ThreadMain() signalling, this=" << this + << ", startup_data_->event.IsSignaled()=" + << startup_data_->event.IsSignaled(); +#endif startup_data_->event.Signal(); // startup_data_ can't be touched anymore since the starting thread is now // unlocked. |