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/http/http_server_properties_impl.h" | 5 #include "net/http/http_server_properties_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 // service can be in the mapping. | 388 // service can be in the mapping. |
389 // 2. Remove the rest of this method as it will be moot. | 389 // 2. Remove the rest of this method as it will be moot. |
390 broken_alternative_services_.erase(alternative_service); | 390 broken_alternative_services_.erase(alternative_service); |
391 } | 391 } |
392 | 392 |
393 const AlternativeServiceMap& HttpServerPropertiesImpl::alternative_service_map() | 393 const AlternativeServiceMap& HttpServerPropertiesImpl::alternative_service_map() |
394 const { | 394 const { |
395 return alternative_service_map_; | 395 return alternative_service_map_; |
396 } | 396 } |
397 | 397 |
398 base::Value* HttpServerPropertiesImpl::GetAlternativeServiceInfoAsValue() | 398 scoped_ptr<base::Value> |
| 399 HttpServerPropertiesImpl::GetAlternativeServiceInfoAsValue() |
399 const { | 400 const { |
400 base::ListValue* dict_list = new base::ListValue(); | 401 scoped_ptr<base::ListValue> dict_list(new base::ListValue()); |
401 for (const auto& alternative_service_map_item : alternative_service_map_) { | 402 for (const auto& alternative_service_map_item : alternative_service_map_) { |
402 const HostPortPair& host_port_pair = alternative_service_map_item.first; | 403 const HostPortPair& host_port_pair = alternative_service_map_item.first; |
403 const AlternativeServiceInfo& alternative_service_info = | 404 const AlternativeServiceInfo& alternative_service_info = |
404 alternative_service_map_item.second; | 405 alternative_service_map_item.second; |
405 std::string alternative_service_string(alternative_service_info.ToString()); | 406 std::string alternative_service_string(alternative_service_info.ToString()); |
406 AlternativeService alternative_service( | 407 AlternativeService alternative_service( |
407 alternative_service_info.alternative_service); | 408 alternative_service_info.alternative_service); |
408 if (alternative_service.host.empty()) { | 409 if (alternative_service.host.empty()) { |
409 alternative_service.host = host_port_pair.host(); | 410 alternative_service.host = host_port_pair.host(); |
410 } | 411 } |
411 if (IsAlternativeServiceBroken(alternative_service)) { | 412 if (IsAlternativeServiceBroken(alternative_service)) { |
412 alternative_service_string.append(" (broken)"); | 413 alternative_service_string.append(" (broken)"); |
413 } | 414 } |
414 | 415 |
415 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); | 416 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
416 dict->SetString("host_port_pair", host_port_pair.ToString()); | 417 dict->SetString("host_port_pair", host_port_pair.ToString()); |
417 dict->SetString("alternative_service", alternative_service_string); | 418 dict->SetString("alternative_service", alternative_service_string); |
418 dict_list->Append(dict.Pass()); | 419 dict_list->Append(dict.Pass()); |
419 } | 420 } |
420 return dict_list; | 421 return dict_list.Pass(); |
421 } | 422 } |
422 | 423 |
423 const SettingsMap& HttpServerPropertiesImpl::GetSpdySettings( | 424 const SettingsMap& HttpServerPropertiesImpl::GetSpdySettings( |
424 const HostPortPair& host_port_pair) { | 425 const HostPortPair& host_port_pair) { |
425 SpdySettingsMap::iterator it = spdy_settings_map_.Get(host_port_pair); | 426 SpdySettingsMap::iterator it = spdy_settings_map_.Get(host_port_pair); |
426 if (it == spdy_settings_map_.end()) { | 427 if (it == spdy_settings_map_.end()) { |
427 CR_DEFINE_STATIC_LOCAL(SettingsMap, kEmptySettingsMap, ()); | 428 CR_DEFINE_STATIC_LOCAL(SettingsMap, kEmptySettingsMap, ()); |
428 return kEmptySettingsMap; | 429 return kEmptySettingsMap; |
429 } | 430 } |
430 return it->second; | 431 return it->second; |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 base::TimeDelta delay = when > now ? when - now : base::TimeDelta(); | 595 base::TimeDelta delay = when > now ? when - now : base::TimeDelta(); |
595 base::MessageLoop::current()->PostDelayedTask( | 596 base::MessageLoop::current()->PostDelayedTask( |
596 FROM_HERE, | 597 FROM_HERE, |
597 base::Bind( | 598 base::Bind( |
598 &HttpServerPropertiesImpl::ExpireBrokenAlternateProtocolMappings, | 599 &HttpServerPropertiesImpl::ExpireBrokenAlternateProtocolMappings, |
599 weak_ptr_factory_.GetWeakPtr()), | 600 weak_ptr_factory_.GetWeakPtr()), |
600 delay); | 601 delay); |
601 } | 602 } |
602 | 603 |
603 } // namespace net | 604 } // namespace net |
OLD | NEW |