xref: /aosp_15_r20/external/cronet/base/task/thread_pool/worker_thread_observer.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2018 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_TASK_THREAD_POOL_WORKER_THREAD_OBSERVER_H_
6 #define BASE_TASK_THREAD_POOL_WORKER_THREAD_OBSERVER_H_
7 
8 namespace base {
9 
10 // Interface to observe entry and exit of the main function of a ThreadPool
11 // worker.
12 class WorkerThreadObserver {
13  public:
14   virtual ~WorkerThreadObserver() = default;
15 
16   // Invoked at the beginning of the main function of a ThreadPool worker,
17   // before any task runs.
18   virtual void OnWorkerThreadMainEntry() = 0;
19 
20   // Invoked at the end of the main function of a ThreadPool worker, when it
21   // can no longer run tasks.
22   virtual void OnWorkerThreadMainExit() = 0;
23 };
24 
25 }  // namespace base
26 
27 #endif  // BASE_TASK_THREAD_POOL_WORKER_THREAD_OBSERVER_H_
28