OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2007, 2008, 2011, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2007, 2008, 2011, 2012 Apple Inc. All rights reserved. |
3 * Copyright (C) 2012 Research In Motion Limited. All rights reserved. | 3 * Copyright (C) 2012 Research In Motion Limited. All rights reserved. |
4 * Copyright (C) 2008, 2009, 2011 Google Inc. All rights reserved. | 4 * Copyright (C) 2008, 2009, 2011 Google Inc. All rights reserved. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 11 matching lines...) Expand all Loading... |
22 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 22 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
23 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 */ | 26 */ |
27 | 27 |
28 #include "platform/weborigin/KURL.h" | 28 #include "platform/weborigin/KURL.h" |
29 | 29 |
30 #include "platform/weborigin/KnownPorts.h" | 30 #include "platform/weborigin/KnownPorts.h" |
31 #include "url/url_util.h" | 31 #include "url/url_util.h" |
32 #include "wtf/PtrUtil.h" | |
33 #include "wtf/StdLibExtras.h" | 32 #include "wtf/StdLibExtras.h" |
34 #include "wtf/text/CString.h" | 33 #include "wtf/text/CString.h" |
35 #include "wtf/text/StringHash.h" | 34 #include "wtf/text/StringHash.h" |
36 #include "wtf/text/StringUTF8Adaptor.h" | 35 #include "wtf/text/StringUTF8Adaptor.h" |
37 #include "wtf/text/TextEncoding.h" | 36 #include "wtf/text/TextEncoding.h" |
38 #include <algorithm> | 37 #include <algorithm> |
39 #ifndef NDEBUG | 38 #ifndef NDEBUG |
40 #include <stdio.h> | 39 #include <stdio.h> |
41 #endif | 40 #endif |
42 | 41 |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 { | 267 { |
269 } | 268 } |
270 | 269 |
271 KURL::KURL(const KURL& other) | 270 KURL::KURL(const KURL& other) |
272 : m_isValid(other.m_isValid) | 271 : m_isValid(other.m_isValid) |
273 , m_protocolIsInHTTPFamily(other.m_protocolIsInHTTPFamily) | 272 , m_protocolIsInHTTPFamily(other.m_protocolIsInHTTPFamily) |
274 , m_parsed(other.m_parsed) | 273 , m_parsed(other.m_parsed) |
275 , m_string(other.m_string) | 274 , m_string(other.m_string) |
276 { | 275 { |
277 if (other.m_innerURL.get()) | 276 if (other.m_innerURL.get()) |
278 m_innerURL = wrapUnique(new KURL(other.m_innerURL->copy())); | 277 m_innerURL = adoptPtr(new KURL(other.m_innerURL->copy())); |
279 } | 278 } |
280 | 279 |
281 KURL::~KURL() | 280 KURL::~KURL() |
282 { | 281 { |
283 } | 282 } |
284 | 283 |
285 KURL& KURL::operator=(const KURL& other) | 284 KURL& KURL::operator=(const KURL& other) |
286 { | 285 { |
287 m_isValid = other.m_isValid; | 286 m_isValid = other.m_isValid; |
288 m_protocolIsInHTTPFamily = other.m_protocolIsInHTTPFamily; | 287 m_protocolIsInHTTPFamily = other.m_protocolIsInHTTPFamily; |
289 m_parsed = other.m_parsed; | 288 m_parsed = other.m_parsed; |
290 m_string = other.m_string; | 289 m_string = other.m_string; |
291 if (other.m_innerURL) | 290 if (other.m_innerURL) |
292 m_innerURL = wrapUnique(new KURL(other.m_innerURL->copy())); | 291 m_innerURL = adoptPtr(new KURL(other.m_innerURL->copy())); |
293 else | 292 else |
294 m_innerURL.reset(); | 293 m_innerURL.reset(); |
295 return *this; | 294 return *this; |
296 } | 295 } |
297 | 296 |
298 KURL KURL::copy() const | 297 KURL KURL::copy() const |
299 { | 298 { |
300 KURL result; | 299 KURL result; |
301 result.m_isValid = m_isValid; | 300 result.m_isValid = m_isValid; |
302 result.m_protocolIsInHTTPFamily = m_protocolIsInHTTPFamily; | 301 result.m_protocolIsInHTTPFamily = m_protocolIsInHTTPFamily; |
303 result.m_parsed = m_parsed; | 302 result.m_parsed = m_parsed; |
304 result.m_string = m_string.isolatedCopy(); | 303 result.m_string = m_string.isolatedCopy(); |
305 if (m_innerURL) | 304 if (m_innerURL) |
306 result.m_innerURL = wrapUnique(new KURL(m_innerURL->copy())); | 305 result.m_innerURL = adoptPtr(new KURL(m_innerURL->copy())); |
307 return result; | 306 return result; |
308 } | 307 } |
309 | 308 |
310 bool KURL::isNull() const | 309 bool KURL::isNull() const |
311 { | 310 { |
312 return m_string.isNull(); | 311 return m_string.isNull(); |
313 } | 312 } |
314 | 313 |
315 bool KURL::isEmpty() const | 314 bool KURL::isEmpty() const |
316 { | 315 { |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
812 m_string = AtomicString::fromUTF8(output.data(), output.length()); | 811 m_string = AtomicString::fromUTF8(output.data(), output.length()); |
813 } | 812 } |
814 | 813 |
815 void KURL::initInnerURL() | 814 void KURL::initInnerURL() |
816 { | 815 { |
817 if (!m_isValid) { | 816 if (!m_isValid) { |
818 m_innerURL.reset(); | 817 m_innerURL.reset(); |
819 return; | 818 return; |
820 } | 819 } |
821 if (url::Parsed* innerParsed = m_parsed.inner_parsed()) | 820 if (url::Parsed* innerParsed = m_parsed.inner_parsed()) |
822 m_innerURL = wrapUnique(new KURL(ParsedURLString, m_string.substring(inn
erParsed->scheme.begin, innerParsed->Length() - innerParsed->scheme.begin))); | 821 m_innerURL = adoptPtr(new KURL(ParsedURLString, m_string.substring(inner
Parsed->scheme.begin, innerParsed->Length() - innerParsed->scheme.begin))); |
823 else | 822 else |
824 m_innerURL.reset(); | 823 m_innerURL.reset(); |
825 } | 824 } |
826 | 825 |
827 template<typename CHAR> | 826 template<typename CHAR> |
828 bool internalProtocolIs(const url::Component& scheme, const CHAR* spec, const ch
ar* protocol) | 827 bool internalProtocolIs(const url::Component& scheme, const CHAR* spec, const ch
ar* protocol) |
829 { | 828 { |
830 const CHAR* begin = spec + scheme.begin; | 829 const CHAR* begin = spec + scheme.begin; |
831 const CHAR* end = begin + scheme.len; | 830 const CHAR* end = begin + scheme.len; |
832 | 831 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
915 m_string = AtomicString::fromUTF8(output.data(), output.length()); | 914 m_string = AtomicString::fromUTF8(output.data(), output.length()); |
916 } | 915 } |
917 | 916 |
918 bool KURL::isSafeToSendToAnotherThread() const | 917 bool KURL::isSafeToSendToAnotherThread() const |
919 { | 918 { |
920 return m_string.isSafeToSendToAnotherThread() | 919 return m_string.isSafeToSendToAnotherThread() |
921 && (!m_innerURL || m_innerURL->isSafeToSendToAnotherThread()); | 920 && (!m_innerURL || m_innerURL->isSafeToSendToAnotherThread()); |
922 } | 921 } |
923 | 922 |
924 } // namespace blink | 923 } // namespace blink |
OLD | NEW |