OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "net/url_request/url_request_context_builder.h" | 5 #include "net/url_request/url_request_context_builder.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 | 127 |
128 bool OnCanAccessFile(const URLRequest& request, | 128 bool OnCanAccessFile(const URLRequest& request, |
129 const base::FilePath& original_path, | 129 const base::FilePath& original_path, |
130 const base::FilePath& absolute_path) const override { | 130 const base::FilePath& absolute_path) const override { |
131 return true; | 131 return true; |
132 } | 132 } |
133 | 133 |
134 DISALLOW_COPY_AND_ASSIGN(BasicNetworkDelegate); | 134 DISALLOW_COPY_AND_ASSIGN(BasicNetworkDelegate); |
135 }; | 135 }; |
136 | 136 |
137 // Define a context class that can self-manage the ownership of its components | 137 // A URLRequestContext subclass that owns most of its components |
138 // via a UrlRequestContextStorage object. Since it cancels requests in its | 138 // via a UrlRequestContextStorage object. When URLRequestContextBuilder::Build() |
139 // destructor, it's not safe to subclass this. | 139 // is called, ownership of all URLRequestContext components is passed to the |
| 140 // ContainerURLRequestContext. Since this cancels requests in its destructor, |
| 141 // it's not safe to subclass this. |
140 class ContainerURLRequestContext final : public URLRequestContext { | 142 class ContainerURLRequestContext final : public URLRequestContext { |
141 public: | 143 public: |
142 explicit ContainerURLRequestContext( | 144 explicit ContainerURLRequestContext( |
143 const scoped_refptr<base::SingleThreadTaskRunner>& file_task_runner) | 145 const scoped_refptr<base::SingleThreadTaskRunner>& file_task_runner) |
144 : file_task_runner_(file_task_runner), storage_(this) {} | 146 : file_task_runner_(file_task_runner), storage_(this) {} |
145 | 147 |
146 ~ContainerURLRequestContext() override { | 148 ~ContainerURLRequestContext() override { |
147 // Shut down the ProxyService, as it may have pending URLRequests using this | 149 // Shut down the ProxyService, as it may have pending URLRequests using this |
148 // context. Since this cancels requests, it's not safe to subclass this, as | 150 // context. Since this cancels requests, it's not safe to subclass this, as |
149 // some parts of the URLRequestContext may then be torn down before this | 151 // some parts of the URLRequestContext may then be torn down before this |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 std::unique_ptr<ProxyConfigService> proxy_config_service, | 507 std::unique_ptr<ProxyConfigService> proxy_config_service, |
506 URLRequestContext* url_request_context, | 508 URLRequestContext* url_request_context, |
507 HostResolver* host_resolver, | 509 HostResolver* host_resolver, |
508 NetworkDelegate* network_delegate, | 510 NetworkDelegate* network_delegate, |
509 NetLog* net_log) { | 511 NetLog* net_log) { |
510 return ProxyService::CreateUsingSystemProxyResolver( | 512 return ProxyService::CreateUsingSystemProxyResolver( |
511 std::move(proxy_config_service), net_log); | 513 std::move(proxy_config_service), net_log); |
512 } | 514 } |
513 | 515 |
514 } // namespace net | 516 } // namespace net |
OLD | NEW |