| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 // Below members only non-null during scan() | 94 // Below members only non-null during scan() |
| 95 PreloadRequestStream* m_requests = nullptr; | 95 PreloadRequestStream* m_requests = nullptr; |
| 96 const KURL* m_predictedBaseElementURL = nullptr; | 96 const KURL* m_predictedBaseElementURL = nullptr; |
| 97 }; | 97 }; |
| 98 | 98 |
| 99 // Each CSSPreloaderResourceClient keeps track of a single CSS resource, and | 99 // Each CSSPreloaderResourceClient keeps track of a single CSS resource, and |
| 100 // drives a CSSPreloadScanner as raw data arrives for it. This lets us preload | 100 // drives a CSSPreloadScanner as raw data arrives for it. This lets us preload |
| 101 // @import tags before parsing. | 101 // @import tags before parsing. |
| 102 class CORE_EXPORT CSSPreloaderResourceClient | 102 class CORE_EXPORT CSSPreloaderResourceClient |
| 103 : public GarbageCollectedFinalized<CSSPreloaderResourceClient>, | 103 : public GarbageCollectedFinalized<CSSPreloaderResourceClient>, |
| 104 public ResourceOwner<CSSStyleSheetResource, StyleSheetResourceClient> { | 104 public StyleSheetResourceClient { |
| 105 USING_GARBAGE_COLLECTED_MIXIN(CSSPreloaderResourceClient); | 105 USING_GARBAGE_COLLECTED_MIXIN(CSSPreloaderResourceClient); |
| 106 | 106 |
| 107 public: | 107 public: |
| 108 CSSPreloaderResourceClient(Resource*, HTMLResourcePreloader*); | 108 CSSPreloaderResourceClient(Resource*, HTMLResourcePreloader*); |
| 109 ~CSSPreloaderResourceClient(); | 109 ~CSSPreloaderResourceClient(); |
| 110 void setCSSStyleSheet(const String& href, | 110 void setCSSStyleSheet(const String& href, |
| 111 const KURL& baseURL, | 111 const KURL& baseURL, |
| 112 const String& charset, | 112 const String& charset, |
| 113 const CSSStyleSheetResource*) override; | 113 const CSSStyleSheetResource*) override; |
| 114 void didAppendFirstData(const CSSStyleSheetResource*) override; | 114 void didAppendFirstData(const CSSStyleSheetResource*) override; |
| 115 String debugName() const override { return "CSSPreloaderResourceClient"; } | 115 String debugName() const override { return "CSSPreloaderResourceClient"; } |
| 116 | 116 |
| 117 DECLARE_TRACE(); | 117 DECLARE_TRACE(); |
| 118 | 118 |
| 119 protected: | 119 protected: |
| 120 // Protected for tests, which don't want to initialize a fully featured | 120 // Protected for tests, which don't want to initialize a fully featured |
| 121 // DocumentLoader. | 121 // DocumentLoader. |
| 122 virtual void fetchPreloads(PreloadRequestStream& preloads); | 122 virtual void fetchPreloads(PreloadRequestStream& preloads); |
| 123 | 123 |
| 124 private: | 124 private: |
| 125 void scanCSS(const CSSStyleSheetResource*); | 125 void scanCSS(const CSSStyleSheetResource*); |
| 126 void clearResource(); |
| 126 | 127 |
| 127 enum PreloadPolicy { | 128 enum PreloadPolicy { |
| 128 ScanOnly, | 129 ScanOnly, |
| 129 ScanAndPreload, | 130 ScanAndPreload, |
| 130 }; | 131 }; |
| 131 | 132 |
| 132 const PreloadPolicy m_policy; | 133 const PreloadPolicy m_policy; |
| 133 WeakMember<HTMLResourcePreloader> m_preloader; | 134 WeakMember<HTMLResourcePreloader> m_preloader; |
| 135 WeakMember<CSSStyleSheetResource> m_resource; |
| 134 }; | 136 }; |
| 135 | 137 |
| 136 } // namespace blink | 138 } // namespace blink |
| 137 | 139 |
| 138 #endif | 140 #endif |
| OLD | NEW |