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

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

Issue 457413002: Defer late and async scripts (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Lower priorities for late/async scripts Created 6 years, 3 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, bool isBef oreBody, size_t templateCount)
78 : predictedBaseElementURL(predictedBaseElementURL) 78 : predictedBaseElementURL(predictedBaseElementURL)
79 , inStyle(inStyle) 79 , inStyle(inStyle)
80 , isBeforeBody(isBeforeBody)
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 bool isBeforeBody;
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;
93 bool m_inPicture; 95 bool m_inPicture;
96 bool m_isBeforeBody;
94 String m_pictureSourceURL; 97 String m_pictureSourceURL;
95 size_t m_templateCount; 98 size_t m_templateCount;
96 RefPtr<MediaValues> m_mediaValues; 99 RefPtr<MediaValues> m_mediaValues;
97 100
98 Vector<Checkpoint> m_checkpoints; 101 Vector<Checkpoint> m_checkpoints;
99 }; 102 };
100 103
101 class HTMLPreloadScanner { 104 class HTMLPreloadScanner {
102 WTF_MAKE_NONCOPYABLE(HTMLPreloadScanner); WTF_MAKE_FAST_ALLOCATED; 105 WTF_MAKE_NONCOPYABLE(HTMLPreloadScanner); WTF_MAKE_FAST_ALLOCATED;
103 public: 106 public:
104 HTMLPreloadScanner(const HTMLParserOptions&, const KURL& documentURL, PassRe fPtr<MediaValues>); 107 HTMLPreloadScanner(const HTMLParserOptions&, const KURL& documentURL, PassRe fPtr<MediaValues>);
105 ~HTMLPreloadScanner(); 108 ~HTMLPreloadScanner();
106 109
107 void appendToEnd(const SegmentedString&); 110 void appendToEnd(const SegmentedString&);
108 void scan(HTMLResourcePreloader*, const KURL& documentBaseElementURL); 111 void scan(HTMLResourcePreloader*, const KURL& documentBaseElementURL);
109 112
110 private: 113 private:
111 TokenPreloadScanner m_scanner; 114 TokenPreloadScanner m_scanner;
112 SegmentedString m_source; 115 SegmentedString m_source;
113 HTMLToken m_token; 116 HTMLToken m_token;
114 OwnPtr<HTMLTokenizer> m_tokenizer; 117 OwnPtr<HTMLTokenizer> m_tokenizer;
115 }; 118 };
116 119
117 } 120 }
118 121
119 #endif 122 #endif
OLDNEW
« no previous file with comments | « Source/core/html/parser/CSSPreloadScanner.cpp ('k') | Source/core/html/parser/HTMLPreloadScanner.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698