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 class CSSPreloadScanner { | 38 class CSSPreloadScanner { |
39 DISALLOW_NEW(); | 39 DISALLOW_NEW(); |
40 WTF_MAKE_NONCOPYABLE(CSSPreloadScanner); | 40 WTF_MAKE_NONCOPYABLE(CSSPreloadScanner); |
41 public: | 41 public: |
42 CSSPreloadScanner(); | 42 CSSPreloadScanner(); |
43 ~CSSPreloadScanner(); | 43 ~CSSPreloadScanner(); |
44 | 44 |
45 void reset(); | 45 void reset(); |
46 | 46 |
47 void scan(const HTMLToken::DataVector&, const SegmentedString&, PreloadReque
stStream&); | 47 void scan(const HTMLToken::DataVector&, const SegmentedString&, PreloadReque
stStream&, const KURL&); |
48 void scan(const String&, const SegmentedString&, PreloadRequestStream&); | 48 void scan(const String&, const SegmentedString&, PreloadRequestStream&, cons
t KURL&); |
49 | 49 |
50 void setReferrerPolicy(const ReferrerPolicy); | 50 void setReferrerPolicy(const ReferrerPolicy); |
51 | 51 |
52 private: | 52 private: |
53 enum State { | 53 enum State { |
54 Initial, | 54 Initial, |
55 MaybeComment, | 55 MaybeComment, |
56 Comment, | 56 Comment, |
57 MaybeCommentEnd, | 57 MaybeCommentEnd, |
58 RuleStart, | 58 RuleStart, |
59 Rule, | 59 Rule, |
60 AfterRule, | 60 AfterRule, |
61 RuleValue, | 61 RuleValue, |
62 AfterRuleValue, | 62 AfterRuleValue, |
63 DoneParsingImportRules, | 63 DoneParsingImportRules, |
64 }; | 64 }; |
65 | 65 |
66 template<typename Char> | 66 template<typename Char> |
67 void scanCommon(const Char* begin, const Char* end, const SegmentedString&,
PreloadRequestStream&); | 67 void scanCommon(const Char* begin, const Char* end, const SegmentedString&,
PreloadRequestStream&, const KURL&); |
68 | 68 |
69 inline void tokenize(UChar, const SegmentedString&); | 69 inline void tokenize(UChar, const SegmentedString&); |
70 void emitRule(const SegmentedString&); | 70 void emitRule(const SegmentedString&); |
71 | 71 |
72 State m_state; | 72 State m_state = Initial; |
73 StringBuilder m_rule; | 73 StringBuilder m_rule; |
74 StringBuilder m_ruleValue; | 74 StringBuilder m_ruleValue; |
75 | 75 |
76 // Only non-zero during scan() | 76 ReferrerPolicy m_referrerPolicy = ReferrerPolicyDefault; |
77 PreloadRequestStream* m_requests; | |
78 | 77 |
79 ReferrerPolicy m_referrerPolicy; | 78 // Below members only non-null during scan() |
| 79 PreloadRequestStream* m_requests = nullptr; |
| 80 const KURL* m_predictedBaseElementURL = nullptr; |
80 }; | 81 }; |
81 | 82 |
82 } | 83 } |
83 | 84 |
84 #endif | 85 #endif |
OLD | NEW |