| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 std::unique_ptr<PreloadRequest> preload, | 70 std::unique_ptr<PreloadRequest> preload, |
| 71 const NetworkHintsInterface& networkHintsInterface) { | 71 const NetworkHintsInterface& networkHintsInterface) { |
| 72 if (preload->isPreconnect()) { | 72 if (preload->isPreconnect()) { |
| 73 preconnectHost(preload.get(), networkHintsInterface); | 73 preconnectHost(preload.get(), networkHintsInterface); |
| 74 return; | 74 return; |
| 75 } | 75 } |
| 76 // TODO(yoichio): Should preload if document is imported. | 76 // TODO(yoichio): Should preload if document is imported. |
| 77 if (!m_document->loader()) | 77 if (!m_document->loader()) |
| 78 return; | 78 return; |
| 79 FetchRequest request = preload->resourceRequest(m_document); | 79 FetchRequest request = preload->resourceRequest(m_document); |
| 80 // TODO(dgozman): This check should go to HTMLPreloadScanner, but this require
s | 80 // TODO(dgozman): This check should go to HTMLPreloadScanner, but this |
| 81 // making Document::completeURLWithOverride logic to be statically accessible. | 81 // requires making Document::completeURLWithOverride logic to be statically |
| 82 // accessible. |
| 82 if (request.url().protocolIsData()) | 83 if (request.url().protocolIsData()) |
| 83 return; | 84 return; |
| 84 if (preload->resourceType() == Resource::Script || | 85 if (preload->resourceType() == Resource::Script || |
| 85 preload->resourceType() == Resource::CSSStyleSheet || | 86 preload->resourceType() == Resource::CSSStyleSheet || |
| 86 preload->resourceType() == Resource::ImportResource) | 87 preload->resourceType() == Resource::ImportResource) |
| 87 request.setCharset(preload->charset().isEmpty() | 88 request.setCharset(preload->charset().isEmpty() |
| 88 ? m_document->characterSet().getString() | 89 ? m_document->characterSet().getString() |
| 89 : preload->charset()); | 90 : preload->charset()); |
| 90 request.setForPreload(true, preload->discoveryTime()); | 91 request.setForPreload(true, preload->discoveryTime()); |
| 91 int duration = static_cast<int>( | 92 int duration = static_cast<int>( |
| (...skipping 11 matching lines...) Expand all Loading... |
| 103 m_document->loader()->startPreload(preload->resourceType(), request); | 104 m_document->loader()->startPreload(preload->resourceType(), request); |
| 104 if (resource && preload->resourceType() == Resource::CSSStyleSheet) { | 105 if (resource && preload->resourceType() == Resource::CSSStyleSheet) { |
| 105 Settings* settings = m_document->settings(); | 106 Settings* settings = m_document->settings(); |
| 106 if (settings && (settings->cssExternalScannerNoPreload() || | 107 if (settings && (settings->cssExternalScannerNoPreload() || |
| 107 settings->cssExternalScannerPreload())) | 108 settings->cssExternalScannerPreload())) |
| 108 m_cssPreloaders.add(new CSSPreloaderResourceClient(resource, this)); | 109 m_cssPreloaders.add(new CSSPreloaderResourceClient(resource, this)); |
| 109 } | 110 } |
| 110 } | 111 } |
| 111 | 112 |
| 112 } // namespace blink | 113 } // namespace blink |
| OLD | NEW |