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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 } | 45 } |
46 | 46 |
47 KURL PreloadRequest::completeURL(Document* document) | 47 KURL PreloadRequest::completeURL(Document* document) |
48 { | 48 { |
49 return document->completeURL(m_resourceURL, m_baseURL.isEmpty() ? document->
url() : m_baseURL); | 49 return document->completeURL(m_resourceURL, m_baseURL.isEmpty() ? document->
url() : m_baseURL); |
50 } | 50 } |
51 | 51 |
52 CachedResourceRequest PreloadRequest::resourceRequest(Document* document) | 52 CachedResourceRequest PreloadRequest::resourceRequest(Document* document) |
53 { | 53 { |
54 ASSERT(isMainThread()); | 54 ASSERT(isMainThread()); |
55 CachedResourceRequest request(ResourceRequest(completeURL(document))); | 55 CachedResourceRequest request(ResourceRequest(completeURL(document)), m_init
iator); |
56 request.setInitiator(m_initiator); | |
57 | 56 |
58 // FIXME: It's possible CORS should work for other request types? | 57 // FIXME: It's possible CORS should work for other request types? |
59 if (m_resourceType == CachedResource::Script) | 58 if (m_resourceType == CachedResource::Script) |
60 request.mutableResourceRequest().setAllowCookies(m_crossOriginModeAllows
Cookies); | 59 request.mutableResourceRequest().setAllowCookies(m_crossOriginModeAllows
Cookies); |
61 return request; | 60 return request; |
62 } | 61 } |
63 | 62 |
64 void HTMLResourcePreloader::takeAndPreload(PreloadRequestStream& r) | 63 void HTMLResourcePreloader::takeAndPreload(PreloadRequestStream& r) |
65 { | 64 { |
66 PreloadRequestStream requests; | 65 PreloadRequestStream requests; |
(...skipping 17 matching lines...) Expand all Loading... |
84 ASSERT(m_document->renderer()->style()); | 83 ASSERT(m_document->renderer()->style()); |
85 if (!preload->media().isEmpty() && !mediaAttributeMatches(m_document->frame(
), m_document->renderer()->style(), preload->media())) | 84 if (!preload->media().isEmpty() && !mediaAttributeMatches(m_document->frame(
), m_document->renderer()->style(), preload->media())) |
86 return; | 85 return; |
87 | 86 |
88 CachedResourceRequest request = preload->resourceRequest(m_document); | 87 CachedResourceRequest request = preload->resourceRequest(m_document); |
89 m_document->cachedResourceLoader()->preload(preload->resourceType(), request
, preload->charset()); | 88 m_document->cachedResourceLoader()->preload(preload->resourceType(), request
, preload->charset()); |
90 } | 89 } |
91 | 90 |
92 | 91 |
93 } | 92 } |
OLD | NEW |