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

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

Issue 201813002: Enable Media query evaluation in the preload scanner (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Removed GC transition types and commented code Created 6 years, 9 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 15 matching lines...) Expand all
26 26
27 #ifndef HTMLPreloadScanner_h 27 #ifndef HTMLPreloadScanner_h
28 #define HTMLPreloadScanner_h 28 #define HTMLPreloadScanner_h
29 29
30 #include "core/html/parser/CSSPreloadScanner.h" 30 #include "core/html/parser/CSSPreloadScanner.h"
31 #include "core/html/parser/CompactHTMLToken.h" 31 #include "core/html/parser/CompactHTMLToken.h"
32 #include "core/html/parser/HTMLToken.h" 32 #include "core/html/parser/HTMLToken.h"
33 #include "platform/text/SegmentedString.h" 33 #include "platform/text/SegmentedString.h"
34 #include "wtf/Vector.h" 34 #include "wtf/Vector.h"
35 35
36
abarth-chromium 2014/03/24 19:43:31 This change looks spurious.
36 namespace WebCore { 37 namespace WebCore {
37 38
38 typedef size_t TokenPreloadScannerCheckpoint; 39 typedef size_t TokenPreloadScannerCheckpoint;
39 40
40 class HTMLParserOptions; 41 class HTMLParserOptions;
41 class HTMLTokenizer; 42 class HTMLTokenizer;
42 class SegmentedString; 43 class SegmentedString;
44 class MediaValues;
43 45
44 class TokenPreloadScanner { 46 class TokenPreloadScanner {
45 WTF_MAKE_NONCOPYABLE(TokenPreloadScanner); WTF_MAKE_FAST_ALLOCATED; 47 WTF_MAKE_NONCOPYABLE(TokenPreloadScanner); WTF_MAKE_FAST_ALLOCATED;
46 public: 48 public:
47 TokenPreloadScanner(const KURL& documentURL, float deviceScaleFactor); 49 TokenPreloadScanner(const KURL& documentURL, float deviceScaleFactor, PassRe fPtr<MediaValues>);
48 ~TokenPreloadScanner(); 50 ~TokenPreloadScanner();
49 51
50 void scan(const HTMLToken&, const SegmentedString&, PreloadRequestStream& re quests); 52 void scan(const HTMLToken&, const SegmentedString&, PreloadRequestStream& re quests);
51 void scan(const CompactHTMLToken&, const SegmentedString&, PreloadRequestStr eam& requests); 53 void scan(const CompactHTMLToken&, const SegmentedString&, PreloadRequestStr eam& requests);
52 54
53 void setPredictedBaseElementURL(const KURL& url) { m_predictedBaseElementURL = url; } 55 void setPredictedBaseElementURL(const KURL& url) { m_predictedBaseElementURL = url; }
54 56
55 // A TokenPreloadScannerCheckpoint is valid until the next call to rewindTo, 57 // A TokenPreloadScannerCheckpoint is valid until the next call to rewindTo,
56 // at which point all outstanding checkpoints are invalidated. 58 // at which point all outstanding checkpoints are invalidated.
57 TokenPreloadScannerCheckpoint createCheckpoint(); 59 TokenPreloadScannerCheckpoint createCheckpoint();
58 void rewindTo(TokenPreloadScannerCheckpoint); 60 void rewindTo(TokenPreloadScannerCheckpoint);
59 61
60 bool isSafeToSendToAnotherThread() 62 bool isSafeToSendToAnotherThread()
abarth-chromium 2014/03/24 19:43:31 We need to teach this function about m_mediaValues
61 { 63 {
62 return m_documentURL.isSafeToSendToAnotherThread() 64 return m_documentURL.isSafeToSendToAnotherThread()
63 && m_predictedBaseElementURL.isSafeToSendToAnotherThread(); 65 && m_predictedBaseElementURL.isSafeToSendToAnotherThread();
64 } 66 }
65 67
66 private: 68 private:
67 class StartTagScanner; 69 class StartTagScanner;
68 70
69 template<typename Token> 71 template<typename Token>
70 inline void scanCommon(const Token&, const SegmentedString&, PreloadRequestS tream& requests); 72 inline void scanCommon(const Token&, const SegmentedString&, PreloadRequestS tream& requests);
(...skipping 13 matching lines...) Expand all
84 bool inStyle; 86 bool inStyle;
85 size_t templateCount; 87 size_t templateCount;
86 }; 88 };
87 89
88 CSSPreloadScanner m_cssScanner; 90 CSSPreloadScanner m_cssScanner;
89 const KURL m_documentURL; 91 const KURL m_documentURL;
90 KURL m_predictedBaseElementURL; 92 KURL m_predictedBaseElementURL;
91 bool m_inStyle; 93 bool m_inStyle;
92 float m_deviceScaleFactor; 94 float m_deviceScaleFactor;
93 size_t m_templateCount; 95 size_t m_templateCount;
96 RefPtr<MediaValues> m_mediaValues;
94 97
95 Vector<Checkpoint> m_checkpoints; 98 Vector<Checkpoint> m_checkpoints;
96 }; 99 };
97 100
98 class HTMLPreloadScanner { 101 class HTMLPreloadScanner {
99 WTF_MAKE_NONCOPYABLE(HTMLPreloadScanner); WTF_MAKE_FAST_ALLOCATED; 102 WTF_MAKE_NONCOPYABLE(HTMLPreloadScanner); WTF_MAKE_FAST_ALLOCATED;
100 public: 103 public:
101 HTMLPreloadScanner(const HTMLParserOptions&, const KURL& documentURL, float deviceScaleFactor); 104 HTMLPreloadScanner(const HTMLParserOptions&, const KURL& documentURL, float deviceScaleFactor, PassRefPtr<MediaValues>);
102 ~HTMLPreloadScanner(); 105 ~HTMLPreloadScanner();
103 106
104 void appendToEnd(const SegmentedString&); 107 void appendToEnd(const SegmentedString&);
105 void scan(HTMLResourcePreloader*, const KURL& documentBaseElementURL); 108 void scan(HTMLResourcePreloader*, const KURL& documentBaseElementURL);
106 109
107 private: 110 private:
108 TokenPreloadScanner m_scanner; 111 TokenPreloadScanner m_scanner;
109 SegmentedString m_source; 112 SegmentedString m_source;
110 HTMLToken m_token; 113 HTMLToken m_token;
111 OwnPtr<HTMLTokenizer> m_tokenizer; 114 OwnPtr<HTMLTokenizer> m_tokenizer;
112 }; 115 };
113 116
114 } 117 }
115 118
116 #endif 119 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698