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 "FetchInitiatorTypeNames.h" | 8 #include "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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 if (!resourceRequest.url().string().isEmpty()) { | 45 if (!resourceRequest.url().string().isEmpty()) { |
46 urlsToFetch.add(resourceRequest.url().string()); | 46 urlsToFetch.add(resourceRequest.url().string()); |
47 FetchRequest request(resourceRequest, FetchInitiatorTypeNames::inter
nal); | 47 FetchRequest request(resourceRequest, FetchInitiatorTypeNames::inter
nal); |
48 ResourcePtr<Resource> resource = document->fetcher()->fetchRawResour
ce(request); | 48 ResourcePtr<Resource> resource = document->fetcher()->fetchRawResour
ce(request); |
49 // Prevent garbage collection by holding a reference to this resourc
e. | 49 // Prevent garbage collection by holding a reference to this resourc
e. |
50 m_pendingResources.add(resource.get()); | 50 m_pendingResources.add(resource.get()); |
51 m_resources.append(resource.get()); | 51 m_resources.append(resource.get()); |
52 resource->addClient(static_cast<RawResourceClient*>(this)); | 52 resource->addClient(static_cast<RawResourceClient*>(this)); |
53 } | 53 } |
54 | 54 |
55 Vector<CSSStyleSheet*> styleSheets; | 55 WillBeHeapVector<RawPtrWillBeMember<CSSStyleSheet> > styleSheets; |
56 InspectorCSSAgent::collectAllDocumentStyleSheets(document, styleSheets); | 56 InspectorCSSAgent::collectAllDocumentStyleSheets(document, styleSheets); |
57 for (Vector<CSSStyleSheet*>::const_iterator it2 = styleSheets.begin(); i
t2 != styleSheets.end(); ++it2) { | 57 for (WillBeHeapVector<RawPtrWillBeMember<CSSStyleSheet> >::const_iterato
r it2 = styleSheets.begin(); it2 != styleSheets.end(); ++it2) { |
58 CSSStyleSheet* styleSheet = *it2; | 58 CSSStyleSheet* styleSheet = *it2; |
59 if (styleSheet->isInline() || !styleSheet->contents()->loadCompleted
()) | 59 if (styleSheet->isInline() || !styleSheet->contents()->loadCompleted
()) |
60 continue; | 60 continue; |
61 String url = styleSheet->contents()->baseURL().string(); | 61 String url = styleSheet->contents()->baseURL().string(); |
62 if (url.isEmpty() || urlsToFetch.contains(url)) | 62 if (url.isEmpty() || urlsToFetch.contains(url)) |
63 continue; | 63 continue; |
64 urlsToFetch.add(url); | 64 urlsToFetch.add(url); |
65 FetchRequest request(ResourceRequest(url), FetchInitiatorTypeNames::
internal); | 65 FetchRequest request(ResourceRequest(url), FetchInitiatorTypeNames::
internal); |
66 ResourcePtr<Resource> resource = document->fetcher()->fetchCSSStyleS
heet(request); | 66 ResourcePtr<Resource> resource = document->fetcher()->fetchCSSStyleS
heet(request); |
67 // Prevent garbage collection by holding a reference to this resourc
e. | 67 // Prevent garbage collection by holding a reference to this resourc
e. |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 } | 134 } |
135 | 135 |
136 void InspectorResourceContentLoader::resourceFinished(Resource* resource) | 136 void InspectorResourceContentLoader::resourceFinished(Resource* resource) |
137 { | 137 { |
138 m_pendingResources.remove(resource); | 138 m_pendingResources.remove(resource); |
139 removeAsClientFromResource(resource); | 139 removeAsClientFromResource(resource); |
140 checkDone(); | 140 checkDone(); |
141 } | 141 } |
142 | 142 |
143 } // namespace WebCore | 143 } // namespace WebCore |
OLD | NEW |