| 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 // This file defines a WatchDog thread that monitors the responsiveness of other | 5 // This file defines a WatchDog thread that monitors the responsiveness of other |
| 6 // browser threads like UI, IO, DB, FILE and CACHED threads. It also defines | 6 // browser threads like UI, IO, DB, FILE and CACHED threads. It also defines |
| 7 // ThreadWatcher class which performs health check on threads that would like to | 7 // ThreadWatcher class which performs health check on threads that would like to |
| 8 // be watched. This file also defines ThreadWatcherList class that has list of | 8 // be watched. This file also defines ThreadWatcherList class that has list of |
| 9 // all active ThreadWatcher objects. | 9 // all active ThreadWatcher objects. |
| 10 // | 10 // |
| (...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 content::NotificationRegistrar registrar_; | 546 content::NotificationRegistrar registrar_; |
| 547 | 547 |
| 548 // This is the last time when woke all thread watchers up. | 548 // This is the last time when woke all thread watchers up. |
| 549 base::TimeTicks last_wakeup_time_; | 549 base::TimeTicks last_wakeup_time_; |
| 550 | 550 |
| 551 // It is the time interval between wake up calls to thread watchers. | 551 // It is the time interval between wake up calls to thread watchers. |
| 552 const base::TimeDelta wakeup_interval_; | 552 const base::TimeDelta wakeup_interval_; |
| 553 | 553 |
| 554 // Subscription for receiving callbacks that a URL was opened from the | 554 // Subscription for receiving callbacks that a URL was opened from the |
| 555 // omnibox. | 555 // omnibox. |
| 556 scoped_ptr<base::CallbackList<void(OmniboxLog*)>::Subscription> | 556 std::unique_ptr<base::CallbackList<void(OmniboxLog*)>::Subscription> |
| 557 omnibox_url_opened_subscription_; | 557 omnibox_url_opened_subscription_; |
| 558 | 558 |
| 559 DISALLOW_COPY_AND_ASSIGN(ThreadWatcherObserver); | 559 DISALLOW_COPY_AND_ASSIGN(ThreadWatcherObserver); |
| 560 }; | 560 }; |
| 561 | 561 |
| 562 // Class for WatchDogThread and in its Init method, we start watching UI, IO, | 562 // Class for WatchDogThread and in its Init method, we start watching UI, IO, |
| 563 // DB, FILE, CACHED threads. | 563 // DB, FILE, CACHED threads. |
| 564 class WatchDogThread : public base::Thread { | 564 class WatchDogThread : public base::Thread { |
| 565 public: | 565 public: |
| 566 // Constructor. | 566 // Constructor. |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 655 bool IsEnabled() const; | 655 bool IsEnabled() const; |
| 656 | 656 |
| 657 protected: | 657 protected: |
| 658 // Logs the call stack of given thread_id's janky method. This runs on | 658 // Logs the call stack of given thread_id's janky method. This runs on |
| 659 // WatchDogThread. This is overridden in tests to prevent the metrics logging. | 659 // WatchDogThread. This is overridden in tests to prevent the metrics logging. |
| 660 virtual void Alarm(base::PlatformThreadId thread_id); | 660 virtual void Alarm(base::PlatformThreadId thread_id); |
| 661 | 661 |
| 662 private: | 662 private: |
| 663 // A profiler that periodically samples stack traces. Used to sample jank | 663 // A profiler that periodically samples stack traces. Used to sample jank |
| 664 // behavior. | 664 // behavior. |
| 665 scoped_ptr<base::StackSamplingProfiler> sampling_profiler_; | 665 std::unique_ptr<base::StackSamplingProfiler> sampling_profiler_; |
| 666 | 666 |
| 667 // We use this factory during creation and starting timer. | 667 // We use this factory during creation and starting timer. |
| 668 base::WeakPtrFactory<JankTimeBomb> weak_ptr_factory_; | 668 base::WeakPtrFactory<JankTimeBomb> weak_ptr_factory_; |
| 669 | 669 |
| 670 DISALLOW_COPY_AND_ASSIGN(JankTimeBomb); | 670 DISALLOW_COPY_AND_ASSIGN(JankTimeBomb); |
| 671 }; | 671 }; |
| 672 | 672 |
| 673 // This is a wrapper class for detecting hangs during shutdown. | 673 // This is a wrapper class for detecting hangs during shutdown. |
| 674 class ShutdownWatcherHelper { | 674 class ShutdownWatcherHelper { |
| 675 public: | 675 public: |
| (...skipping 11 matching lines...) Expand all Loading... |
| 687 // shutdown_watchdog_ watches for hangs during shutdown. | 687 // shutdown_watchdog_ watches for hangs during shutdown. |
| 688 base::Watchdog* shutdown_watchdog_; | 688 base::Watchdog* shutdown_watchdog_; |
| 689 | 689 |
| 690 // The |thread_id_| on which this object is constructed. | 690 // The |thread_id_| on which this object is constructed. |
| 691 const base::PlatformThreadId thread_id_; | 691 const base::PlatformThreadId thread_id_; |
| 692 | 692 |
| 693 DISALLOW_COPY_AND_ASSIGN(ShutdownWatcherHelper); | 693 DISALLOW_COPY_AND_ASSIGN(ShutdownWatcherHelper); |
| 694 }; | 694 }; |
| 695 | 695 |
| 696 #endif // CHROME_BROWSER_METRICS_THREAD_WATCHER_H_ | 696 #endif // CHROME_BROWSER_METRICS_THREAD_WATCHER_H_ |
| OLD | NEW |