| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 PassOwnPtrWillBeRawPtr<HTMLResourcePreloader> HTMLResourcePreloader::create(Docu
ment& document) | 43 PassOwnPtrWillBeRawPtr<HTMLResourcePreloader> HTMLResourcePreloader::create(Docu
ment& document) |
| 44 { | 44 { |
| 45 return adoptPtrWillBeNoop(new HTMLResourcePreloader(document)); | 45 return adoptPtrWillBeNoop(new HTMLResourcePreloader(document)); |
| 46 } | 46 } |
| 47 | 47 |
| 48 DEFINE_TRACE(HTMLResourcePreloader) | 48 DEFINE_TRACE(HTMLResourcePreloader) |
| 49 { | 49 { |
| 50 visitor->trace(m_document); | 50 visitor->trace(m_document); |
| 51 } | 51 } |
| 52 | 52 |
| 53 void HTMLResourcePreloader::preloadReferrerPolicy(const String& policy) |
| 54 { |
| 55 m_document->processReferrerPolicy(policy); |
| 56 } |
| 57 |
| 53 static void preconnectHost(PreloadRequest* request) | 58 static void preconnectHost(PreloadRequest* request) |
| 54 { | 59 { |
| 55 ASSERT(request); | 60 ASSERT(request); |
| 56 ASSERT(request->isPreconnect()); | 61 ASSERT(request->isPreconnect()); |
| 57 KURL host(request->baseURL(), request->resourceURL()); | 62 KURL host(request->baseURL(), request->resourceURL()); |
| 58 if (!host.isValid() || !host.protocolIsInHTTPFamily()) | 63 if (!host.isValid() || !host.protocolIsInHTTPFamily()) |
| 59 return; | 64 return; |
| 60 CrossOriginAttributeValue crossOrigin = CrossOriginAttributeNotSet; | 65 CrossOriginAttributeValue crossOrigin = CrossOriginAttributeNotSet; |
| 61 if (request->isCORS()) { | 66 if (request->isCORS()) { |
| 62 if (request->isAllowCredentials()) | 67 if (request->isAllowCredentials()) |
| (...skipping 19 matching lines...) Expand all Loading... |
| 82 if (request.url().protocolIsData()) | 87 if (request.url().protocolIsData()) |
| 83 return; | 88 return; |
| 84 if (preload->resourceType() == Resource::Script || preload->resourceType() =
= Resource::CSSStyleSheet || preload->resourceType() == Resource::ImportResource
) | 89 if (preload->resourceType() == Resource::Script || preload->resourceType() =
= Resource::CSSStyleSheet || preload->resourceType() == Resource::ImportResource
) |
| 85 request.setCharset(preload->charset().isEmpty() ? m_document->charset().
string() : preload->charset()); | 90 request.setCharset(preload->charset().isEmpty() ? m_document->charset().
string() : preload->charset()); |
| 86 request.setForPreload(true); | 91 request.setForPreload(true); |
| 87 Platform::current()->histogramCustomCounts("WebCore.PreloadDelayMs", static_
cast<int>(1000 * (monotonicallyIncreasingTime() - preload->discoveryTime())), 0,
2000, 20); | 92 Platform::current()->histogramCustomCounts("WebCore.PreloadDelayMs", static_
cast<int>(1000 * (monotonicallyIncreasingTime() - preload->discoveryTime())), 0,
2000, 20); |
| 88 m_document->loader()->startPreload(preload->resourceType(), request); | 93 m_document->loader()->startPreload(preload->resourceType(), request); |
| 89 } | 94 } |
| 90 | 95 |
| 91 } // namespace blink | 96 } // namespace blink |
| OLD | NEW |