thread_registry.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * Copyright 2019 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. #ifndef RTC_BASE_SYSTEM_THREAD_REGISTRY_H_
  11. #define RTC_BASE_SYSTEM_THREAD_REGISTRY_H_
  12. #include "rtc_base/location.h"
  13. namespace webrtc {
  14. class ScopedRegisterThreadForDebugging {
  15. public:
  16. #if defined(WEBRTC_ANDROID) && !defined(WEBRTC_CHROMIUM_BUILD)
  17. explicit ScopedRegisterThreadForDebugging(rtc::Location location);
  18. ~ScopedRegisterThreadForDebugging();
  19. #else
  20. explicit ScopedRegisterThreadForDebugging(rtc::Location) {}
  21. #endif
  22. // Not movable or copyable, because we can't duplicate the resource it owns,
  23. // and it needs a constant address.
  24. ScopedRegisterThreadForDebugging(const ScopedRegisterThreadForDebugging&) =
  25. delete;
  26. ScopedRegisterThreadForDebugging(ScopedRegisterThreadForDebugging&&) = delete;
  27. ScopedRegisterThreadForDebugging& operator=(
  28. const ScopedRegisterThreadForDebugging&) = delete;
  29. ScopedRegisterThreadForDebugging& operator=(
  30. ScopedRegisterThreadForDebugging&&) = delete;
  31. };
  32. #if defined(WEBRTC_ANDROID) && !defined(WEBRTC_CHROMIUM_BUILD)
  33. void PrintStackTracesOfRegisteredThreads();
  34. #else
  35. inline void PrintStackTracesOfRegisteredThreads() {}
  36. #endif
  37. } // namespace webrtc
  38. #endif // RTC_BASE_SYSTEM_THREAD_REGISTRY_H_