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

Unified Diff: net/http/transport_security_state.cc

Issue 2910473005: Deprecate NonThreadSafe in net/ in favor of SequenceChecker/ThreadChecker. (Closed)
Patch Set: another compile nit Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: net/http/transport_security_state.cc
diff --git a/net/http/transport_security_state.cc b/net/http/transport_security_state.cc
index 3971eb387429ebc1ed99e8f8a885732e6dcb176e..b2f5cc234409df20f36df7cf2f13d7efdbb64dae 100644
--- a/net/http/transport_security_state.cc
+++ b/net/http/transport_security_state.cc
@@ -749,7 +749,7 @@ TransportSecurityState::TransportSecurityState()
enable_static_pins_ = false;
enable_static_expect_ct_ = false;
#endif
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
}
// Both HSTS and HPKP cause fatal SSL errors, so return true if a
@@ -811,7 +811,7 @@ void TransportSecurityState::CheckExpectStaple(
const HostPortPair& host_port_pair,
const SSLInfo& ssl_info,
base::StringPiece ocsp_response) {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
if (!enable_static_expect_staple_ || !report_sender_ ||
!ssl_info.is_issued_by_known_root) {
return;
@@ -974,24 +974,24 @@ TransportSecurityState::CheckCTRequirements(
void TransportSecurityState::SetDelegate(
TransportSecurityState::Delegate* delegate) {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
delegate_ = delegate;
}
void TransportSecurityState::SetReportSender(
TransportSecurityState::ReportSenderInterface* report_sender) {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
report_sender_ = report_sender;
}
void TransportSecurityState::SetExpectCTReporter(
ExpectCTReporter* expect_ct_reporter) {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
expect_ct_reporter_ = expect_ct_reporter;
}
void TransportSecurityState::SetRequireCTDelegate(RequireCTDelegate* delegate) {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
require_ct_delegate_ = delegate;
}
@@ -1000,7 +1000,7 @@ void TransportSecurityState::AddHSTSInternal(
TransportSecurityState::STSState::UpgradeMode upgrade_mode,
const base::Time& expiry,
bool include_subdomains) {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
STSState sts_state;
sts_state.last_observed = base::Time::Now();
@@ -1017,7 +1017,7 @@ void TransportSecurityState::AddHPKPInternal(const std::string& host,
bool include_subdomains,
const HashValueVector& hashes,
const GURL& report_uri) {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
PKPState pkp_state;
pkp_state.last_observed = last_observed;
@@ -1035,7 +1035,7 @@ void TransportSecurityState::AddExpectCTInternal(
const base::Time& expiry,
bool enforce,
const GURL& report_uri) {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
ExpectCTState expect_ct_state;
expect_ct_state.last_observed = last_observed;
@@ -1053,7 +1053,7 @@ void TransportSecurityState::
void TransportSecurityState::EnableSTSHost(const std::string& host,
const STSState& state) {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
const std::string canonicalized_host = CanonicalizeHost(host);
if (canonicalized_host.empty())
@@ -1078,7 +1078,7 @@ void TransportSecurityState::EnableSTSHost(const std::string& host,
void TransportSecurityState::EnablePKPHost(const std::string& host,
const PKPState& state) {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
const std::string canonicalized_host = CanonicalizeHost(host);
if (canonicalized_host.empty())
@@ -1103,7 +1103,7 @@ void TransportSecurityState::EnablePKPHost(const std::string& host,
void TransportSecurityState::EnableExpectCTHost(const std::string& host,
const ExpectCTState& state) {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
if (!IsDynamicExpectCTEnabled())
return;
@@ -1186,7 +1186,7 @@ TransportSecurityState::CheckPinsAndMaybeSendReport(
bool TransportSecurityState::GetStaticExpectCTState(
const std::string& host,
ExpectCTState* expect_ct_state) const {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
if (!IsBuildTimely())
return false;
@@ -1207,7 +1207,7 @@ bool TransportSecurityState::GetStaticExpectCTState(
bool TransportSecurityState::GetStaticExpectStapleState(
const std::string& host,
ExpectStapleState* expect_staple_state) const {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
if (!IsBuildTimely())
return false;
@@ -1229,7 +1229,7 @@ bool TransportSecurityState::GetStaticExpectStapleState(
}
bool TransportSecurityState::DeleteDynamicDataForHost(const std::string& host) {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
const std::string canonicalized_host = CanonicalizeHost(host);
if (canonicalized_host.empty())
@@ -1262,14 +1262,14 @@ bool TransportSecurityState::DeleteDynamicDataForHost(const std::string& host) {
}
void TransportSecurityState::ClearDynamicData() {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
enabled_sts_hosts_.clear();
enabled_pkp_hosts_.clear();
enabled_expect_ct_hosts_.clear();
}
void TransportSecurityState::DeleteAllDynamicDataSince(const base::Time& time) {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
bool dirtied = false;
STSStateMap::iterator sts_iterator = enabled_sts_hosts_.begin();
@@ -1311,11 +1311,11 @@ void TransportSecurityState::DeleteAllDynamicDataSince(const base::Time& time) {
}
TransportSecurityState::~TransportSecurityState() {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
}
void TransportSecurityState::DirtyNotify() {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
if (delegate_)
delegate_->StateIsDirty(this);
@@ -1323,7 +1323,7 @@ void TransportSecurityState::DirtyNotify() {
bool TransportSecurityState::AddHSTSHeader(const std::string& host,
const std::string& value) {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
base::Time now = base::Time::Now();
base::TimeDelta max_age;
@@ -1347,7 +1347,7 @@ bool TransportSecurityState::AddHSTSHeader(const std::string& host,
bool TransportSecurityState::AddHPKPHeader(const std::string& host,
const std::string& value,
const SSLInfo& ssl_info) {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
base::Time now = base::Time::Now();
base::TimeDelta max_age;
@@ -1370,7 +1370,7 @@ bool TransportSecurityState::AddHPKPHeader(const std::string& host,
void TransportSecurityState::AddHSTS(const std::string& host,
const base::Time& expiry,
bool include_subdomains) {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
AddHSTSInternal(host, STSState::MODE_FORCE_HTTPS, expiry, include_subdomains);
}
@@ -1379,7 +1379,7 @@ void TransportSecurityState::AddHPKP(const std::string& host,
bool include_subdomains,
const HashValueVector& hashes,
const GURL& report_uri) {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
AddHPKPInternal(host, base::Time::Now(), expiry, include_subdomains, hashes,
report_uri);
}
@@ -1388,7 +1388,7 @@ void TransportSecurityState::AddExpectCT(const std::string& host,
const base::Time& expiry,
bool enforce,
const GURL& report_uri) {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
AddExpectCTInternal(host, base::Time::Now(), expiry, enforce, report_uri);
}
@@ -1396,7 +1396,7 @@ bool TransportSecurityState::ProcessHPKPReportOnlyHeader(
const std::string& value,
const HostPortPair& host_port_pair,
const SSLInfo& ssl_info) {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
base::Time now = base::Time::Now();
bool include_subdomains;
@@ -1429,7 +1429,7 @@ void TransportSecurityState::ProcessExpectCTHeader(
const std::string& value,
const HostPortPair& host_port_pair,
const SSLInfo& ssl_info) {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
// If a site sends `Expect-CT: preload` and appears on the preload list, they
// are in the experimental preload-list-only, report-only version of
@@ -1539,7 +1539,7 @@ TransportSecurityState::CheckPublicKeyPinsImpl(
bool TransportSecurityState::GetStaticDomainState(const std::string& host,
STSState* sts_state,
PKPState* pkp_state) const {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
sts_state->upgrade_mode = STSState::MODE_FORCE_HTTPS;
sts_state->include_subdomains = false;
@@ -1593,7 +1593,7 @@ bool TransportSecurityState::GetStaticDomainState(const std::string& host,
}
bool TransportSecurityState::IsGooglePinnedHost(const std::string& host) const {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
if (!IsBuildTimely())
return false;
@@ -1613,7 +1613,7 @@ bool TransportSecurityState::IsGooglePinnedHost(const std::string& host) const {
bool TransportSecurityState::GetDynamicSTSState(const std::string& host,
STSState* result) {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
const std::string canonicalized_host = CanonicalizeHost(host);
if (canonicalized_host.empty())
@@ -1654,7 +1654,7 @@ bool TransportSecurityState::GetDynamicSTSState(const std::string& host,
bool TransportSecurityState::GetDynamicPKPState(const std::string& host,
PKPState* result) {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
const std::string canonicalized_host = CanonicalizeHost(host);
if (canonicalized_host.empty())
@@ -1695,7 +1695,7 @@ bool TransportSecurityState::GetDynamicPKPState(const std::string& host,
bool TransportSecurityState::GetDynamicExpectCTState(const std::string& host,
ExpectCTState* result) {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
const std::string canonicalized_host = CanonicalizeHost(host);
if (canonicalized_host.empty())
@@ -1720,7 +1720,7 @@ bool TransportSecurityState::GetDynamicExpectCTState(const std::string& host,
void TransportSecurityState::AddOrUpdateEnabledSTSHosts(
const std::string& hashed_host,
const STSState& state) {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(state.ShouldUpgradeToSSL());
enabled_sts_hosts_[hashed_host] = state;
}
@@ -1728,7 +1728,7 @@ void TransportSecurityState::AddOrUpdateEnabledSTSHosts(
void TransportSecurityState::AddOrUpdateEnabledPKPHosts(
const std::string& hashed_host,
const PKPState& state) {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(state.HasPublicKeyPins());
enabled_pkp_hosts_[hashed_host] = state;
}
@@ -1736,7 +1736,7 @@ void TransportSecurityState::AddOrUpdateEnabledPKPHosts(
void TransportSecurityState::AddOrUpdateEnabledExpectCTHosts(
const std::string& hashed_host,
const ExpectCTState& state) {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(state.enforce || !state.report_uri.is_empty());
enabled_expect_ct_hosts_[hashed_host] = state;
}
@@ -1777,7 +1777,7 @@ TransportSecurityState::ExpectCTStateIterator::ExpectCTStateIterator(
const TransportSecurityState& state)
: iterator_(state.enabled_expect_ct_hosts_.begin()),
end_(state.enabled_expect_ct_hosts_.end()) {
- DCHECK(state.CalledOnValidThread());
+ state.AssertCalledOnValidSequence();
}
TransportSecurityState::ExpectCTStateIterator::~ExpectCTStateIterator() {}

Powered by Google App Engine
This is Rietveld 408576698