thread_checker.h 971 B

123456789101112131415161718192021222324252627
  1. /*
  2. * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
  3. *
  4. * Use of this source code is governed by a BSD-style license
  5. * that can be found in the LICENSE file in the root of the source
  6. * tree. An additional intellectual property rights grant can be found
  7. * in the file PATENTS. All contributing project authors may
  8. * be found in the AUTHORS file in the root of the source tree.
  9. */
  10. // Borrowed from Chromium's src/base/threading/thread_checker.h.
  11. #ifndef RTC_BASE_THREAD_CHECKER_H_
  12. #define RTC_BASE_THREAD_CHECKER_H_
  13. #include "rtc_base/deprecation.h"
  14. #include "rtc_base/synchronization/sequence_checker.h"
  15. namespace rtc {
  16. // TODO(srte): Replace usages of this with SequenceChecker.
  17. class ThreadChecker : public webrtc::SequenceChecker {
  18. public:
  19. RTC_DEPRECATED bool CalledOnValidThread() const { return IsCurrent(); }
  20. RTC_DEPRECATED void DetachFromThread() { Detach(); }
  21. };
  22. } // namespace rtc
  23. #endif // RTC_BASE_THREAD_CHECKER_H_