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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 ResourceClient* resourceClient = new ResourceClient(this); | 138 ResourceClient* resourceClient = new ResourceClient(this); |
139 m_pendingResourceClients.add(resourceClient); | 139 m_pendingResourceClients.add(resourceClient); |
140 resourceClient->waitForResource(resource.get()); | 140 resourceClient->waitForResource(resource.get()); |
141 } | 141 } |
142 } | 142 } |
143 | 143 |
144 m_allRequestsStarted = true; | 144 m_allRequestsStarted = true; |
145 checkDone(); | 145 checkDone(); |
146 } | 146 } |
147 | 147 |
148 void InspectorResourceContentLoader::ensureResourcesContentLoaded(PassOwnPtrWill
BeRawPtr<VoidCallback> callback) | 148 void InspectorResourceContentLoader::ensureResourcesContentLoaded(VoidCallback*
callback) |
149 { | 149 { |
150 if (!m_started) | 150 if (!m_started) |
151 start(); | 151 start(); |
152 m_callbacks.append(callback); | 152 m_callbacks.append(callback); |
153 checkDone(); | 153 checkDone(); |
154 } | 154 } |
155 | 155 |
156 InspectorResourceContentLoader::~InspectorResourceContentLoader() | 156 InspectorResourceContentLoader::~InspectorResourceContentLoader() |
157 { | 157 { |
158 ASSERT(m_resources.isEmpty()); | 158 ASSERT(m_resources.isEmpty()); |
(...skipping 23 matching lines...) Expand all Loading... |
182 | 182 |
183 bool InspectorResourceContentLoader::hasFinished() | 183 bool InspectorResourceContentLoader::hasFinished() |
184 { | 184 { |
185 return m_allRequestsStarted && m_pendingResourceClients.size() == 0; | 185 return m_allRequestsStarted && m_pendingResourceClients.size() == 0; |
186 } | 186 } |
187 | 187 |
188 void InspectorResourceContentLoader::checkDone() | 188 void InspectorResourceContentLoader::checkDone() |
189 { | 189 { |
190 if (!hasFinished()) | 190 if (!hasFinished()) |
191 return; | 191 return; |
192 WillBeHeapVector<OwnPtrWillBeMember<VoidCallback> > callbacks; | 192 PersistentHeapVectorWillBeHeapVector<Member<VoidCallback> > callbacks; |
193 callbacks.swap(m_callbacks); | 193 callbacks.swap(m_callbacks); |
194 for (WillBeHeapVector<OwnPtrWillBeMember<VoidCallback> >::const_iterator it
= callbacks.begin(); it != callbacks.end(); ++it) | 194 for (PersistentHeapVectorWillBeHeapVector<Member<VoidCallback> >::const_iter
ator it = callbacks.begin(); it != callbacks.end(); ++it) |
195 (*it)->handleEvent(); | 195 (*it)->handleEvent(); |
196 } | 196 } |
197 | 197 |
198 void InspectorResourceContentLoader::resourceFinished(ResourceClient* client) | 198 void InspectorResourceContentLoader::resourceFinished(ResourceClient* client) |
199 { | 199 { |
200 m_pendingResourceClients.remove(client); | 200 m_pendingResourceClients.remove(client); |
201 checkDone(); | 201 checkDone(); |
202 } | 202 } |
203 | 203 |
204 } // namespace blink | 204 } // namespace blink |
OLD | NEW |