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" |
11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
12 #include "base/message_loop_proxy.h" | 12 #include "base/message_loop_proxy.h" |
13 #include "base/string_tokenizer.h" | 13 #include "base/string_tokenizer.h" |
14 #include "base/synchronization/condition_variable.h" | 14 #include "base/synchronization/condition_variable.h" |
15 #include "base/synchronization/lock.h" | 15 #include "base/synchronization/lock.h" |
16 #include "base/threading/platform_thread.h" | 16 #include "base/threading/platform_thread.h" |
17 #include "base/time.h" | 17 #include "base/time.h" |
18 #include "build/build_config.h" | 18 #include "build/build_config.h" |
19 #include "chrome/browser/metrics/thread_watcher.h" | 19 #include "chrome/browser/metrics/thread_watcher.h" |
20 #include "chrome/common/chrome_switches.h" | 20 #include "chrome/common/chrome_switches.h" |
21 #include "content/test/test_browser_thread.h" | 21 #include "content/public/test/test_browser_thread.h" |
22 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
23 #include "testing/platform_test.h" | 23 #include "testing/platform_test.h" |
24 | 24 |
25 using base::TimeDelta; | 25 using base::TimeDelta; |
26 using base::TimeTicks; | 26 using base::TimeTicks; |
27 using content::BrowserThread; | 27 using content::BrowserThread; |
28 | 28 |
29 enum State { | 29 enum State { |
30 INITIALIZED, // Created ThreadWatch object. | 30 INITIALIZED, // Created ThreadWatch object. |
31 ACTIVATED, // Thread watching activated. | 31 ACTIVATED, // Thread watching activated. |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 base::Bind(&ThreadWatcher::DeActivateThreadWatching, | 547 base::Bind(&ThreadWatcher::DeActivateThreadWatching, |
548 base::Unretained(io_watcher_))); | 548 base::Unretained(io_watcher_))); |
549 WatchDogThread::PostTask( | 549 WatchDogThread::PostTask( |
550 FROM_HERE, | 550 FROM_HERE, |
551 base::Bind(&ThreadWatcher::DeActivateThreadWatching, | 551 base::Bind(&ThreadWatcher::DeActivateThreadWatching, |
552 base::Unretained(webkit_watcher_))); | 552 base::Unretained(webkit_watcher_))); |
553 | 553 |
554 // Wait for the io_watcher_'s VeryLongMethod to finish. | 554 // Wait for the io_watcher_'s VeryLongMethod to finish. |
555 io_watcher_->WaitForWaitStateChange(kUnresponsiveTime * 10, ALL_DONE); | 555 io_watcher_->WaitForWaitStateChange(kUnresponsiveTime * 10, ALL_DONE); |
556 } | 556 } |
OLD | NEW |