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

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: git sync 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 <memory> 8 #include <memory>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); 549 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
550 dict->SetString("host_port_pair", host_port_pair.ToString()); 550 dict->SetString("host_port_pair", host_port_pair.ToString());
551 dict->Set("alternative_service", std::unique_ptr<base::Value>( 551 dict->Set("alternative_service", std::unique_ptr<base::Value>(
552 std::move(alternative_service_list))); 552 std::move(alternative_service_list)));
553 dict_list->Append(std::move(dict)); 553 dict_list->Append(std::move(dict));
554 } 554 }
555 return std::move(dict_list); 555 return std::move(dict_list);
556 } 556 }
557 557
558 const SettingsMap& HttpServerPropertiesImpl::GetSpdySettings( 558 const SettingsMap& HttpServerPropertiesImpl::GetSpdySettings(
559 const HostPortPair& host_port_pair) { 559 const url::SchemeHostPort& server) {
560 SpdySettingsMap::iterator it = spdy_settings_map_.Get(host_port_pair); 560 SpdySettingsMap::iterator it = spdy_settings_map_.Get(server);
561 if (it == spdy_settings_map_.end()) { 561 if (it == spdy_settings_map_.end()) {
562 CR_DEFINE_STATIC_LOCAL(SettingsMap, kEmptySettingsMap, ()); 562 CR_DEFINE_STATIC_LOCAL(SettingsMap, kEmptySettingsMap, ());
563 return kEmptySettingsMap; 563 return kEmptySettingsMap;
564 } 564 }
565 return it->second; 565 return it->second;
566 } 566 }
567 567
568 bool HttpServerPropertiesImpl::SetSpdySetting( 568 bool HttpServerPropertiesImpl::SetSpdySetting(const url::SchemeHostPort& server,
569 const HostPortPair& host_port_pair, 569 SpdySettingsIds id,
570 SpdySettingsIds id, 570 SpdySettingsFlags flags,
571 SpdySettingsFlags flags, 571 uint32_t value) {
572 uint32_t value) {
573 if (!(flags & SETTINGS_FLAG_PLEASE_PERSIST)) 572 if (!(flags & SETTINGS_FLAG_PLEASE_PERSIST))
574 return false; 573 return false;
575 574
576 SettingsFlagsAndValue flags_and_value(SETTINGS_FLAG_PERSISTED, value); 575 SettingsFlagsAndValue flags_and_value(SETTINGS_FLAG_PERSISTED, value);
577 SpdySettingsMap::iterator it = spdy_settings_map_.Get(host_port_pair); 576 SpdySettingsMap::iterator it = spdy_settings_map_.Get(server);
578 if (it == spdy_settings_map_.end()) { 577 if (it == spdy_settings_map_.end()) {
579 SettingsMap settings_map; 578 SettingsMap settings_map;
580 settings_map[id] = flags_and_value; 579 settings_map[id] = flags_and_value;
581 spdy_settings_map_.Put(host_port_pair, settings_map); 580 spdy_settings_map_.Put(server, settings_map);
582 } else { 581 } else {
583 SettingsMap& settings_map = it->second; 582 SettingsMap& settings_map = it->second;
584 settings_map[id] = flags_and_value; 583 settings_map[id] = flags_and_value;
585 } 584 }
586 return true; 585 return true;
587 } 586 }
588 587
589 void HttpServerPropertiesImpl::ClearSpdySettings( 588 void HttpServerPropertiesImpl::ClearSpdySettings(
590 const HostPortPair& host_port_pair) { 589 const url::SchemeHostPort& server) {
591 SpdySettingsMap::iterator it = spdy_settings_map_.Peek(host_port_pair); 590 SpdySettingsMap::iterator it = spdy_settings_map_.Peek(server);
592 if (it != spdy_settings_map_.end()) 591 if (it != spdy_settings_map_.end())
593 spdy_settings_map_.Erase(it); 592 spdy_settings_map_.Erase(it);
594 } 593 }
595 594
596 void HttpServerPropertiesImpl::ClearAllSpdySettings() { 595 void HttpServerPropertiesImpl::ClearAllSpdySettings() {
597 spdy_settings_map_.Clear(); 596 spdy_settings_map_.Clear();
598 } 597 }
599 598
600 const SpdySettingsMap& 599 const SpdySettingsMap&
601 HttpServerPropertiesImpl::spdy_settings_map() const { 600 HttpServerPropertiesImpl::spdy_settings_map() const {
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
800 base::TimeDelta delay = when > now ? when - now : base::TimeDelta(); 799 base::TimeDelta delay = when > now ? when - now : base::TimeDelta();
801 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 800 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
802 FROM_HERE, 801 FROM_HERE,
803 base::Bind( 802 base::Bind(
804 &HttpServerPropertiesImpl::ExpireBrokenAlternateProtocolMappings, 803 &HttpServerPropertiesImpl::ExpireBrokenAlternateProtocolMappings,
805 weak_ptr_factory_.GetWeakPtr()), 804 weak_ptr_factory_.GetWeakPtr()),
806 delay); 805 delay);
807 } 806 }
808 807
809 } // namespace net 808 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_server_properties_impl.h ('k') | net/http/http_server_properties_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698