| 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 29 matching lines...) Expand all Loading... |
| 40 } | 40 } |
| 41 | 41 |
| 42 HTMLResourcePreloader* HTMLResourcePreloader::create(Document& document) | 42 HTMLResourcePreloader* HTMLResourcePreloader::create(Document& document) |
| 43 { | 43 { |
| 44 return new HTMLResourcePreloader(document); | 44 return new HTMLResourcePreloader(document); |
| 45 } | 45 } |
| 46 | 46 |
| 47 DEFINE_TRACE(HTMLResourcePreloader) | 47 DEFINE_TRACE(HTMLResourcePreloader) |
| 48 { | 48 { |
| 49 visitor->trace(m_document); | 49 visitor->trace(m_document); |
| 50 visitor->trace(m_cssPreloaders); |
| 50 } | 51 } |
| 51 | 52 |
| 52 int HTMLResourcePreloader::countPreloads() | 53 int HTMLResourcePreloader::countPreloads() |
| 53 { | 54 { |
| 54 if (m_document->loader()) | 55 if (m_document->loader()) |
| 55 return m_document->loader()->fetcher()->countPreloads(); | 56 return m_document->loader()->fetcher()->countPreloads(); |
| 56 return 0; | 57 return 0; |
| 57 } | 58 } |
| 58 | 59 |
| 59 static void preconnectHost(PreloadRequest* request, const NetworkHintsInterface&
networkHintsInterface) | 60 static void preconnectHost(PreloadRequest* request, const NetworkHintsInterface&
networkHintsInterface) |
| (...skipping 18 matching lines...) Expand all Loading... |
| 78 FetchRequest request = preload->resourceRequest(m_document); | 79 FetchRequest request = preload->resourceRequest(m_document); |
| 79 // TODO(dgozman): This check should go to HTMLPreloadScanner, but this requi
res | 80 // TODO(dgozman): This check should go to HTMLPreloadScanner, but this requi
res |
| 80 // making Document::completeURLWithOverride logic to be statically accessibl
e. | 81 // making Document::completeURLWithOverride logic to be statically accessibl
e. |
| 81 if (request.url().protocolIsData()) | 82 if (request.url().protocolIsData()) |
| 82 return; | 83 return; |
| 83 if (preload->resourceType() == Resource::Script || preload->resourceType() =
= Resource::CSSStyleSheet || preload->resourceType() == Resource::ImportResource
) | 84 if (preload->resourceType() == Resource::Script || preload->resourceType() =
= Resource::CSSStyleSheet || preload->resourceType() == Resource::ImportResource
) |
| 84 request.setCharset(preload->charset().isEmpty() ? m_document->characterS
et().getString() : preload->charset()); | 85 request.setCharset(preload->charset().isEmpty() ? m_document->characterS
et().getString() : preload->charset()); |
| 85 request.setForPreload(true); | 86 request.setForPreload(true); |
| 86 Resource* resource = m_document->loader()->startPreload(preload->resourceTyp
e(), request); | 87 Resource* resource = m_document->loader()->startPreload(preload->resourceTyp
e(), request); |
| 87 if (resource && preload->resourceType() == Resource::CSSStyleSheet && Runtim
eEnabledFeatures::cssPreloadImportEnabled()) { | 88 if (resource && preload->resourceType() == Resource::CSSStyleSheet && Runtim
eEnabledFeatures::cssPreloadImportEnabled()) { |
| 88 OwnPtr<CSSPreloaderResourceClient> client = adoptPtr(new CSSPreloaderRes
ourceClient(resource, this)); | 89 m_cssPreloaders.append(new CSSPreloaderResourceClient(resource, this)); |
| 89 resource->addClient(client.get()); | |
| 90 m_cssPreloaders.add(client.release()); | |
| 91 } | 90 } |
| 92 } | 91 } |
| 93 | 92 |
| 94 } // namespace blink | 93 } // namespace blink |
| OLD | NEW |