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

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

Issue 673603002: Reland: Make the HTMLDocumentParser yield more aggressively (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebased Created 6 years, 1 month 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, bool isApp CacheEnabled, size_t templateCount) 77 Checkpoint(const KURL& predictedBaseElementURL, bool inStyle, bool isApp CacheEnabled, bool isCSPEnabled, size_t templateCount)
kouhei (in TOK) 2014/11/19 04:42:54 Please ignore these changes in preloader. These ar
78 : predictedBaseElementURL(predictedBaseElementURL) 78 : predictedBaseElementURL(predictedBaseElementURL)
79 , inStyle(inStyle) 79 , inStyle(inStyle)
80 , isAppCacheEnabled(isAppCacheEnabled) 80 , isAppCacheEnabled(isAppCacheEnabled)
81 , isCSPEnabled(isCSPEnabled)
81 , templateCount(templateCount) 82 , templateCount(templateCount)
82 { 83 {
83 } 84 }
84 85
85 KURL predictedBaseElementURL; 86 KURL predictedBaseElementURL;
86 bool inStyle; 87 bool inStyle;
87 bool isAppCacheEnabled; 88 bool isAppCacheEnabled;
89 bool isCSPEnabled;
88 size_t templateCount; 90 size_t templateCount;
89 }; 91 };
90 92
91 CSSPreloadScanner m_cssScanner; 93 CSSPreloadScanner m_cssScanner;
92 const KURL m_documentURL; 94 const KURL m_documentURL;
93 KURL m_predictedBaseElementURL; 95 KURL m_predictedBaseElementURL;
94 bool m_inStyle; 96 bool m_inStyle;
95 bool m_inPicture; 97 bool m_inPicture;
96 bool m_isAppCacheEnabled; 98 bool m_isAppCacheEnabled;
99 bool m_isCSPEnabled;
97 String m_pictureSourceURL; 100 String m_pictureSourceURL;
98 size_t m_templateCount; 101 size_t m_templateCount;
99 RefPtr<MediaValues> m_mediaValues; 102 RefPtr<MediaValues> m_mediaValues;
100 103
101 Vector<Checkpoint> m_checkpoints; 104 Vector<Checkpoint> m_checkpoints;
102 }; 105 };
103 106
104 class HTMLPreloadScanner { 107 class HTMLPreloadScanner {
105 WTF_MAKE_NONCOPYABLE(HTMLPreloadScanner); WTF_MAKE_FAST_ALLOCATED; 108 WTF_MAKE_NONCOPYABLE(HTMLPreloadScanner); WTF_MAKE_FAST_ALLOCATED;
106 public: 109 public:
107 HTMLPreloadScanner(const HTMLParserOptions&, const KURL& documentURL, PassRe fPtr<MediaValues>); 110 HTMLPreloadScanner(const HTMLParserOptions&, const KURL& documentURL, PassRe fPtr<MediaValues>);
108 ~HTMLPreloadScanner(); 111 ~HTMLPreloadScanner();
109 112
110 void appendToEnd(const SegmentedString&); 113 void appendToEnd(const SegmentedString&);
111 void scan(HTMLResourcePreloader*, const KURL& documentBaseElementURL); 114 void scan(HTMLResourcePreloader*, const KURL& documentBaseElementURL);
112 115
113 private: 116 private:
114 TokenPreloadScanner m_scanner; 117 TokenPreloadScanner m_scanner;
115 SegmentedString m_source; 118 SegmentedString m_source;
116 HTMLToken m_token; 119 HTMLToken m_token;
117 OwnPtr<HTMLTokenizer> m_tokenizer; 120 OwnPtr<HTMLTokenizer> m_tokenizer;
118 }; 121 };
119 122
120 } 123 }
121 124
122 #endif 125 #endif
OLDNEW
« no previous file with comments | « Source/core/html/parser/HTMLParserScheduler.h ('k') | Source/core/html/parser/HTMLPreloadScanner.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698