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

Side by Side Diff: content/network/network_context.h

Issue 2951293002: NetworkService: Destroy URLLoaders when a NetworkContext is destroyed. (Closed)
Patch Set: Response to comment, change why destruction is safe 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 unified diff | Download patch
« no previous file with comments | « content/browser/loader/test_url_loader_client.cc ('k') | content/network/network_context.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_NETWORK_NETWORK_CONTEXT_H_ 5 #ifndef CONTENT_NETWORK_NETWORK_CONTEXT_H_
6 #define CONTENT_NETWORK_NETWORK_CONTEXT_H_ 6 #define CONTENT_NETWORK_NETWORK_CONTEXT_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 // Put it below |url_request_context_| so that it outlives all the 55 // Put it below |url_request_context_| so that it outlives all the
56 // NetworkServiceURLLoaderFactoryImpl instances. 56 // NetworkServiceURLLoaderFactoryImpl instances.
57 mojo::StrongBindingSet<mojom::URLLoaderFactory> loader_factory_bindings_; 57 mojo::StrongBindingSet<mojom::URLLoaderFactory> loader_factory_bindings_;
58 58
59 // URLLoaderImpls register themselves with the NetworkContext so that they can 59 // URLLoaderImpls register themselves with the NetworkContext so that they can
60 // be cleaned up when the NetworkContext goes away. This is needed as 60 // be cleaned up when the NetworkContext goes away. This is needed as
61 // net::URLRequests held by URLLoaderImpls have to be gone when 61 // net::URLRequests held by URLLoaderImpls have to be gone when
62 // net::URLRequestContext (held by NetworkContext) is destroyed. 62 // net::URLRequestContext (held by NetworkContext) is destroyed.
63 std::set<URLLoaderImpl*> url_loaders_; 63 std::set<URLLoaderImpl*> url_loaders_;
64 64
65 // Set when entering the destructor, in order to avoid manipulations of the
66 // |url_loaders_| (as a url_loader might delete itself in Cleanup()).
67 bool in_shutdown_;
68
69 mojom::NetworkContextParamsPtr params_; 65 mojom::NetworkContextParamsPtr params_;
70 66
71 mojo::Binding<mojom::NetworkContext> binding_; 67 mojo::Binding<mojom::NetworkContext> binding_;
72 68
73 DISALLOW_COPY_AND_ASSIGN(NetworkContext); 69 DISALLOW_COPY_AND_ASSIGN(NetworkContext);
74 }; 70 };
75 71
76 } // namespace content 72 } // namespace content
77 73
78 #endif // CONTENT_NETWORK_NETWORK_CONTEXT_H_ 74 #endif // CONTENT_NETWORK_NETWORK_CONTEXT_H_
OLDNEW
« no previous file with comments | « content/browser/loader/test_url_loader_client.cc ('k') | content/network/network_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698