OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
| 3 * Copyright (C) 2009 Torch Mobile, Inc. http://www.torchmobile.com/ |
3 * | 4 * |
4 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
6 * are met: | 7 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 11 * notice, this list of conditions and the following disclaimer in the |
11 * documentation and/or other materials provided with the distribution. | 12 * documentation and/or other materials provided with the distribution. |
12 * | 13 * |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 m_cssRuleValue.clear(); | 122 m_cssRuleValue.clear(); |
122 } | 123 } |
123 | 124 |
124 bool PreloadScanner::scanningBody() const | 125 bool PreloadScanner::scanningBody() const |
125 { | 126 { |
126 return m_document->body() || m_bodySeen; | 127 return m_document->body() || m_bodySeen; |
127 } | 128 } |
128 | 129 |
129 void PreloadScanner::write(const SegmentedString& source) | 130 void PreloadScanner::write(const SegmentedString& source) |
130 { | 131 { |
| 132 #if PRELOAD_DEBUG |
131 double startTime = currentTime(); | 133 double startTime = currentTime(); |
| 134 #endif |
132 tokenize(source); | 135 tokenize(source); |
| 136 #if PRELOAD_DEBUG |
133 m_timeUsed += currentTime() - startTime; | 137 m_timeUsed += currentTime() - startTime; |
| 138 #endif |
134 } | 139 } |
135 | 140 |
136 static inline bool isWhitespace(UChar c) | 141 static inline bool isWhitespace(UChar c) |
137 { | 142 { |
138 return c == ' ' || c == '\n' || c == '\r' || c == '\t'; | 143 return c == ' ' || c == '\n' || c == '\r' || c == '\t'; |
139 } | 144 } |
140 | 145 |
141 inline void PreloadScanner::clearLastCharacters() | 146 inline void PreloadScanner::clearLastCharacters() |
142 { | 147 { |
143 memset(m_lastCharacters, 0, lastCharactersBufferSize * sizeof(UChar)); | 148 memset(m_lastCharacters, 0, lastCharactersBufferSize * sizeof(UChar)); |
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
844 String value(m_cssRuleValue.data(), m_cssRuleValue.size()); | 849 String value(m_cssRuleValue.data(), m_cssRuleValue.size()); |
845 String url = parseURL(value); | 850 String url = parseURL(value); |
846 if (!url.isEmpty()) | 851 if (!url.isEmpty()) |
847 m_document->docLoader()->preload(CachedResource::CSSStyleSheet, url,
String(), scanningBody()); | 852 m_document->docLoader()->preload(CachedResource::CSSStyleSheet, url,
String(), scanningBody()); |
848 } | 853 } |
849 m_cssRule.clear(); | 854 m_cssRule.clear(); |
850 m_cssRuleValue.clear(); | 855 m_cssRuleValue.clear(); |
851 } | 856 } |
852 | 857 |
853 } | 858 } |
OLD | NEW |