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 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
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 11 matching lines...) Expand all Loading... |
22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
25 */ | 25 */ |
26 | 26 |
27 #include "config.h" | 27 #include "config.h" |
28 #include "KURL.h" | 28 #include "KURL.h" |
29 | 29 |
30 #include "DecodeEscapeSequences.h" | 30 #include "DecodeEscapeSequences.h" |
31 #include "MIMETypeRegistry.h" | 31 #include "MIMETypeRegistry.h" |
32 #include "PlatformMemoryInstrumentation.h" | |
33 #include "TextEncoding.h" | 32 #include "TextEncoding.h" |
34 #include <stdio.h> | 33 #include <stdio.h> |
35 #include <wtf/HashMap.h> | 34 #include <wtf/HashMap.h> |
36 #include <wtf/HexNumber.h> | 35 #include <wtf/HexNumber.h> |
37 #include <wtf/MemoryInstrumentationString.h> | |
38 #include <wtf/StdLibExtras.h> | 36 #include <wtf/StdLibExtras.h> |
39 #include <wtf/text/CString.h> | 37 #include <wtf/text/CString.h> |
40 #include <wtf/text/StringBuilder.h> | 38 #include <wtf/text/StringBuilder.h> |
41 #include <wtf/text/StringHash.h> | 39 #include <wtf/text/StringHash.h> |
42 | 40 |
43 #if USE(ICU_UNICODE) | 41 #if USE(ICU_UNICODE) |
44 #include <unicode/uidna.h> | 42 #include <unicode/uidna.h> |
45 #endif | 43 #endif |
46 | 44 |
47 // FIXME: This file makes too much use of the + operator on String. | 45 // FIXME: This file makes too much use of the + operator on String. |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 | 233 |
236 String mimeTypeFromURL(const KURL& url) | 234 String mimeTypeFromURL(const KURL& url) |
237 { | 235 { |
238 String decodedPath = decodeURLEscapeSequences(url.path()); | 236 String decodedPath = decodeURLEscapeSequences(url.path()); |
239 String extension = decodedPath.substring(decodedPath.reverseFind('.') + 1); | 237 String extension = decodedPath.substring(decodedPath.reverseFind('.') + 1); |
240 | 238 |
241 // We don't use MIMETypeRegistry::getMIMETypeForPath() because it returns "a
pplication/octet-stream" upon failure | 239 // We don't use MIMETypeRegistry::getMIMETypeForPath() because it returns "a
pplication/octet-stream" upon failure |
242 return MIMETypeRegistry::getMIMETypeForExtension(extension); | 240 return MIMETypeRegistry::getMIMETypeForExtension(extension); |
243 } | 241 } |
244 | 242 |
245 void KURL::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const | |
246 { | |
247 MemoryClassInfo info(memoryObjectInfo, this); | |
248 info.addMember(m_url, "url"); | |
249 } | |
250 | |
251 bool KURL::isSafeToSendToAnotherThread() const | 243 bool KURL::isSafeToSendToAnotherThread() const |
252 { | 244 { |
253 return m_url.isSafeToSendToAnotherThread(); | 245 return m_url.isSafeToSendToAnotherThread(); |
254 } | 246 } |
255 | 247 |
256 String KURL::elidedString() const | 248 String KURL::elidedString() const |
257 { | 249 { |
258 if (string().length() <= 1024) | 250 if (string().length() <= 1024) |
259 return string(); | 251 return string(); |
260 | 252 |
261 return string().left(511) + "..." + string().right(510); | 253 return string().left(511) + "..." + string().right(510); |
262 } | 254 } |
263 | 255 |
264 } | 256 } |
OLD | NEW |