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