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

Side by Side Diff: third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp

Issue 2668903003: Replace WTF::emptyString{16Bit}() with a static global (Closed)
Patch Set: Replace WTF::emptyString{16Bit}() with a static global Created 3 years, 10 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 /* 1 /*
2 * Copyright (C) 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2007 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 m_host(url.host()), 116 m_host(url.host()),
117 m_port(url.port()), 117 m_port(url.port()),
118 m_effectivePort(url.port() ? url.port() 118 m_effectivePort(url.port() ? url.port()
119 : defaultPortForProtocol(m_protocol)), 119 : defaultPortForProtocol(m_protocol)),
120 m_isUnique(false), 120 m_isUnique(false),
121 m_universalAccess(false), 121 m_universalAccess(false),
122 m_domainWasSetInDOM(false), 122 m_domainWasSetInDOM(false),
123 m_blockLocalAccessFromLocalOrigin(false), 123 m_blockLocalAccessFromLocalOrigin(false),
124 m_isUniqueOriginPotentiallyTrustworthy(false) { 124 m_isUniqueOriginPotentiallyTrustworthy(false) {
125 if (m_protocol.isNull()) 125 if (m_protocol.isNull())
126 m_protocol = emptyString(); 126 m_protocol = emptyString;
127 if (m_host.isNull()) 127 if (m_host.isNull())
128 m_host = emptyString(); 128 m_host = emptyString;
129 129
130 // Suborigins are serialized into the host, so extract it if necessary. 130 // Suborigins are serialized into the host, so extract it if necessary.
131 String suboriginName; 131 String suboriginName;
132 if (deserializeSuboriginAndProtocolAndHost(m_protocol, m_host, suboriginName, 132 if (deserializeSuboriginAndProtocolAndHost(m_protocol, m_host, suboriginName,
133 m_protocol, m_host)) { 133 m_protocol, m_host)) {
134 if (!url.port()) 134 if (!url.port())
135 m_effectivePort = defaultPortForProtocol(m_protocol); 135 m_effectivePort = defaultPortForProtocol(m_protocol);
136 136
137 m_suborigin.setName(suboriginName); 137 m_suborigin.setName(suboriginName);
138 } 138 }
139 139
140 // document.domain starts as m_host, but can be set by the DOM. 140 // document.domain starts as m_host, but can be set by the DOM.
141 m_domain = m_host; 141 m_domain = m_host;
142 142
143 if (isDefaultPortForProtocol(m_port, m_protocol)) 143 if (isDefaultPortForProtocol(m_port, m_protocol))
144 m_port = InvalidPort; 144 m_port = InvalidPort;
145 145
146 // By default, only local SecurityOrigins can load local resources. 146 // By default, only local SecurityOrigins can load local resources.
147 m_canLoadLocalResources = isLocal(); 147 m_canLoadLocalResources = isLocal();
148 } 148 }
149 149
150 SecurityOrigin::SecurityOrigin() 150 SecurityOrigin::SecurityOrigin()
151 : m_protocol(emptyString()), 151 : m_protocol(emptyString),
152 m_host(emptyString()), 152 m_host(emptyString),
153 m_domain(emptyString()), 153 m_domain(emptyString),
154 m_port(InvalidPort), 154 m_port(InvalidPort),
155 m_effectivePort(InvalidPort), 155 m_effectivePort(InvalidPort),
156 m_isUnique(true), 156 m_isUnique(true),
157 m_universalAccess(false), 157 m_universalAccess(false),
158 m_domainWasSetInDOM(false), 158 m_domainWasSetInDOM(false),
159 m_canLoadLocalResources(false), 159 m_canLoadLocalResources(false),
160 m_blockLocalAccessFromLocalOrigin(false), 160 m_blockLocalAccessFromLocalOrigin(false),
161 m_isUniqueOriginPotentiallyTrustworthy(false) {} 161 m_isUniqueOriginPotentiallyTrustworthy(false) {}
162 162
163 SecurityOrigin::SecurityOrigin(const SecurityOrigin* other) 163 SecurityOrigin::SecurityOrigin(const SecurityOrigin* other)
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 utf8.data(), url::Component(0, utf8.length()), &canonOutput, &outHost); 618 utf8.data(), url::Component(0, utf8.length()), &canonOutput, &outHost);
619 } else { 619 } else {
620 *success = url::CanonicalizeHost(host.characters16(), 620 *success = url::CanonicalizeHost(host.characters16(),
621 url::Component(0, host.length()), 621 url::Component(0, host.length()),
622 &canonOutput, &outHost); 622 &canonOutput, &outHost);
623 } 623 }
624 return String::fromUTF8(canonOutput.data(), canonOutput.length()); 624 return String::fromUTF8(canonOutput.data(), canonOutput.length());
625 } 625 }
626 626
627 } // namespace blink 627 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/weborigin/KnownPorts.cpp ('k') | third_party/WebKit/Source/web/tests/KeyboardTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698