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 15 matching lines...) Expand all Loading... |
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 "core/platform/text/SegmentedString.h" | 33 #include "core/platform/text/SegmentedString.h" |
34 #include <wtf/Vector.h> | 34 #include <wtf/Vector.h> |
35 | 35 |
| 36 |
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 explicit TokenPreloadScanner(const KURL& documentURL); | 49 explicit TokenPreloadScanner(const KURL& documentURL, PassRefPtr<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(); |
(...skipping 25 matching lines...) Expand all Loading... |
83 KURL predictedBaseElementURL; | 85 KURL predictedBaseElementURL; |
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 size_t m_templateCount; | 94 size_t m_templateCount; |
| 95 RefPtr<MediaValues> m_mediaValues; |
93 | 96 |
94 Vector<Checkpoint> m_checkpoints; | 97 Vector<Checkpoint> m_checkpoints; |
95 }; | 98 }; |
96 | 99 |
97 class HTMLPreloadScanner { | 100 class HTMLPreloadScanner { |
98 WTF_MAKE_NONCOPYABLE(HTMLPreloadScanner); WTF_MAKE_FAST_ALLOCATED; | 101 WTF_MAKE_NONCOPYABLE(HTMLPreloadScanner); WTF_MAKE_FAST_ALLOCATED; |
99 public: | 102 public: |
100 HTMLPreloadScanner(const HTMLParserOptions&, const KURL& documentURL); | 103 HTMLPreloadScanner(const HTMLParserOptions&, const KURL& documentURL, PassRe
fPtr<MediaValues>); |
101 ~HTMLPreloadScanner(); | 104 ~HTMLPreloadScanner(); |
102 | 105 |
103 void appendToEnd(const SegmentedString&); | 106 void appendToEnd(const SegmentedString&); |
104 void scan(HTMLResourcePreloader*, const KURL& documentBaseElementURL); | 107 void scan(HTMLResourcePreloader*, const KURL& documentBaseElementURL); |
105 | 108 |
106 private: | 109 private: |
107 TokenPreloadScanner m_scanner; | 110 TokenPreloadScanner m_scanner; |
108 SegmentedString m_source; | 111 SegmentedString m_source; |
109 HTMLToken m_token; | 112 HTMLToken m_token; |
110 OwnPtr<HTMLTokenizer> m_tokenizer; | 113 OwnPtr<HTMLTokenizer> m_tokenizer; |
111 }; | 114 }; |
112 | 115 |
113 } | 116 } |
114 | 117 |
115 #endif | 118 #endif |
OLD | NEW |