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

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

Issue 265763010: Add preloader support for picture based source selection (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added nested element tests Created 6 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) 2010 Google Inc. All Rights Reserved. 3 * Copyright (C) 2010 Google Inc. 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 private: 67 private:
68 class StartTagScanner; 68 class StartTagScanner;
69 69
70 template<typename Token> 70 template<typename Token>
71 inline void scanCommon(const Token&, const SegmentedString&, PreloadRequestS tream& requests); 71 inline void scanCommon(const Token&, const SegmentedString&, PreloadRequestS tream& requests);
72 72
73 template<typename Token> 73 template<typename Token>
74 void updatePredictedBaseURL(const Token&); 74 void updatePredictedBaseURL(const Token&);
75 75
76 struct Checkpoint { 76 struct Checkpoint {
77 Checkpoint(const KURL& predictedBaseElementURL, bool inStyle, size_t tem plateCount) 77 Checkpoint(const KURL& predictedBaseElementURL, bool inStyle, const Vect or<String>& pictureSourceURLStack, size_t templateCount)
78 : predictedBaseElementURL(predictedBaseElementURL) 78 : predictedBaseElementURL(predictedBaseElementURL)
79 , inStyle(inStyle) 79 , inStyle(inStyle)
80 , pictureSourceURLStack(pictureSourceURLStack)
eseidel 2014/05/09 07:30:36 Why do these need to be stored on the checkpoint?
80 , templateCount(templateCount) 81 , templateCount(templateCount)
81 { 82 {
82 } 83 }
83 84
84 KURL predictedBaseElementURL; 85 KURL predictedBaseElementURL;
85 bool inStyle; 86 bool inStyle;
87 Vector<String> pictureSourceURLStack;
86 size_t templateCount; 88 size_t templateCount;
87 }; 89 };
88 90
89 CSSPreloadScanner m_cssScanner; 91 CSSPreloadScanner m_cssScanner;
90 const KURL m_documentURL; 92 const KURL m_documentURL;
91 KURL m_predictedBaseElementURL; 93 KURL m_predictedBaseElementURL;
92 bool m_inStyle; 94 bool m_inStyle;
95 Vector<String> m_pictureSourceURLStack;
93 size_t m_templateCount; 96 size_t m_templateCount;
94 RefPtr<MediaValues> m_mediaValues; 97 RefPtr<MediaValues> m_mediaValues;
95 98
96 Vector<Checkpoint> m_checkpoints; 99 Vector<Checkpoint> m_checkpoints;
97 }; 100 };
98 101
99 class HTMLPreloadScanner { 102 class HTMLPreloadScanner {
100 WTF_MAKE_NONCOPYABLE(HTMLPreloadScanner); WTF_MAKE_FAST_ALLOCATED; 103 WTF_MAKE_NONCOPYABLE(HTMLPreloadScanner); WTF_MAKE_FAST_ALLOCATED;
101 public: 104 public:
102 HTMLPreloadScanner(const HTMLParserOptions&, const KURL& documentURL, PassRe fPtr<MediaValues>); 105 HTMLPreloadScanner(const HTMLParserOptions&, const KURL& documentURL, PassRe fPtr<MediaValues>);
103 ~HTMLPreloadScanner(); 106 ~HTMLPreloadScanner();
104 107
105 void appendToEnd(const SegmentedString&); 108 void appendToEnd(const SegmentedString&);
106 void scan(HTMLResourcePreloader*, const KURL& documentBaseElementURL); 109 void scan(HTMLResourcePreloader*, const KURL& documentBaseElementURL);
107 110
108 private: 111 private:
109 TokenPreloadScanner m_scanner; 112 TokenPreloadScanner m_scanner;
110 SegmentedString m_source; 113 SegmentedString m_source;
111 HTMLToken m_token; 114 HTMLToken m_token;
112 OwnPtr<HTMLTokenizer> m_tokenizer; 115 OwnPtr<HTMLTokenizer> m_tokenizer;
113 }; 116 };
114 117
115 } 118 }
116 119
117 #endif 120 #endif
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/loading/preload-picture-sizes-expected.txt ('k') | Source/core/html/parser/HTMLPreloadScanner.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698