1 // Copyright 2024 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef BASE_THREADING_CROSS_PROCESS_PLATFORM_THREAD_DELEGATE_H_ 6 #define BASE_THREADING_CROSS_PROCESS_PLATFORM_THREAD_DELEGATE_H_ 7 8 #include "base/base_export.h" 9 #include "base/threading/platform_thread.h" 10 11 namespace base { 12 13 // A CrossProcessPlatformThreadDelegate can intercept thread type changes for 14 // threads including other processes. This can be used for ChromeOS so that the 15 // browser process can proxy thread type updates of child processes received 16 // from SandboxedProcessThreadTypeHandler to D-Bus because child processes don't 17 // have access to D-Bus. 18 class BASE_EXPORT CrossProcessPlatformThreadDelegate { 19 public: 20 CrossProcessPlatformThreadDelegate() = default; 21 22 CrossProcessPlatformThreadDelegate( 23 const CrossProcessPlatformThreadDelegate&) = delete; 24 CrossProcessPlatformThreadDelegate& operator=( 25 const CrossProcessPlatformThreadDelegate&) = delete; 26 27 virtual ~CrossProcessPlatformThreadDelegate() = default; 28 29 // Invoked on thread type change. Returns true if the delegate handles 30 // adjusting thread properties. 31 virtual bool HandleThreadTypeChange(ProcessId process_id, 32 PlatformThreadId thread_id, 33 ThreadType thread_type) = 0; 34 }; 35 36 } // namespace base 37 38 #endif // BASE_THREADING_CROSS_PROCESS_PLATFORM_THREAD_DELEGATE_H_ 39