url_request_context_getter_observer.h 1.3 KB

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