OLD | NEW |
---|---|
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> |
11 #include <set> | 11 #include <set> |
12 | 12 |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
15 #include "content/public/common/network_service.mojom.h" | 15 #include "content/public/common/network_service.mojom.h" |
16 #include "content/public/common/url_loader_factory.mojom.h" | 16 #include "content/public/common/url_loader_factory.mojom.h" |
17 #include "mojo/public/cpp/bindings/binding.h" | 17 #include "mojo/public/cpp/bindings/binding.h" |
18 #include "mojo/public/cpp/bindings/strong_binding_set.h" | 18 #include "mojo/public/cpp/bindings/strong_binding_set.h" |
19 | 19 |
20 namespace net { | 20 namespace net { |
21 class URLRequestContext; | 21 class URLRequestContext; |
22 class URLRequestContextBuilder; | 22 class URLRequestContextBuilder; |
23 } | 23 } |
24 | 24 |
25 namespace content { | 25 namespace content { |
26 class NetworkServiceImpl; | 26 class NetworkServiceImpl; |
27 class URLLoaderImpl; | 27 class URLLoaderImpl; |
28 | 28 |
29 // A NetworkContext creates and manages access to a URLRequestContext. | |
30 // | |
31 // When the network service is enabled, NetworkContexts are created through | |
32 // NetworkService's mojo interface and are owned jointly by the NetworkService | |
33 // and the NetworkContextPtr used to talk to them, and the NetworkContext is | |
34 // destroyed when either one is torn down. | |
35 // | |
36 // When the network service is disabled, NetworkContexts may be created through | |
37 // NetworkServiceImpl::CreateNetworkContextWithBuilder, and take in a | |
38 // URLRequestContextBuilder to seed construction of the NetworkContext's | |
39 // URLRequestContext. When that happens, the consumer takes owners the | |
Randy Smith (Not in Mondays)
2017/07/20 17:38:34
nit: owners -> ownership of
mmenke
2017/07/20 18:31:31
Done.
| |
40 // NetworkContext directly, has direct access to its URLRequestContext, and is | |
41 // responsible for destroying it before the NetworkService. | |
Randy Smith (Not in Mondays)
2017/07/20 17:38:34
Thank you for this--when I first hit this file (ea
mmenke
2017/07/20 18:31:31
No problem, though credit goes to John for suggest
| |
29 class NetworkContext : public mojom::NetworkContext { | 42 class NetworkContext : public mojom::NetworkContext { |
30 public: | 43 public: |
31 NetworkContext(NetworkServiceImpl* network_service, | 44 NetworkContext(NetworkServiceImpl* network_service, |
32 mojom::NetworkContextRequest request, | 45 mojom::NetworkContextRequest request, |
33 mojom::NetworkContextParamsPtr params); | 46 mojom::NetworkContextParamsPtr params); |
34 | 47 |
35 // Temporary constructor that allows creating an in-process NetworkContext | 48 // Temporary constructor that allows creating an in-process NetworkContext |
36 // with a pre-populated URLRequestContextBuilder. | 49 // with a pre-populated URLRequestContextBuilder. |
37 NetworkContext(mojom::NetworkContextRequest request, | 50 NetworkContext(mojom::NetworkContextRequest request, |
38 mojom::NetworkContextParamsPtr params, | 51 mojom::NetworkContextParamsPtr params, |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
84 mojom::NetworkContextParamsPtr params_; | 97 mojom::NetworkContextParamsPtr params_; |
85 | 98 |
86 mojo::Binding<mojom::NetworkContext> binding_; | 99 mojo::Binding<mojom::NetworkContext> binding_; |
87 | 100 |
88 DISALLOW_COPY_AND_ASSIGN(NetworkContext); | 101 DISALLOW_COPY_AND_ASSIGN(NetworkContext); |
89 }; | 102 }; |
90 | 103 |
91 } // namespace content | 104 } // namespace content |
92 | 105 |
93 #endif // CONTENT_NETWORK_NETWORK_CONTEXT_H_ | 106 #endif // CONTENT_NETWORK_NETWORK_CONTEXT_H_ |
OLD | NEW |