OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/http/http_stream_factory.h" | 5 #include "net/http/http_stream_factory.h" |
6 | 6 |
7 #include "base/stl_util-inl.h" | 7 #include "base/stl_util-inl.h" |
8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
9 #include "base/string_split.h" | 9 #include "base/string_split.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 bool HttpStreamFactory::use_alternate_protocols_ = false; | 25 bool HttpStreamFactory::use_alternate_protocols_ = false; |
26 // static | 26 // static |
27 bool HttpStreamFactory::force_spdy_over_ssl_ = true; | 27 bool HttpStreamFactory::force_spdy_over_ssl_ = true; |
28 // static | 28 // static |
29 bool HttpStreamFactory::force_spdy_always_ = false; | 29 bool HttpStreamFactory::force_spdy_always_ = false; |
30 // static | 30 // static |
31 std::list<HostPortPair>* HttpStreamFactory::forced_spdy_exclusions_ = NULL; | 31 std::list<HostPortPair>* HttpStreamFactory::forced_spdy_exclusions_ = NULL; |
32 // static | 32 // static |
33 bool HttpStreamFactory::ignore_certificate_errors_ = false; | 33 bool HttpStreamFactory::ignore_certificate_errors_ = false; |
34 | 34 |
35 // static | |
36 void HttpStreamFactory::SetHostMappingRules(const std::string& rules) { | |
37 HostMappingRules* host_mapping_rules = new HostMappingRules(); | |
38 host_mapping_rules->SetRulesFromString(rules); | |
39 delete host_mapping_rules_; | |
40 host_mapping_rules_ = host_mapping_rules; | |
41 } | |
42 | |
43 HttpStreamFactory::HttpStreamFactory() { | 35 HttpStreamFactory::HttpStreamFactory() { |
44 } | 36 } |
45 | 37 |
46 HttpStreamFactory::~HttpStreamFactory() { | 38 HttpStreamFactory::~HttpStreamFactory() { |
47 RequestCallbackMap request_callback_map; | 39 RequestCallbackMap request_callback_map; |
48 request_callback_map.swap(request_callback_map_); | 40 request_callback_map.swap(request_callback_map_); |
49 for (RequestCallbackMap::iterator it = request_callback_map.begin(); | 41 for (RequestCallbackMap::iterator it = request_callback_map.begin(); |
50 it != request_callback_map.end(); ++it) { | 42 it != request_callback_map.end(); ++it) { |
51 delete it->first; | 43 delete it->first; |
52 // We don't invoke the callback in the destructor. | 44 // We don't invoke the callback in the destructor. |
53 } | 45 } |
54 } | 46 } |
55 | 47 |
| 48 // static |
| 49 void HttpStreamFactory::SetHostMappingRules(const std::string& rules) { |
| 50 HostMappingRules* host_mapping_rules = new HostMappingRules(); |
| 51 host_mapping_rules->SetRulesFromString(rules); |
| 52 delete host_mapping_rules_; |
| 53 host_mapping_rules_ = host_mapping_rules; |
| 54 } |
| 55 |
56 StreamRequest* HttpStreamFactory::RequestStream( | 56 StreamRequest* HttpStreamFactory::RequestStream( |
57 const HttpRequestInfo* request_info, | 57 const HttpRequestInfo* request_info, |
58 SSLConfig* ssl_config, | 58 SSLConfig* ssl_config, |
59 ProxyInfo* proxy_info, | 59 ProxyInfo* proxy_info, |
60 HttpNetworkSession* session, | 60 HttpNetworkSession* session, |
61 StreamRequest::Delegate* delegate, | 61 StreamRequest::Delegate* delegate, |
62 const BoundNetLog& net_log) { | 62 const BoundNetLog& net_log) { |
63 HttpStreamRequest* stream = new HttpStreamRequest(this, session); | 63 HttpStreamRequest* stream = new HttpStreamRequest(this, session); |
64 stream->Start(request_info, ssl_config, proxy_info, delegate, net_log); | 64 stream->Start(request_info, ssl_config, proxy_info, delegate, net_log); |
65 return stream; | 65 return stream; |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 RequestCallbackMap::iterator it = request_callback_map_.find(request); | 161 RequestCallbackMap::iterator it = request_callback_map_.find(request); |
162 DCHECK(it != request_callback_map_.end()); | 162 DCHECK(it != request_callback_map_.end()); |
163 CompletionCallback* callback = it->second; | 163 CompletionCallback* callback = it->second; |
164 request_callback_map_.erase(it); | 164 request_callback_map_.erase(it); |
165 delete request; | 165 delete request; |
166 callback->Run(result); | 166 callback->Run(result); |
167 } | 167 } |
168 | 168 |
169 } // namespace net | 169 } // namespace net |
170 | 170 |
OLD | NEW |