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

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: remove commented line 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(const url::SchemeHostPort& server,
568 const HostPortPair& host_port_pair, 568 SpdySettingsIds id,
569 SpdySettingsIds id, 569 SpdySettingsFlags flags,
570 SpdySettingsFlags flags, 570 uint32_t value) {
571 uint32_t value) {
572 if (!(flags & SETTINGS_FLAG_PLEASE_PERSIST)) 571 if (!(flags & SETTINGS_FLAG_PLEASE_PERSIST))
573 return false; 572 return false;
574 573
575 SettingsFlagsAndValue flags_and_value(SETTINGS_FLAG_PERSISTED, value); 574 SettingsFlagsAndValue flags_and_value(SETTINGS_FLAG_PERSISTED, value);
576 SpdySettingsMap::iterator it = spdy_settings_map_.Get(host_port_pair); 575 SpdySettingsMap::iterator it = spdy_settings_map_.Get(server);
577 if (it == spdy_settings_map_.end()) { 576 if (it == spdy_settings_map_.end()) {
578 SettingsMap settings_map; 577 SettingsMap settings_map;
579 settings_map[id] = flags_and_value; 578 settings_map[id] = flags_and_value;
580 spdy_settings_map_.Put(host_port_pair, settings_map); 579 spdy_settings_map_.Put(server, settings_map);
581 } else { 580 } else {
582 SettingsMap& settings_map = it->second; 581 SettingsMap& settings_map = it->second;
583 settings_map[id] = flags_and_value; 582 settings_map[id] = flags_and_value;
584 } 583 }
585 return true; 584 return true;
586 } 585 }
587 586
588 void HttpServerPropertiesImpl::ClearSpdySettings( 587 void HttpServerPropertiesImpl::ClearSpdySettings(
589 const HostPortPair& host_port_pair) { 588 const url::SchemeHostPort& server) {
590 SpdySettingsMap::iterator it = spdy_settings_map_.Peek(host_port_pair); 589 SpdySettingsMap::iterator it = spdy_settings_map_.Peek(server);
591 if (it != spdy_settings_map_.end()) 590 if (it != spdy_settings_map_.end())
592 spdy_settings_map_.Erase(it); 591 spdy_settings_map_.Erase(it);
593 } 592 }
594 593
595 void HttpServerPropertiesImpl::ClearAllSpdySettings() { 594 void HttpServerPropertiesImpl::ClearAllSpdySettings() {
596 spdy_settings_map_.Clear(); 595 spdy_settings_map_.Clear();
597 } 596 }
598 597
599 const SpdySettingsMap& 598 const SpdySettingsMap&
600 HttpServerPropertiesImpl::spdy_settings_map() const { 599 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(); 798 base::TimeDelta delay = when > now ? when - now : base::TimeDelta();
800 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 799 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
801 FROM_HERE, 800 FROM_HERE,
802 base::Bind( 801 base::Bind(
803 &HttpServerPropertiesImpl::ExpireBrokenAlternateProtocolMappings, 802 &HttpServerPropertiesImpl::ExpireBrokenAlternateProtocolMappings,
804 weak_ptr_factory_.GetWeakPtr()), 803 weak_ptr_factory_.GetWeakPtr()),
805 delay); 804 delay);
806 } 805 }
807 806
808 } // namespace net 807 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698