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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 private: | 60 private: |
61 CachedDocumentParameters(Document*, PassRefPtr<MediaValues>); | 61 CachedDocumentParameters(Document*, PassRefPtr<MediaValues>); |
62 }; | 62 }; |
63 | 63 |
64 class TokenPreloadScanner { | 64 class TokenPreloadScanner { |
65 WTF_MAKE_NONCOPYABLE(TokenPreloadScanner); WTF_MAKE_FAST_ALLOCATED(TokenPrel
oadScanner); | 65 WTF_MAKE_NONCOPYABLE(TokenPreloadScanner); WTF_MAKE_FAST_ALLOCATED(TokenPrel
oadScanner); |
66 public: | 66 public: |
67 TokenPreloadScanner(const KURL& documentURL, PassOwnPtr<CachedDocumentParame
ters>); | 67 TokenPreloadScanner(const KURL& documentURL, PassOwnPtr<CachedDocumentParame
ters>); |
68 ~TokenPreloadScanner(); | 68 ~TokenPreloadScanner(); |
69 | 69 |
70 void scan(const HTMLToken&, const SegmentedString&, PreloadRequestStream& re
quests); | 70 void scan(const HTMLToken&, const SegmentedString&, PreloadRequestStream& re
quests, String* preloadedReferrerPolicy); |
71 void scan(const CompactHTMLToken&, const SegmentedString&, PreloadRequestStr
eam& requests); | 71 void scan(const CompactHTMLToken&, const SegmentedString&, PreloadRequestStr
eam& requests, String* preloadedReferrerPolicy); |
72 | 72 |
73 void setPredictedBaseElementURL(const KURL& url) { m_predictedBaseElementURL
= url; } | 73 void setPredictedBaseElementURL(const KURL& url) { m_predictedBaseElementURL
= url; } |
74 | 74 |
75 // A TokenPreloadScannerCheckpoint is valid until the next call to rewindTo, | 75 // A TokenPreloadScannerCheckpoint is valid until the next call to rewindTo, |
76 // at which point all outstanding checkpoints are invalidated. | 76 // at which point all outstanding checkpoints are invalidated. |
77 TokenPreloadScannerCheckpoint createCheckpoint(); | 77 TokenPreloadScannerCheckpoint createCheckpoint(); |
78 void rewindTo(TokenPreloadScannerCheckpoint); | 78 void rewindTo(TokenPreloadScannerCheckpoint); |
79 | 79 |
80 bool isSafeToSendToAnotherThread() | 80 bool isSafeToSendToAnotherThread() |
81 { | 81 { |
82 return m_documentURL.isSafeToSendToAnotherThread() | 82 return m_documentURL.isSafeToSendToAnotherThread() |
83 && m_predictedBaseElementURL.isSafeToSendToAnotherThread(); | 83 && m_predictedBaseElementURL.isSafeToSendToAnotherThread(); |
84 } | 84 } |
85 | 85 |
86 private: | 86 private: |
87 class StartTagScanner; | 87 class StartTagScanner; |
88 | 88 |
89 template<typename Token> | 89 template <typename Token> |
90 inline void scanCommon(const Token&, const SegmentedString&, PreloadRequestS
tream& requests); | 90 inline void scanCommon(const Token&, const SegmentedString&, PreloadRequestS
tream& requests, String* preloadedReferrerPolicy); |
91 | 91 |
92 template<typename Token> | 92 template<typename Token> |
93 void updatePredictedBaseURL(const Token&); | 93 void updatePredictedBaseURL(const Token&); |
94 | 94 |
95 struct Checkpoint { | 95 struct Checkpoint { |
96 Checkpoint(const KURL& predictedBaseElementURL, bool inStyle, bool isApp
CacheEnabled, bool isCSPEnabled, size_t templateCount) | 96 Checkpoint(const KURL& predictedBaseElementURL, bool inStyle, bool isApp
CacheEnabled, bool isCSPEnabled, size_t templateCount) |
97 : predictedBaseElementURL(predictedBaseElementURL) | 97 : predictedBaseElementURL(predictedBaseElementURL) |
98 , inStyle(inStyle) | 98 , inStyle(inStyle) |
99 , isAppCacheEnabled(isAppCacheEnabled) | 99 , isAppCacheEnabled(isAppCacheEnabled) |
100 , isCSPEnabled(isCSPEnabled) | 100 , isCSPEnabled(isCSPEnabled) |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 private: | 155 private: |
156 TokenPreloadScanner m_scanner; | 156 TokenPreloadScanner m_scanner; |
157 SegmentedString m_source; | 157 SegmentedString m_source; |
158 HTMLToken m_token; | 158 HTMLToken m_token; |
159 OwnPtr<HTMLTokenizer> m_tokenizer; | 159 OwnPtr<HTMLTokenizer> m_tokenizer; |
160 }; | 160 }; |
161 | 161 |
162 } | 162 } |
163 | 163 |
164 #endif | 164 #endif |
OLD | NEW |