OLD | NEW |
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 26 matching lines...) Expand all Loading... |
37 | 37 |
38 typedef size_t TokenPreloadScannerCheckpoint; | 38 typedef size_t TokenPreloadScannerCheckpoint; |
39 | 39 |
40 class HTMLParserOptions; | 40 class HTMLParserOptions; |
41 class HTMLTokenizer; | 41 class HTMLTokenizer; |
42 class SegmentedString; | 42 class SegmentedString; |
43 | 43 |
44 class TokenPreloadScanner { | 44 class TokenPreloadScanner { |
45 WTF_MAKE_NONCOPYABLE(TokenPreloadScanner); WTF_MAKE_FAST_ALLOCATED; | 45 WTF_MAKE_NONCOPYABLE(TokenPreloadScanner); WTF_MAKE_FAST_ALLOCATED; |
46 public: | 46 public: |
47 explicit TokenPreloadScanner(const KURL& documentURL); | 47 explicit TokenPreloadScanner(const KURL& documentURL, float deviceScaleFacto
r); |
48 ~TokenPreloadScanner(); | 48 ~TokenPreloadScanner(); |
49 | 49 |
50 void scan(const HTMLToken&, const SegmentedString&, PreloadRequestStream& re
quests); | 50 void scan(const HTMLToken&, const SegmentedString&, PreloadRequestStream& re
quests); |
51 void scan(const CompactHTMLToken&, const SegmentedString&, PreloadRequestStr
eam& requests); | 51 void scan(const CompactHTMLToken&, const SegmentedString&, PreloadRequestStr
eam& requests); |
52 | 52 |
53 void setPredictedBaseElementURL(const KURL& url) { m_predictedBaseElementURL
= url; } | 53 void setPredictedBaseElementURL(const KURL& url) { m_predictedBaseElementURL
= url; } |
54 | 54 |
55 // A TokenPreloadScannerCheckpoint is valid until the next call to rewindTo, | 55 // A TokenPreloadScannerCheckpoint is valid until the next call to rewindTo, |
56 // at which point all outstanding checkpoints are invalidated. | 56 // at which point all outstanding checkpoints are invalidated. |
57 TokenPreloadScannerCheckpoint createCheckpoint(); | 57 TokenPreloadScannerCheckpoint createCheckpoint(); |
(...skipping 24 matching lines...) Expand all Loading... |
82 | 82 |
83 KURL predictedBaseElementURL; | 83 KURL predictedBaseElementURL; |
84 bool inStyle; | 84 bool inStyle; |
85 size_t templateCount; | 85 size_t templateCount; |
86 }; | 86 }; |
87 | 87 |
88 CSSPreloadScanner m_cssScanner; | 88 CSSPreloadScanner m_cssScanner; |
89 const KURL m_documentURL; | 89 const KURL m_documentURL; |
90 KURL m_predictedBaseElementURL; | 90 KURL m_predictedBaseElementURL; |
91 bool m_inStyle; | 91 bool m_inStyle; |
| 92 float m_deviceScaleFactor; |
92 size_t m_templateCount; | 93 size_t m_templateCount; |
93 | 94 |
94 Vector<Checkpoint> m_checkpoints; | 95 Vector<Checkpoint> m_checkpoints; |
95 }; | 96 }; |
96 | 97 |
97 class HTMLPreloadScanner { | 98 class HTMLPreloadScanner { |
98 WTF_MAKE_NONCOPYABLE(HTMLPreloadScanner); WTF_MAKE_FAST_ALLOCATED; | 99 WTF_MAKE_NONCOPYABLE(HTMLPreloadScanner); WTF_MAKE_FAST_ALLOCATED; |
99 public: | 100 public: |
100 HTMLPreloadScanner(const HTMLParserOptions&, const KURL& documentURL); | 101 HTMLPreloadScanner(const HTMLParserOptions&, const KURL& documentURL, float
deviceScaleFactor); |
101 ~HTMLPreloadScanner(); | 102 ~HTMLPreloadScanner(); |
102 | 103 |
103 void appendToEnd(const SegmentedString&); | 104 void appendToEnd(const SegmentedString&); |
104 void scan(HTMLResourcePreloader*, const KURL& documentBaseElementURL); | 105 void scan(HTMLResourcePreloader*, const KURL& documentBaseElementURL); |
105 | 106 |
106 private: | 107 private: |
107 TokenPreloadScanner m_scanner; | 108 TokenPreloadScanner m_scanner; |
108 SegmentedString m_source; | 109 SegmentedString m_source; |
109 HTMLToken m_token; | 110 HTMLToken m_token; |
110 OwnPtr<HTMLTokenizer> m_tokenizer; | 111 OwnPtr<HTMLTokenizer> m_tokenizer; |
111 }; | 112 }; |
112 | 113 |
113 } | 114 } |
114 | 115 |
115 #endif | 116 #endif |
OLD | NEW |