Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(668)

Side by Side Diff: Source/core/html/parser/HTMLResourcePreloader.cpp

Issue 14672042: Prepare to add more initiator info to CachedResource(Request) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/html/HTMLLinkElement.cpp ('k') | Source/core/loader/DocumentLoader.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « Source/core/html/HTMLLinkElement.cpp ('k') | Source/core/loader/DocumentLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698