Allow fetchers to watch URLRequestContextGetters for context shutdown.
[chromium-blink-merge.git] / net / url_request / url_request_context_getter_observer.h
blob53cd6dc2c644761f51fe2d636567ffb6fa4851aa
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef NET_URL_REQUEST_URL_REQUEST_CONTEXT_GETTER_OBSERVER_H_
6 #define NET_URL_REQUEST_URL_REQUEST_CONTEXT_GETTER_OBSERVER_H_
8 #include "base/macros.h"
9 #include "net/base/net_export.h"
11 namespace net {
12 class URLRequestContextGetter;
14 // Interface for watching when a URLRequestContext associated with a
15 // URLRequestContextGetter is shutting down.
16 class NET_EXPORT URLRequestContextGetterObserver {
17 public:
18 URLRequestContextGetterObserver() {}
20 // Called before the URLRequestContext shuts down. When called, the Getter's
21 // GetURLRequestContext method must return NULL to protected against
22 // re-entrancy, but the Context must still be valid and GetNetworkTaskRunner()
23 // must return the thread it lives on. Called on the network thread.
24 virtual void OnContextShuttingDown() = 0;
26 protected:
27 virtual ~URLRequestContextGetterObserver() {}
29 private:
30 DISALLOW_COPY_AND_ASSIGN(URLRequestContextGetterObserver);
33 } // namespace net
35 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_GETTER_OBSERVER_H_