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