// Copyright 2012 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "base/threading/watchdog.h" #include "base/compiler_specific.h" #include "base/logging.h" #include "base/no_destructor.h" #include "base/threading/platform_thread.h" namespace base { namespace { // When the debugger breaks (when we alarm), all the other alarms that are // armed will expire (also alarm). To diminish this effect, we track any // delay due to debugger breaks, and we *try* to adjust the effective start // time of other alarms to step past the debugging break. // Without this safety net, any alarm will typically trigger a host of follow // on alarms from callers that specify old times. struct StaticData { … }; StaticData* GetStaticData() { … } } // namespace // Start thread running in a Disarmed state. Watchdog::Watchdog(const TimeDelta& duration, const std::string& thread_watched_name, bool enabled, Delegate* delegate) : … { … } // Notify watchdog thread, and wait for it to finish up. Watchdog::~Watchdog() { … } void Watchdog::Cleanup() { … } bool Watchdog::IsJoinable() { … } void Watchdog::Arm() { … } void Watchdog::ArmSomeTimeDeltaAgo(const TimeDelta& time_delta) { … } // Start clock for watchdog. void Watchdog::ArmAtStartTime(const TimeTicks start_time) { … } // Disable watchdog so that it won't do anything when time expires. void Watchdog::Disarm() { … } void Watchdog::Alarm() { … } void Watchdog::DefaultAlarm() { … } //------------------------------------------------------------------------------ // Internal private methods that the watchdog thread uses. void Watchdog::ThreadDelegate::ThreadMain() { … } void Watchdog::ThreadDelegate::SetThreadName() const { … } // static void Watchdog::ResetStaticData() { … } } // namespace base