Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1826)

Unified Diff: content/network/network_context.h

Issue 2962693002: NetworkService: Destroy NetworkContexts on NetworkService teardown. (Closed)
Patch Set: Fix a couple comments Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/network/network_context.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/network/network_context.h
diff --git a/content/network/network_context.h b/content/network/network_context.h
index a4dd42c2b6808c637e36c76dc9dc485e275ca189..b6b5332f14658884eb0434f1c44097264925e3d6 100644
--- a/content/network/network_context.h
+++ b/content/network/network_context.h
@@ -22,11 +22,13 @@ class URLRequestContext;
}
namespace content {
+class NetworkService;
class URLLoaderImpl;
class NetworkContext : public mojom::NetworkContext {
public:
- NetworkContext(mojom::NetworkContextRequest request,
+ NetworkContext(NetworkService* network_service,
+ mojom::NetworkContextRequest request,
mojom::NetworkContextParamsPtr params);
~NetworkContext() override;
@@ -47,9 +49,18 @@ class NetworkContext : public mojom::NetworkContext {
void HandleViewCacheRequest(const GURL& url,
mojom::URLLoaderClientPtr client) override;
+ // Called when the associated NetworkService is going away. Guaranteed to
+ // destroy NetworkContext's URLRequestContext.
+ void Cleanup();
+
private:
NetworkContext();
+ // On connection errors the NetworkContext destroys itself.
+ void OnConnectionError();
+
+ NetworkService* const network_service_;
+
std::unique_ptr<net::URLRequestContext> url_request_context_;
// Put it below |url_request_context_| so that it outlives all the
« no previous file with comments | « no previous file | content/network/network_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698