OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All Rights Reserved. | 2 * Copyright (C) 2013 Google Inc. All Rights Reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 | 72 |
73 static bool mediaAttributeMatches(Frame* frame, RenderStyle* renderStyle, const
String& attributeValue) | 73 static bool mediaAttributeMatches(Frame* frame, RenderStyle* renderStyle, const
String& attributeValue) |
74 { | 74 { |
75 RefPtr<MediaQuerySet> mediaQueries = MediaQuerySet::createAllowingDescriptio
nSyntax(attributeValue); | 75 RefPtr<MediaQuerySet> mediaQueries = MediaQuerySet::createAllowingDescriptio
nSyntax(attributeValue); |
76 MediaQueryEvaluator mediaQueryEvaluator("screen", frame, renderStyle); | 76 MediaQueryEvaluator mediaQueryEvaluator("screen", frame, renderStyle); |
77 return mediaQueryEvaluator.eval(mediaQueries.get()); | 77 return mediaQueryEvaluator.eval(mediaQueries.get()); |
78 } | 78 } |
79 | 79 |
80 void HTMLResourcePreloader::preload(PassOwnPtr<PreloadRequest> preload) | 80 void HTMLResourcePreloader::preload(PassOwnPtr<PreloadRequest> preload) |
81 { | 81 { |
| 82 if (preload->bundleStart()) { |
| 83 m_inBundle = true; |
| 84 return; |
| 85 } |
| 86 if (preload->bundleEnd()) { |
| 87 m_inBundle = false; |
| 88 m_foundBundleResource = false; |
| 89 return; |
| 90 } |
82 ASSERT(m_document->frame()); | 91 ASSERT(m_document->frame()); |
83 ASSERT(m_document->renderer()); | 92 ASSERT(m_document->renderer()); |
84 ASSERT(m_document->renderer()->style()); | 93 ASSERT(m_document->renderer()->style()); |
85 if (!preload->media().isEmpty() && !mediaAttributeMatches(m_document->frame(
), m_document->renderer()->style(), preload->media())) | 94 if (!preload->media().isEmpty() && !mediaAttributeMatches(m_document->frame(
), m_document->renderer()->style(), preload->media())) |
86 return; | 95 return; |
87 | 96 |
| 97 if (m_inBundle && m_foundBundleResource) |
| 98 return; |
| 99 |
| 100 m_foundBundleResource = true; |
| 101 |
88 CachedResourceRequest request = preload->resourceRequest(m_document); | 102 CachedResourceRequest request = preload->resourceRequest(m_document); |
89 m_document->cachedResourceLoader()->preload(preload->resourceType(), request
, preload->charset()); | 103 m_document->cachedResourceLoader()->preload(preload->resourceType(), request
, preload->charset()); |
90 } | 104 } |
91 | 105 |
92 | 106 |
93 } | 107 } |
OLD | NEW |