Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(246)

Side by Side Diff: Source/core/html/parser/HTMLPreloadScanner.cpp

Issue 1108303002: HTMLPreloadScanner unit tests (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Actually working Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 534
535 HTMLPreloadScanner::~HTMLPreloadScanner() 535 HTMLPreloadScanner::~HTMLPreloadScanner()
536 { 536 {
537 } 537 }
538 538
539 void HTMLPreloadScanner::appendToEnd(const SegmentedString& source) 539 void HTMLPreloadScanner::appendToEnd(const SegmentedString& source)
540 { 540 {
541 m_source.append(source); 541 m_source.append(source);
542 } 542 }
543 543
544 void HTMLPreloadScanner::scan(HTMLResourcePreloader* preloader, const KURL& star tingBaseElementURL) 544 void HTMLPreloadScanner::scan(ResourcePreloader* preloader, const KURL& starting BaseElementURL)
545 { 545 {
546 ASSERT(isMainThread()); // HTMLTokenizer::updateStateFor only works on the m ain thread. 546 ASSERT(isMainThread()); // HTMLTokenizer::updateStateFor only works on the m ain thread.
547 547
548 TRACE_EVENT1("blink", "HTMLPreloadScanner::scan", "source_length", m_source. length()); 548 TRACE_EVENT1("blink", "HTMLPreloadScanner::scan", "source_length", m_source. length());
549 549
550 // When we start scanning, our best prediction of the baseElementURL is the real one! 550 // When we start scanning, our best prediction of the baseElementURL is the real one!
551 if (!startingBaseElementURL.isEmpty()) 551 if (!startingBaseElementURL.isEmpty())
552 m_scanner.setPredictedBaseElementURL(startingBaseElementURL); 552 m_scanner.setPredictedBaseElementURL(startingBaseElementURL);
553 553
554 PreloadRequestStream requests; 554 PreloadRequestStream requests;
555 555
556 while (m_tokenizer->nextToken(m_source, m_token)) { 556 while (m_tokenizer->nextToken(m_source, m_token)) {
557 if (m_token.type() == HTMLToken::StartTag) 557 if (m_token.type() == HTMLToken::StartTag)
558 m_tokenizer->updateStateFor(attemptStaticStringCreation(m_token.name (), Likely8Bit)); 558 m_tokenizer->updateStateFor(attemptStaticStringCreation(m_token.name (), Likely8Bit));
559 m_scanner.scan(m_token, m_source, requests); 559 m_scanner.scan(m_token, m_source, requests);
560 m_token.clear(); 560 m_token.clear();
561 } 561 }
562 562
563 preloader->takeAndPreload(requests); 563 preloader->takeAndPreload(requests);
564 } 564 }
565 565
566 } 566 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698