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

Side by Side Diff: Source/core/inspector/InspectorResourceContentLoader.cpp

Issue 1111173002: Removing blink::prefix (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Incorporating Review Comments Created 5 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
« no previous file with comments | « Source/core/inspector/InspectorResourceAgent.cpp ('k') | Source/core/loader/CookieJar.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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "core/inspector/InspectorResourceContentLoader.h" 6 #include "core/inspector/InspectorResourceContentLoader.h"
7 7
8 #include "core/css/CSSStyleSheet.h" 8 #include "core/css/CSSStyleSheet.h"
9 #include "core/css/StyleSheetContents.h" 9 #include "core/css/StyleSheetContents.h"
10 #include "core/dom/Document.h" 10 #include "core/dom/Document.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 HashSet<String> urlsToFetch; 96 HashSet<String> urlsToFetch;
97 97
98 ResourceRequest resourceRequest; 98 ResourceRequest resourceRequest;
99 HistoryItem* item = document->frame() ? document->frame()->loader().curr entItem() : nullptr; 99 HistoryItem* item = document->frame() ? document->frame()->loader().curr entItem() : nullptr;
100 if (item) { 100 if (item) {
101 resourceRequest = FrameLoader::requestFromHistoryItem(item, ReturnCa cheDataDontLoad); 101 resourceRequest = FrameLoader::requestFromHistoryItem(item, ReturnCa cheDataDontLoad);
102 } else { 102 } else {
103 resourceRequest = document->url(); 103 resourceRequest = document->url();
104 resourceRequest.setCachePolicy(ReturnCacheDataDontLoad); 104 resourceRequest.setCachePolicy(ReturnCacheDataDontLoad);
105 } 105 }
106 resourceRequest.setRequestContext(blink::WebURLRequest::RequestContextIn ternal); 106 resourceRequest.setRequestContext(WebURLRequest::RequestContextInternal) ;
107 107
108 if (!resourceRequest.url().string().isEmpty()) { 108 if (!resourceRequest.url().string().isEmpty()) {
109 urlsToFetch.add(resourceRequest.url().string()); 109 urlsToFetch.add(resourceRequest.url().string());
110 FetchRequest request(resourceRequest, FetchInitiatorTypeNames::inter nal); 110 FetchRequest request(resourceRequest, FetchInitiatorTypeNames::inter nal);
111 ResourcePtr<Resource> resource = document->fetcher()->fetchRawResour ce(request); 111 ResourcePtr<Resource> resource = document->fetcher()->fetchRawResour ce(request);
112 if (resource) { 112 if (resource) {
113 // Prevent garbage collection by holding a reference to this res ource. 113 // Prevent garbage collection by holding a reference to this res ource.
114 m_resources.append(resource.get()); 114 m_resources.append(resource.get());
115 ResourceClient* resourceClient = new ResourceClient(this); 115 ResourceClient* resourceClient = new ResourceClient(this);
116 m_pendingResourceClients.add(resourceClient); 116 m_pendingResourceClients.add(resourceClient);
117 resourceClient->waitForResource(resource.get()); 117 resourceClient->waitForResource(resource.get());
118 } 118 }
119 } 119 }
120 120
121 WillBeHeapVector<RawPtrWillBeMember<CSSStyleSheet> > styleSheets; 121 WillBeHeapVector<RawPtrWillBeMember<CSSStyleSheet> > styleSheets;
122 InspectorCSSAgent::collectAllDocumentStyleSheets(document, styleSheets); 122 InspectorCSSAgent::collectAllDocumentStyleSheets(document, styleSheets);
123 for (CSSStyleSheet* styleSheet : styleSheets) { 123 for (CSSStyleSheet* styleSheet : styleSheets) {
124 if (styleSheet->isInline() || !styleSheet->contents()->loadCompleted ()) 124 if (styleSheet->isInline() || !styleSheet->contents()->loadCompleted ())
125 continue; 125 continue;
126 String url = styleSheet->baseURL().string(); 126 String url = styleSheet->baseURL().string();
127 if (url.isEmpty() || urlsToFetch.contains(url)) 127 if (url.isEmpty() || urlsToFetch.contains(url))
128 continue; 128 continue;
129 urlsToFetch.add(url); 129 urlsToFetch.add(url);
130 FetchRequest request(ResourceRequest(url), FetchInitiatorTypeNames:: internal); 130 FetchRequest request(ResourceRequest(url), FetchInitiatorTypeNames:: internal);
131 request.mutableResourceRequest().setRequestContext(blink::WebURLRequ est::RequestContextInternal); 131 request.mutableResourceRequest().setRequestContext(WebURLRequest::Re questContextInternal);
132 ResourcePtr<Resource> resource = document->fetcher()->fetchCSSStyleS heet(request); 132 ResourcePtr<Resource> resource = document->fetcher()->fetchCSSStyleS heet(request);
133 if (!resource) 133 if (!resource)
134 continue; 134 continue;
135 // Prevent garbage collection by holding a reference to this resourc e. 135 // Prevent garbage collection by holding a reference to this resourc e.
136 m_resources.append(resource.get()); 136 m_resources.append(resource.get());
137 ResourceClient* resourceClient = new ResourceClient(this); 137 ResourceClient* resourceClient = new ResourceClient(this);
138 m_pendingResourceClients.add(resourceClient); 138 m_pendingResourceClients.add(resourceClient);
139 resourceClient->waitForResource(resource.get()); 139 resourceClient->waitForResource(resource.get());
140 } 140 }
141 } 141 }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 callback->handleEvent(); 194 callback->handleEvent();
195 } 195 }
196 196
197 void InspectorResourceContentLoader::resourceFinished(ResourceClient* client) 197 void InspectorResourceContentLoader::resourceFinished(ResourceClient* client)
198 { 198 {
199 m_pendingResourceClients.remove(client); 199 m_pendingResourceClients.remove(client);
200 checkDone(); 200 checkDone();
201 } 201 }
202 202
203 } // namespace blink 203 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorResourceAgent.cpp ('k') | Source/core/loader/CookieJar.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698