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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 } | 51 } |
52 | 52 |
53 int HTMLResourcePreloader::countPreloads() { | 53 int HTMLResourcePreloader::countPreloads() { |
54 if (m_document->loader()) | 54 if (m_document->loader()) |
55 return m_document->loader()->fetcher()->countPreloads(); | 55 return m_document->loader()->fetcher()->countPreloads(); |
56 return 0; | 56 return 0; |
57 } | 57 } |
58 | 58 |
59 static void preconnectHost(PreloadRequest* request, | 59 static void preconnectHost(PreloadRequest* request, |
60 const NetworkHintsInterface& networkHintsInterface) { | 60 const NetworkHintsInterface& networkHintsInterface) { |
61 ASSERT(request); | 61 DCHECK(request); |
62 ASSERT(request->isPreconnect()); | 62 DCHECK(request->isPreconnect()); |
63 KURL host(request->baseURL(), request->resourceURL()); | 63 KURL host(request->baseURL(), request->resourceURL()); |
64 if (!host.isValid() || !host.protocolIsInHTTPFamily()) | 64 if (!host.isValid() || !host.protocolIsInHTTPFamily()) |
65 return; | 65 return; |
66 networkHintsInterface.preconnectHost(host, request->crossOrigin()); | 66 networkHintsInterface.preconnectHost(host, request->crossOrigin()); |
67 } | 67 } |
68 | 68 |
69 void HTMLResourcePreloader::preload( | 69 void HTMLResourcePreloader::preload( |
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()) { |
(...skipping 15 matching lines...) Expand all Loading... |
88 if (resource && !resource->isLoaded() && | 88 if (resource && !resource->isLoaded() && |
89 preload->resourceType() == Resource::CSSStyleSheet) { | 89 preload->resourceType() == Resource::CSSStyleSheet) { |
90 Settings* settings = m_document->settings(); | 90 Settings* settings = m_document->settings(); |
91 if (settings && (settings->getCSSExternalScannerNoPreload() || | 91 if (settings && (settings->getCSSExternalScannerNoPreload() || |
92 settings->getCSSExternalScannerPreload())) | 92 settings->getCSSExternalScannerPreload())) |
93 m_cssPreloaders.insert(new CSSPreloaderResourceClient(resource, this)); | 93 m_cssPreloaders.insert(new CSSPreloaderResourceClient(resource, this)); |
94 } | 94 } |
95 } | 95 } |
96 | 96 |
97 } // namespace blink | 97 } // namespace blink |
OLD | NEW |