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

Unified Diff: third_party/WebKit/Source/core/frame/csp/CSPSource.cpp

Issue 2551843002: Embedding-CSP: Adding `const` to method signatures. (Closed)
Patch Set: Rebasing Created 4 years 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: third_party/WebKit/Source/core/frame/csp/CSPSource.cpp
diff --git a/third_party/WebKit/Source/core/frame/csp/CSPSource.cpp b/third_party/WebKit/Source/core/frame/csp/CSPSource.cpp
index badd121b42fb58f00ff9b7a6fb6336432a1d05e9..bbde1965e3c178aae9988bbe2c567b2fee718169 100644
--- a/third_party/WebKit/Source/core/frame/csp/CSPSource.cpp
+++ b/third_party/WebKit/Source/core/frame/csp/CSPSource.cpp
@@ -105,7 +105,7 @@ bool CSPSource::portMatches(int port, const String& protocol) const {
return false;
}
-bool CSPSource::subsumes(CSPSource* other) {
+bool CSPSource::subsumes(CSPSource* other) const {
if (!schemeMatches(other->m_scheme))
return false;
@@ -124,7 +124,7 @@ bool CSPSource::subsumes(CSPSource* other) {
return hostSubsumes && portSubsumes && pathSubsumes;
}
-bool CSPSource::isSimilar(CSPSource* other) {
+bool CSPSource::isSimilar(CSPSource* other) const {
bool schemesMatch =
schemeMatches(other->m_scheme) || other->schemeMatches(m_scheme);
if (!schemesMatch || isSchemeOnly() || other->isSchemeOnly())
@@ -140,13 +140,13 @@ bool CSPSource::isSimilar(CSPSource* other) {
return false;
}
-CSPSource* CSPSource::intersect(CSPSource* other) {
+CSPSource* CSPSource::intersect(CSPSource* other) const {
if (!isSimilar(other))
return nullptr;
String scheme = other->schemeMatches(m_scheme) ? m_scheme : other->m_scheme;
if (isSchemeOnly() || other->isSchemeOnly()) {
- CSPSource* stricter = isSchemeOnly() ? other : this;
+ const CSPSource* stricter = isSchemeOnly() ? other : this;
return new CSPSource(m_policy, scheme, stricter->m_host, stricter->m_port,
stricter->m_path, stricter->m_hostWildcard,
stricter->m_portWildcard);
@@ -169,8 +169,9 @@ bool CSPSource::isSchemeOnly() const {
return m_host.isEmpty();
}
-bool CSPSource::firstSubsumesSecond(HeapVector<Member<CSPSource>> listA,
- HeapVector<Member<CSPSource>> listB) {
+bool CSPSource::firstSubsumesSecond(
+ const HeapVector<Member<CSPSource>>& listA,
+ const HeapVector<Member<CSPSource>>& listB) {
// Empty vector of CSPSources has an effect of 'none'.
if (!listA.size() || !listB.size())
return !listB.size();
« no previous file with comments | « third_party/WebKit/Source/core/frame/csp/CSPSource.h ('k') | third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698