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

Unified Diff: Source/platform/weborigin/SecurityOrigin.cpp

Issue 123003002: Make calls to AtomicString(const String&) explicit in loader/ and fetch/ (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 6 years, 12 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
« no previous file with comments | « Source/platform/weborigin/SecurityOrigin.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/weborigin/SecurityOrigin.cpp
diff --git a/Source/platform/weborigin/SecurityOrigin.cpp b/Source/platform/weborigin/SecurityOrigin.cpp
index 95fbf48842cdf409d9294cdd2ff453f9ec2d382e..bacb7ba42f1a30cb2c22368b50baa2e81c1beca5 100644
--- a/Source/platform/weborigin/SecurityOrigin.cpp
+++ b/Source/platform/weborigin/SecurityOrigin.cpp
@@ -418,23 +418,46 @@ String SecurityOrigin::toString() const
return toRawString();
}
+AtomicString SecurityOrigin::toAtomicString() const
+{
+ if (isUnique())
+ return AtomicString("null", AtomicString::ConstructFromLiteral);
+ if (m_protocol == "file" && m_enforceFilePathSeparation)
+ return AtomicString("null", AtomicString::ConstructFromLiteral);
+ return toRawAtomicString();
+}
+
String SecurityOrigin::toRawString() const
{
if (m_protocol == "file")
return "file://";
StringBuilder result;
- result.reserveCapacity(m_protocol.length() + m_host.length() + 10);
- result.append(m_protocol);
- result.append("://");
- result.append(m_host);
+ buildRawString(result);
+ return result.toString();
+}
+
+AtomicString SecurityOrigin::toRawAtomicString() const
+{
+ if (m_protocol == "file")
+ return AtomicString("file://", AtomicString::ConstructFromLiteral);
+
+ StringBuilder result;
+ buildRawString(result);
+ return result.toAtomicString();
+}
+
+inline void SecurityOrigin::buildRawString(StringBuilder& builder) const
+{
+ builder.reserveCapacity(m_protocol.length() + m_host.length() + 10);
+ builder.append(m_protocol);
+ builder.appendLiteral("://");
+ builder.append(m_host);
if (m_port) {
- result.append(':');
- result.appendNumber(m_port);
+ builder.append(':');
+ builder.appendNumber(m_port);
}
-
- return result.toString();
}
PassRefPtr<SecurityOrigin> SecurityOrigin::createFromString(const String& originString)
« no previous file with comments | « Source/platform/weborigin/SecurityOrigin.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698