xref: /aosp_15_r20/external/cronet/ipc/urgent_message_observer.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2023 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 IPC_URGENT_MESSAGE_OBSERVER_H_
6 #define IPC_URGENT_MESSAGE_OBSERVER_H_
7 
8 namespace IPC {
9 
10 // Interface for observing events related to urgent messages.
11 class UrgentMessageObserver {
12  public:
13   virtual ~UrgentMessageObserver() = default;
14 
15   // Called on the IPC thread when an urgent message is received.
16   virtual void OnUrgentMessageReceived() = 0;
17 
18   // Called when an urgent message task has either run or failed to run. When
19   // the IPC method is successfully invoked, this callback runs on the same
20   // thread as the IPC method, after the IPC method runs. If the IPC method
21   // doesn't run, e.g. if the target task runner's queue has been shut down or
22   // the interface is closed, the callback can run on either the target thread
23   // or IPC thread.
24   virtual void OnUrgentMessageProcessed() = 0;
25 };
26 
27 }  // namespace IPC
28 
29 #endif  // IPC_URGENT_MESSAGE_OBSERVER_H_
30