OLD | NEW |
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/FetchInitiatorTypeNames.h" | 8 #include "core/FetchInitiatorTypeNames.h" |
9 #include "core/css/CSSStyleSheet.h" | 9 #include "core/css/CSSStyleSheet.h" |
10 #include "core/css/StyleSheetContents.h" | 10 #include "core/css/StyleSheetContents.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Vector<CSSStyleSheet*> styleSheets; | 121 WillBeHeapVector<RawPtrWillBeMember<CSSStyleSheet> > styleSheets; |
122 InspectorCSSAgent::collectAllDocumentStyleSheets(document, styleSheets); | 122 InspectorCSSAgent::collectAllDocumentStyleSheets(document, styleSheets); |
123 for (Vector<CSSStyleSheet*>::const_iterator stylesheetIt = styleSheets.b
egin(); stylesheetIt != styleSheets.end(); ++stylesheetIt) { | 123 for (WillBeHeapVector<RawPtrWillBeMember<CSSStyleSheet> >::const_iterato
r stylesheetIt = styleSheets.begin(); stylesheetIt != styleSheets.end(); ++style
sheetIt) { |
124 CSSStyleSheet* styleSheet = *stylesheetIt; | 124 CSSStyleSheet* styleSheet = *stylesheetIt; |
125 if (styleSheet->isInline() || !styleSheet->contents()->loadCompleted
()) | 125 if (styleSheet->isInline() || !styleSheet->contents()->loadCompleted
()) |
126 continue; | 126 continue; |
127 String url = styleSheet->baseURL().string(); | 127 String url = styleSheet->baseURL().string(); |
128 if (url.isEmpty() || urlsToFetch.contains(url)) | 128 if (url.isEmpty() || urlsToFetch.contains(url)) |
129 continue; | 129 continue; |
130 urlsToFetch.add(url); | 130 urlsToFetch.add(url); |
131 FetchRequest request(ResourceRequest(url), FetchInitiatorTypeNames::
internal); | 131 FetchRequest request(ResourceRequest(url), FetchInitiatorTypeNames::
internal); |
132 request.mutableResourceRequest().setRequestContext(blink::WebURLRequ
est::RequestContextInternal); | 132 request.mutableResourceRequest().setRequestContext(blink::WebURLRequ
est::RequestContextInternal); |
133 ResourcePtr<Resource> resource = document->fetcher()->fetchCSSStyleS
heet(request); | 133 ResourcePtr<Resource> resource = document->fetcher()->fetchCSSStyleS
heet(request); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 (*it)->handleEvent(); | 184 (*it)->handleEvent(); |
185 } | 185 } |
186 | 186 |
187 void InspectorResourceContentLoader::resourceFinished(ResourceClient* client) | 187 void InspectorResourceContentLoader::resourceFinished(ResourceClient* client) |
188 { | 188 { |
189 m_pendingResourceClients.remove(client); | 189 m_pendingResourceClients.remove(client); |
190 checkDone(); | 190 checkDone(); |
191 } | 191 } |
192 | 192 |
193 } // namespace blink | 193 } // namespace blink |
OLD | NEW |