| 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/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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 checkDone(); | 152 checkDone(); |
| 153 } | 153 } |
| 154 | 154 |
| 155 InspectorResourceContentLoader::~InspectorResourceContentLoader() | 155 InspectorResourceContentLoader::~InspectorResourceContentLoader() |
| 156 { | 156 { |
| 157 ASSERT(m_resources.isEmpty()); | 157 ASSERT(m_resources.isEmpty()); |
| 158 } | 158 } |
| 159 | 159 |
| 160 DEFINE_TRACE(InspectorResourceContentLoader) | 160 DEFINE_TRACE(InspectorResourceContentLoader) |
| 161 { | 161 { |
| 162 visitor->trace(m_callbacks); | |
| 163 visitor->trace(m_inspectedFrame); | 162 visitor->trace(m_inspectedFrame); |
| 164 } | 163 } |
| 165 | 164 |
| 166 void InspectorResourceContentLoader::didCommitLoadForLocalFrame(LocalFrame* fram
e) | 165 void InspectorResourceContentLoader::didCommitLoadForLocalFrame(LocalFrame* fram
e) |
| 167 { | 166 { |
| 168 if (frame == m_inspectedFrame) | 167 if (frame == m_inspectedFrame) |
| 169 stop(); | 168 stop(); |
| 170 } | 169 } |
| 171 | 170 |
| 172 void InspectorResourceContentLoader::dispose() | 171 void InspectorResourceContentLoader::dispose() |
| (...skipping 16 matching lines...) Expand all Loading... |
| 189 | 188 |
| 190 bool InspectorResourceContentLoader::hasFinished() | 189 bool InspectorResourceContentLoader::hasFinished() |
| 191 { | 190 { |
| 192 return m_allRequestsStarted && m_pendingResourceClients.size() == 0; | 191 return m_allRequestsStarted && m_pendingResourceClients.size() == 0; |
| 193 } | 192 } |
| 194 | 193 |
| 195 void InspectorResourceContentLoader::checkDone() | 194 void InspectorResourceContentLoader::checkDone() |
| 196 { | 195 { |
| 197 if (!hasFinished()) | 196 if (!hasFinished()) |
| 198 return; | 197 return; |
| 199 WillBeHeapVector<OwnPtrWillBeMember<Closure>> callbacks; | 198 Vector<OwnPtr<Closure>> callbacks; |
| 200 callbacks.swap(m_callbacks); | 199 callbacks.swap(m_callbacks); |
| 201 for (const auto& callback : callbacks) | 200 for (const auto& callback : callbacks) |
| 202 (*callback)(); | 201 (*callback)(); |
| 203 } | 202 } |
| 204 | 203 |
| 205 void InspectorResourceContentLoader::resourceFinished(ResourceClient* client) | 204 void InspectorResourceContentLoader::resourceFinished(ResourceClient* client) |
| 206 { | 205 { |
| 207 m_pendingResourceClients.remove(client); | 206 m_pendingResourceClients.remove(client); |
| 208 checkDone(); | 207 checkDone(); |
| 209 } | 208 } |
| 210 | 209 |
| 211 } // namespace blink | 210 } // namespace blink |
| OLD | NEW |