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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 } | 52 } |
53 | 53 |
54 FetchRequest PreloadRequest::resourceRequest(Document* document) | 54 FetchRequest PreloadRequest::resourceRequest(Document* document) |
55 { | 55 { |
56 ASSERT(isMainThread()); | 56 ASSERT(isMainThread()); |
57 FetchInitiatorInfo initiatorInfo; | 57 FetchInitiatorInfo initiatorInfo; |
58 initiatorInfo.name = m_initiatorName; | 58 initiatorInfo.name = m_initiatorName; |
59 initiatorInfo.position = m_initiatorPosition; | 59 initiatorInfo.position = m_initiatorPosition; |
60 FetchRequest request(ResourceRequest(completeURL(document)), initiatorInfo); | 60 FetchRequest request(ResourceRequest(completeURL(document)), initiatorInfo); |
61 | 61 |
62 // FIXME: It's possible CORS should work for other request types? | 62 if (m_isCORSEnabled) |
63 if (m_resourceType == Resource::Script) | 63 request.setCrossOriginAccessControl(document->securityOrigin(), m_allowC
redentials); |
64 request.mutableResourceRequest().setAllowCookies(m_crossOriginModeAllows
Cookies); | |
65 return request; | 64 return request; |
66 } | 65 } |
67 | 66 |
68 void HTMLResourcePreloader::takeAndPreload(PreloadRequestStream& r) | 67 void HTMLResourcePreloader::takeAndPreload(PreloadRequestStream& r) |
69 { | 68 { |
70 PreloadRequestStream requests; | 69 PreloadRequestStream requests; |
71 requests.swap(r); | 70 requests.swap(r); |
72 | 71 |
73 for (PreloadRequestStream::iterator it = requests.begin(); it != requests.en
d(); ++it) | 72 for (PreloadRequestStream::iterator it = requests.begin(); it != requests.en
d(); ++it) |
74 preload(it->release()); | 73 preload(it->release()); |
(...skipping 17 matching lines...) Expand all Loading... |
92 if (!preload->media().isEmpty() && !mediaAttributeMatches(executingDocument-
>frame(), executingDocument->renderer()->style(), preload->media())) | 91 if (!preload->media().isEmpty() && !mediaAttributeMatches(executingDocument-
>frame(), executingDocument->renderer()->style(), preload->media())) |
93 return; | 92 return; |
94 | 93 |
95 FetchRequest request = preload->resourceRequest(m_document); | 94 FetchRequest request = preload->resourceRequest(m_document); |
96 blink::Platform::current()->histogramCustomCounts("WebCore.PreloadDelayMs",
static_cast<int>(1000 * (monotonicallyIncreasingTime() - preload->discoveryTime(
))), 0, 2000, 20); | 95 blink::Platform::current()->histogramCustomCounts("WebCore.PreloadDelayMs",
static_cast<int>(1000 * (monotonicallyIncreasingTime() - preload->discoveryTime(
))), 0, 2000, 20); |
97 loadingDocument->fetcher()->preload(preload->resourceType(), request, preloa
d->charset()); | 96 loadingDocument->fetcher()->preload(preload->resourceType(), request, preloa
d->charset()); |
98 } | 97 } |
99 | 98 |
100 | 99 |
101 } | 100 } |
OLD | NEW |