Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Side by Side Diff: net/http/http_server_properties_impl.cc

Issue 1866983006: SHP 2: Change SpdySettingsMap to use SchemeHostPort as the key. No change to Pref data. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@SHP_1
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); 548 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
549 dict->SetString("host_port_pair", host_port_pair.ToString()); 549 dict->SetString("host_port_pair", host_port_pair.ToString());
550 dict->Set("alternative_service", 550 dict->Set("alternative_service",
551 scoped_ptr<base::Value>(std::move(alternative_service_list))); 551 scoped_ptr<base::Value>(std::move(alternative_service_list)));
552 dict_list->Append(std::move(dict)); 552 dict_list->Append(std::move(dict));
553 } 553 }
554 return std::move(dict_list); 554 return std::move(dict_list);
555 } 555 }
556 556
557 const SettingsMap& HttpServerPropertiesImpl::GetSpdySettings( 557 const SettingsMap& HttpServerPropertiesImpl::GetSpdySettings(
558 const HostPortPair& host_port_pair) { 558 const url::SchemeHostPort& server) {
559 SpdySettingsMap::iterator it = spdy_settings_map_.Get(host_port_pair); 559 SpdySettingsMap::iterator it = spdy_settings_map_.Get(server);
560 if (it == spdy_settings_map_.end()) { 560 if (it == spdy_settings_map_.end()) {
561 CR_DEFINE_STATIC_LOCAL(SettingsMap, kEmptySettingsMap, ()); 561 CR_DEFINE_STATIC_LOCAL(SettingsMap, kEmptySettingsMap, ());
562 return kEmptySettingsMap; 562 return kEmptySettingsMap;
563 } 563 }
564 return it->second; 564 return it->second;
565 } 565 }
566 566
567 bool HttpServerPropertiesImpl::SetSpdySetting( 567 bool HttpServerPropertiesImpl::SetSpdySetting(
568 const HostPortPair& host_port_pair, 568 const url::SchemeHostPort& server,
569 SpdySettingsIds id, 569 SpdySettingsIds id,
570 SpdySettingsFlags flags, 570 SpdySettingsFlags flags,
571 uint32_t value) { 571 uint32_t value) {
572 if (!(flags & SETTINGS_FLAG_PLEASE_PERSIST)) 572 if (!(flags & SETTINGS_FLAG_PLEASE_PERSIST))
573 return false; 573 return false;
574 574
575 SettingsFlagsAndValue flags_and_value(SETTINGS_FLAG_PERSISTED, value); 575 SettingsFlagsAndValue flags_and_value(SETTINGS_FLAG_PERSISTED, value);
576 SpdySettingsMap::iterator it = spdy_settings_map_.Get(host_port_pair); 576 SpdySettingsMap::iterator it = spdy_settings_map_.Get(server);
577 if (it == spdy_settings_map_.end()) { 577 if (it == spdy_settings_map_.end()) {
578 SettingsMap settings_map; 578 SettingsMap settings_map;
579 settings_map[id] = flags_and_value; 579 settings_map[id] = flags_and_value;
580 spdy_settings_map_.Put(host_port_pair, settings_map); 580 spdy_settings_map_.Put(server, settings_map);
581 } else { 581 } else {
582 SettingsMap& settings_map = it->second; 582 SettingsMap& settings_map = it->second;
583 settings_map[id] = flags_and_value; 583 settings_map[id] = flags_and_value;
584 } 584 }
585 return true; 585 return true;
586 } 586 }
587 587
588 void HttpServerPropertiesImpl::ClearSpdySettings( 588 void HttpServerPropertiesImpl::ClearSpdySettings(
589 const HostPortPair& host_port_pair) { 589 const url::SchemeHostPort& server) {
590 SpdySettingsMap::iterator it = spdy_settings_map_.Peek(host_port_pair); 590 SpdySettingsMap::iterator it = spdy_settings_map_.Peek(server);
591 if (it != spdy_settings_map_.end()) 591 if (it != spdy_settings_map_.end())
592 spdy_settings_map_.Erase(it); 592 spdy_settings_map_.Erase(it);
593 } 593 }
594 594
595 void HttpServerPropertiesImpl::ClearAllSpdySettings() { 595 void HttpServerPropertiesImpl::ClearAllSpdySettings() {
596 spdy_settings_map_.Clear(); 596 spdy_settings_map_.Clear();
597 } 597 }
598 598
599 const SpdySettingsMap& 599 const SpdySettingsMap&
600 HttpServerPropertiesImpl::spdy_settings_map() const { 600 HttpServerPropertiesImpl::spdy_settings_map() const {
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 base::TimeDelta delay = when > now ? when - now : base::TimeDelta(); 799 base::TimeDelta delay = when > now ? when - now : base::TimeDelta();
800 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 800 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
801 FROM_HERE, 801 FROM_HERE,
802 base::Bind( 802 base::Bind(
803 &HttpServerPropertiesImpl::ExpireBrokenAlternateProtocolMappings, 803 &HttpServerPropertiesImpl::ExpireBrokenAlternateProtocolMappings,
804 weak_ptr_factory_.GetWeakPtr()), 804 weak_ptr_factory_.GetWeakPtr()),
805 delay); 805 delay);
806 } 806 }
807 807
808 } // namespace net 808 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698