| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 if (!frame->isLocalFrame()) | 57 if (!frame->isLocalFrame()) |
| 58 continue; | 58 continue; |
| 59 LocalFrame* localFrame = toLocalFrame(frame); | 59 LocalFrame* localFrame = toLocalFrame(frame); |
| 60 documents.append(localFrame->document()); | 60 documents.append(localFrame->document()); |
| 61 documents.appendVector(InspectorPageAgent::importsForFrame(localFrame)); | 61 documents.appendVector(InspectorPageAgent::importsForFrame(localFrame)); |
| 62 } | 62 } |
| 63 for (Vector<Document*>::const_iterator documentIt = documents.begin(); docum
entIt != documents.end(); ++documentIt) { | 63 for (Vector<Document*>::const_iterator documentIt = documents.begin(); docum
entIt != documents.end(); ++documentIt) { |
| 64 Document* document = *documentIt; | 64 Document* document = *documentIt; |
| 65 | 65 |
| 66 HashSet<String> urlsToFetch; | 66 HashSet<String> urlsToFetch; |
| 67 Vector<CSSStyleSheet*> styleSheets; | 67 WillBeHeapVector<RawPtrWillBeMember<CSSStyleSheet> > styleSheets; |
| 68 InspectorCSSAgent::collectAllDocumentStyleSheets(document, styleSheets); | 68 InspectorCSSAgent::collectAllDocumentStyleSheets(document, styleSheets); |
| 69 for (Vector<CSSStyleSheet*>::const_iterator stylesheetIt = styleSheets.b
egin(); stylesheetIt != styleSheets.end(); ++stylesheetIt) { | 69 for (WillBeHeapVector<RawPtrWillBeMember<CSSStyleSheet> >::const_iterato
r stylesheetIt = styleSheets.begin(); stylesheetIt != styleSheets.end(); ++style
sheetIt) { |
| 70 CSSStyleSheet* styleSheet = *stylesheetIt; | 70 CSSStyleSheet* styleSheet = *stylesheetIt; |
| 71 if (styleSheet->isInline() || !styleSheet->contents()->loadCompleted
()) | 71 if (styleSheet->isInline() || !styleSheet->contents()->loadCompleted
()) |
| 72 continue; | 72 continue; |
| 73 String url = styleSheet->baseURL().string(); | 73 String url = styleSheet->baseURL().string(); |
| 74 if (url.isEmpty() || urlsToFetch.contains(url)) | 74 if (url.isEmpty() || urlsToFetch.contains(url)) |
| 75 continue; | 75 continue; |
| 76 urlsToFetch.add(url); | 76 urlsToFetch.add(url); |
| 77 FetchRequest request(ResourceRequest(url), FetchInitiatorTypeNames::
internal); | 77 FetchRequest request(ResourceRequest(url), FetchInitiatorTypeNames::
internal); |
| 78 ResourcePtr<Resource> resource = document->fetcher()->fetchCSSStyleS
heet(request); | 78 ResourcePtr<Resource> resource = document->fetcher()->fetchCSSStyleS
heet(request); |
| 79 // Prevent garbage collection by holding a reference to this resourc
e. | 79 // Prevent garbage collection by holding a reference to this resourc
e. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 (*it)->handleEvent(); | 125 (*it)->handleEvent(); |
| 126 } | 126 } |
| 127 | 127 |
| 128 void InspectorResourceContentLoader::resourceFinished(ResourceClient* client) | 128 void InspectorResourceContentLoader::resourceFinished(ResourceClient* client) |
| 129 { | 129 { |
| 130 m_pendingResourceClients.remove(client); | 130 m_pendingResourceClients.remove(client); |
| 131 checkDone(); | 131 checkDone(); |
| 132 } | 132 } |
| 133 | 133 |
| 134 } // namespace WebCore | 134 } // namespace WebCore |
| OLD | NEW |