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 base::Value* HttpServerPropertiesImpl::GetAlternativeServiceInfoAsValue() |
eroman
2015/05/29 22:13:06
This change is fine, but the more useful change is
| |
399 const { | 399 const { |
400 base::ListValue* dict_list = new base::ListValue(); | 400 scoped_ptr<base::ListValue> dict_list(new base::ListValue()); |
401 for (const auto& alternative_service_map_item : alternative_service_map_) { | 401 for (const auto& alternative_service_map_item : alternative_service_map_) { |
402 const HostPortPair& host_port_pair = alternative_service_map_item.first; | 402 const HostPortPair& host_port_pair = alternative_service_map_item.first; |
403 const AlternativeServiceInfo& alternative_service_info = | 403 const AlternativeServiceInfo& alternative_service_info = |
404 alternative_service_map_item.second; | 404 alternative_service_map_item.second; |
405 std::string alternative_service_string(alternative_service_info.ToString()); | 405 std::string alternative_service_string(alternative_service_info.ToString()); |
406 AlternativeService alternative_service( | 406 AlternativeService alternative_service( |
407 alternative_service_info.alternative_service); | 407 alternative_service_info.alternative_service); |
408 if (alternative_service.host.empty()) { | 408 if (alternative_service.host.empty()) { |
409 alternative_service.host = host_port_pair.host(); | 409 alternative_service.host = host_port_pair.host(); |
410 } | 410 } |
411 if (IsAlternativeServiceBroken(alternative_service)) { | 411 if (IsAlternativeServiceBroken(alternative_service)) { |
412 alternative_service_string.append(" (broken)"); | 412 alternative_service_string.append(" (broken)"); |
413 } | 413 } |
414 | 414 |
415 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); | 415 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
416 dict->SetString("host_port_pair", host_port_pair.ToString()); | 416 dict->SetString("host_port_pair", host_port_pair.ToString()); |
417 dict->SetString("alternative_service", alternative_service_string); | 417 dict->SetString("alternative_service", alternative_service_string); |
418 dict_list->Append(dict.Pass()); | 418 dict_list->Append(dict.Pass()); |
419 } | 419 } |
420 return dict_list; | 420 return dict_list.release(); |
421 } | 421 } |
422 | 422 |
423 const SettingsMap& HttpServerPropertiesImpl::GetSpdySettings( | 423 const SettingsMap& HttpServerPropertiesImpl::GetSpdySettings( |
424 const HostPortPair& host_port_pair) { | 424 const HostPortPair& host_port_pair) { |
425 SpdySettingsMap::iterator it = spdy_settings_map_.Get(host_port_pair); | 425 SpdySettingsMap::iterator it = spdy_settings_map_.Get(host_port_pair); |
426 if (it == spdy_settings_map_.end()) { | 426 if (it == spdy_settings_map_.end()) { |
427 CR_DEFINE_STATIC_LOCAL(SettingsMap, kEmptySettingsMap, ()); | 427 CR_DEFINE_STATIC_LOCAL(SettingsMap, kEmptySettingsMap, ()); |
428 return kEmptySettingsMap; | 428 return kEmptySettingsMap; |
429 } | 429 } |
430 return it->second; | 430 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(); | 594 base::TimeDelta delay = when > now ? when - now : base::TimeDelta(); |
595 base::MessageLoop::current()->PostDelayedTask( | 595 base::MessageLoop::current()->PostDelayedTask( |
596 FROM_HERE, | 596 FROM_HERE, |
597 base::Bind( | 597 base::Bind( |
598 &HttpServerPropertiesImpl::ExpireBrokenAlternateProtocolMappings, | 598 &HttpServerPropertiesImpl::ExpireBrokenAlternateProtocolMappings, |
599 weak_ptr_factory_.GetWeakPtr()), | 599 weak_ptr_factory_.GetWeakPtr()), |
600 delay); | 600 delay); |
601 } | 601 } |
602 | 602 |
603 } // namespace net | 603 } // namespace net |
OLD | NEW |