| 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 <algorithm> | 7 #include <algorithm> | 
| 8 #include <memory> | 8 #include <memory> | 
| 9 #include <utility> | 9 #include <utility> | 
| 10 | 10 | 
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 207     size_t max_size) const { | 207     size_t max_size) const { | 
| 208   DCHECK(CalledOnValidThread()); | 208   DCHECK(CalledOnValidThread()); | 
| 209   DCHECK(spdy_server_list); | 209   DCHECK(spdy_server_list); | 
| 210   spdy_server_list->Clear(); | 210   spdy_server_list->Clear(); | 
| 211   size_t count = 0; | 211   size_t count = 0; | 
| 212   // Get the list of servers (scheme/host/port) that support SPDY. | 212   // Get the list of servers (scheme/host/port) that support SPDY. | 
| 213   for (SpdyServersMap::const_iterator it = spdy_servers_map_.begin(); | 213   for (SpdyServersMap::const_iterator it = spdy_servers_map_.begin(); | 
| 214        it != spdy_servers_map_.end() && count < max_size; ++it) { | 214        it != spdy_servers_map_.end() && count < max_size; ++it) { | 
| 215     const std::string spdy_server = it->first; | 215     const std::string spdy_server = it->first; | 
| 216     if (it->second) { | 216     if (it->second) { | 
| 217       spdy_server_list->Append(new base::StringValue(spdy_server)); | 217       spdy_server_list->AppendString(spdy_server); | 
| 218       ++count; | 218       ++count; | 
| 219     } | 219     } | 
| 220   } | 220   } | 
| 221 } | 221 } | 
| 222 | 222 | 
| 223 base::WeakPtr<HttpServerProperties> HttpServerPropertiesImpl::GetWeakPtr() { | 223 base::WeakPtr<HttpServerProperties> HttpServerPropertiesImpl::GetWeakPtr() { | 
| 224   return weak_ptr_factory_.GetWeakPtr(); | 224   return weak_ptr_factory_.GetWeakPtr(); | 
| 225 } | 225 } | 
| 226 | 226 | 
| 227 void HttpServerPropertiesImpl::Clear() { | 227 void HttpServerPropertiesImpl::Clear() { | 
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 538       std::string alternative_service_string( | 538       std::string alternative_service_string( | 
| 539           alternative_service_info.ToString()); | 539           alternative_service_info.ToString()); | 
| 540       AlternativeService alternative_service( | 540       AlternativeService alternative_service( | 
| 541           alternative_service_info.alternative_service); | 541           alternative_service_info.alternative_service); | 
| 542       if (alternative_service.host.empty()) { | 542       if (alternative_service.host.empty()) { | 
| 543         alternative_service.host = server.host(); | 543         alternative_service.host = server.host(); | 
| 544       } | 544       } | 
| 545       if (IsAlternativeServiceBroken(alternative_service)) { | 545       if (IsAlternativeServiceBroken(alternative_service)) { | 
| 546         alternative_service_string.append(" (broken)"); | 546         alternative_service_string.append(" (broken)"); | 
| 547       } | 547       } | 
| 548       alternative_service_list->Append( | 548       alternative_service_list->AppendString(alternative_service_string); | 
| 549           new base::StringValue(alternative_service_string)); |  | 
| 550     } | 549     } | 
| 551     if (alternative_service_list->empty()) | 550     if (alternative_service_list->empty()) | 
| 552       continue; | 551       continue; | 
| 553     std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); | 552     std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); | 
| 554     dict->SetString("server", server.Serialize()); | 553     dict->SetString("server", server.Serialize()); | 
| 555     dict->Set("alternative_service", std::unique_ptr<base::Value>( | 554     dict->Set("alternative_service", std::unique_ptr<base::Value>( | 
| 556                                          std::move(alternative_service_list))); | 555                                          std::move(alternative_service_list))); | 
| 557     dict_list->Append(std::move(dict)); | 556     dict_list->Append(std::move(dict)); | 
| 558   } | 557   } | 
| 559   return std::move(dict_list); | 558   return std::move(dict_list); | 
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 808   base::TimeDelta delay = when > now ? when - now : base::TimeDelta(); | 807   base::TimeDelta delay = when > now ? when - now : base::TimeDelta(); | 
| 809   base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 808   base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 
| 810       FROM_HERE, | 809       FROM_HERE, | 
| 811       base::Bind( | 810       base::Bind( | 
| 812           &HttpServerPropertiesImpl::ExpireBrokenAlternateProtocolMappings, | 811           &HttpServerPropertiesImpl::ExpireBrokenAlternateProtocolMappings, | 
| 813           weak_ptr_factory_.GetWeakPtr()), | 812           weak_ptr_factory_.GetWeakPtr()), | 
| 814       delay); | 813       delay); | 
| 815 } | 814 } | 
| 816 | 815 | 
| 817 }  // namespace net | 816 }  // namespace net | 
| OLD | NEW | 
|---|