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 * Copyright (C) 2009 Torch Mobile, Inc. http://www.torchmobile.com/ |
4 * Copyright (C) 2010 Google Inc. All Rights Reserved. | 4 * Copyright (C) 2010 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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 | 386 |
387 void HTMLPreloadScanner::appendToEnd(const SegmentedString& source) | 387 void HTMLPreloadScanner::appendToEnd(const SegmentedString& source) |
388 { | 388 { |
389 m_source.append(source); | 389 m_source.append(source); |
390 } | 390 } |
391 | 391 |
392 void HTMLPreloadScanner::scan(HTMLResourcePreloader* preloader, const KURL& star
tingBaseElementURL) | 392 void HTMLPreloadScanner::scan(HTMLResourcePreloader* preloader, const KURL& star
tingBaseElementURL) |
393 { | 393 { |
394 ASSERT(isMainThread()); // HTMLTokenizer::updateStateFor only works on the m
ain thread. | 394 ASSERT(isMainThread()); // HTMLTokenizer::updateStateFor only works on the m
ain thread. |
395 | 395 |
| 396 TRACE_EVENT1("webkit", "HTMLPreloadScanner::scan", "source_length", m_source
.length()); |
| 397 |
396 // When we start scanning, our best prediction of the baseElementURL is the
real one! | 398 // When we start scanning, our best prediction of the baseElementURL is the
real one! |
397 if (!startingBaseElementURL.isEmpty()) | 399 if (!startingBaseElementURL.isEmpty()) |
398 m_scanner.setPredictedBaseElementURL(startingBaseElementURL); | 400 m_scanner.setPredictedBaseElementURL(startingBaseElementURL); |
399 | 401 |
400 PreloadRequestStream requests; | 402 PreloadRequestStream requests; |
401 | 403 |
402 while (m_tokenizer->nextToken(m_source, m_token)) { | 404 while (m_tokenizer->nextToken(m_source, m_token)) { |
403 if (m_token.type() == HTMLToken::StartTag) | 405 if (m_token.type() == HTMLToken::StartTag) |
404 m_tokenizer->updateStateFor(attemptStaticStringCreation(m_token.name
(), Likely8Bit)); | 406 m_tokenizer->updateStateFor(attemptStaticStringCreation(m_token.name
(), Likely8Bit)); |
405 m_scanner.scan(m_token, m_source, requests); | 407 m_scanner.scan(m_token, m_source, requests); |
406 m_token.clear(); | 408 m_token.clear(); |
407 } | 409 } |
408 | 410 |
409 preloader->takeAndPreload(requests); | 411 preloader->takeAndPreload(requests); |
410 } | 412 } |
411 | 413 |
412 } | 414 } |
OLD | NEW |