OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <math.h> | 5 #include <math.h> |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 void WaitForSetUp(TimeDelta wait_time) { | 294 void WaitForSetUp(TimeDelta wait_time) { |
295 DCHECK(!WatchDogThread::CurrentlyOnWatchDogThread()); | 295 DCHECK(!WatchDogThread::CurrentlyOnWatchDogThread()); |
296 TimeTicks end_time = TimeTicks::Now() + wait_time; | 296 TimeTicks end_time = TimeTicks::Now() + wait_time; |
297 { | 297 { |
298 base::AutoLock auto_lock(lock_); | 298 base::AutoLock auto_lock(lock_); |
299 while (!initialized_ && TimeTicks::Now() < end_time) | 299 while (!initialized_ && TimeTicks::Now() < end_time) |
300 setup_complete_.TimedWait(end_time - TimeTicks::Now()); | 300 setup_complete_.TimedWait(end_time - TimeTicks::Now()); |
301 } | 301 } |
302 } | 302 } |
303 | 303 |
304 virtual ~ThreadWatcherTest() { | 304 ~ThreadWatcherTest() override { |
305 ThreadWatcherList::DeleteAll(); | 305 ThreadWatcherList::DeleteAll(); |
306 io_watcher_ = NULL; | 306 io_watcher_ = NULL; |
307 db_watcher_ = NULL; | 307 db_watcher_ = NULL; |
308 io_thread_.reset(); | 308 io_thread_.reset(); |
309 db_thread_.reset(); | 309 db_thread_.reset(); |
310 watchdog_thread_.reset(); | 310 watchdog_thread_.reset(); |
311 thread_watcher_list_ = NULL; | 311 thread_watcher_list_ = NULL; |
312 } | 312 } |
313 | 313 |
314 private: | 314 private: |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
729 FROM_HERE, | 729 FROM_HERE, |
730 message_loop_for_ui.QuitClosure(), | 730 message_loop_for_ui.QuitClosure(), |
731 base::TimeDelta::FromSeconds( | 731 base::TimeDelta::FromSeconds( |
732 ThreadWatcherList::g_initialize_delay_seconds)); | 732 ThreadWatcherList::g_initialize_delay_seconds)); |
733 message_loop_for_ui.Run(); | 733 message_loop_for_ui.Run(); |
734 | 734 |
735 CheckState(false /* has_thread_watcher_list */, | 735 CheckState(false /* has_thread_watcher_list */, |
736 true /* stopped */, | 736 true /* stopped */, |
737 "Stopped"); | 737 "Stopped"); |
738 } | 738 } |
OLD | NEW |