| 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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 | 283 |
| 284 KURL& KURL::operator=(const KURL& other) | 284 KURL& KURL::operator=(const KURL& other) |
| 285 { | 285 { |
| 286 m_isValid = other.m_isValid; | 286 m_isValid = other.m_isValid; |
| 287 m_protocolIsInHTTPFamily = other.m_protocolIsInHTTPFamily; | 287 m_protocolIsInHTTPFamily = other.m_protocolIsInHTTPFamily; |
| 288 m_parsed = other.m_parsed; | 288 m_parsed = other.m_parsed; |
| 289 m_string = other.m_string; | 289 m_string = other.m_string; |
| 290 if (other.m_innerURL) | 290 if (other.m_innerURL) |
| 291 m_innerURL = adoptPtr(new KURL(other.m_innerURL->copy())); | 291 m_innerURL = adoptPtr(new KURL(other.m_innerURL->copy())); |
| 292 else | 292 else |
| 293 m_innerURL.clear(); | 293 m_innerURL.reset(); |
| 294 return *this; | 294 return *this; |
| 295 } | 295 } |
| 296 | 296 |
| 297 KURL KURL::copy() const | 297 KURL KURL::copy() const |
| 298 { | 298 { |
| 299 KURL result; | 299 KURL result; |
| 300 result.m_isValid = m_isValid; | 300 result.m_isValid = m_isValid; |
| 301 result.m_protocolIsInHTTPFamily = m_protocolIsInHTTPFamily; | 301 result.m_protocolIsInHTTPFamily = m_protocolIsInHTTPFamily; |
| 302 result.m_parsed = m_parsed; | 302 result.m_parsed = m_parsed; |
| 303 result.m_string = m_string.isolatedCopy(); | 303 result.m_string = m_string.isolatedCopy(); |
| (...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 807 m_isValid = url::ResolveRelative(baseUTF8.data(), baseUTF8.length(), base.m_
parsed, relative, relativeLength, charsetConverter, &output, &m_parsed); | 807 m_isValid = url::ResolveRelative(baseUTF8.data(), baseUTF8.length(), base.m_
parsed, relative, relativeLength, charsetConverter, &output, &m_parsed); |
| 808 | 808 |
| 809 // See FIXME in KURLPrivate in the header. If canonicalization has not | 809 // See FIXME in KURLPrivate in the header. If canonicalization has not |
| 810 // changed the string, we can avoid an extra allocation by using assignment. | 810 // changed the string, we can avoid an extra allocation by using assignment. |
| 811 m_string = AtomicString::fromUTF8(output.data(), output.length()); | 811 m_string = AtomicString::fromUTF8(output.data(), output.length()); |
| 812 } | 812 } |
| 813 | 813 |
| 814 void KURL::initInnerURL() | 814 void KURL::initInnerURL() |
| 815 { | 815 { |
| 816 if (!m_isValid) { | 816 if (!m_isValid) { |
| 817 m_innerURL.clear(); | 817 m_innerURL.reset(); |
| 818 return; | 818 return; |
| 819 } | 819 } |
| 820 if (url::Parsed* innerParsed = m_parsed.inner_parsed()) | 820 if (url::Parsed* innerParsed = m_parsed.inner_parsed()) |
| 821 m_innerURL = adoptPtr(new KURL(ParsedURLString, m_string.substring(inner
Parsed->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))); |
| 822 else | 822 else |
| 823 m_innerURL.clear(); | 823 m_innerURL.reset(); |
| 824 } | 824 } |
| 825 | 825 |
| 826 template<typename CHAR> | 826 template<typename CHAR> |
| 827 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) |
| 828 { | 828 { |
| 829 const CHAR* begin = spec + scheme.begin; | 829 const CHAR* begin = spec + scheme.begin; |
| 830 const CHAR* end = begin + scheme.len; | 830 const CHAR* end = begin + scheme.len; |
| 831 | 831 |
| 832 while (begin != end && *protocol) { | 832 while (begin != end && *protocol) { |
| 833 ASSERT(toASCIILower(*protocol) == *protocol); | 833 ASSERT(toASCIILower(*protocol) == *protocol); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 914 m_string = AtomicString::fromUTF8(output.data(), output.length()); | 914 m_string = AtomicString::fromUTF8(output.data(), output.length()); |
| 915 } | 915 } |
| 916 | 916 |
| 917 bool KURL::isSafeToSendToAnotherThread() const | 917 bool KURL::isSafeToSendToAnotherThread() const |
| 918 { | 918 { |
| 919 return m_string.isSafeToSendToAnotherThread() | 919 return m_string.isSafeToSendToAnotherThread() |
| 920 && (!m_innerURL || m_innerURL->isSafeToSendToAnotherThread()); | 920 && (!m_innerURL || m_innerURL->isSafeToSendToAnotherThread()); |
| 921 } | 921 } |
| 922 | 922 |
| 923 } // namespace blink | 923 } // namespace blink |
| OLD | NEW |