xref: /aosp_15_r20/external/cronet/net/url_request/url_request_context_getter_observer.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2015 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 NET_URL_REQUEST_URL_REQUEST_CONTEXT_GETTER_OBSERVER_H_
6 #define NET_URL_REQUEST_URL_REQUEST_CONTEXT_GETTER_OBSERVER_H_
7 
8 #include "net/base/net_export.h"
9 
10 namespace net {
11 class URLRequestContextGetter;
12 
13 // Interface for watching when a URLRequestContext associated with a
14 // URLRequestContextGetter is shutting down.
15 class NET_EXPORT URLRequestContextGetterObserver {
16  public:
17   URLRequestContextGetterObserver() = default;
18 
19   URLRequestContextGetterObserver(const URLRequestContextGetterObserver&) =
20       delete;
21   URLRequestContextGetterObserver& operator=(
22       const URLRequestContextGetterObserver&) = delete;
23 
24   // Called before the URLRequestContext shuts down. When called, the Getter's
25   // GetURLRequestContext method must return NULL to protected against
26   // re-entrancy, but the Context must still be valid and GetNetworkTaskRunner()
27   // must return the thread it lives on. Called on the network thread.
28   virtual void OnContextShuttingDown() = 0;
29 
30  protected:
31   virtual ~URLRequestContextGetterObserver() = default;
32 };
33 
34 }  // namespace net
35 
36 #endif  // NET_URL_REQUEST_URL_REQUEST_CONTEXT_GETTER_OBSERVER_H_
37