| 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 #ifndef InspectorResourceContentLoader_h | 5 #ifndef InspectorResourceContentLoader_h |
| 6 #define InspectorResourceContentLoader_h | 6 #define InspectorResourceContentLoader_h |
| 7 | 7 |
| 8 #include "core/fetch/ResourcePtr.h" | 8 #include "core/fetch/ResourcePtr.h" |
| 9 #include "wtf/HashSet.h" | 9 #include "wtf/HashSet.h" |
| 10 #include "wtf/Noncopyable.h" | 10 #include "wtf/Noncopyable.h" |
| 11 #include "wtf/Vector.h" | 11 #include "wtf/Vector.h" |
| 12 | 12 |
| 13 namespace WebCore { | 13 namespace WebCore { |
| 14 | 14 |
| 15 class CSSStyleSheetResource; | 15 class CSSStyleSheetResource; |
| 16 class Page; | 16 class Page; |
| 17 class Resource; | 17 class Resource; |
| 18 class VoidCallback; | 18 class VoidCallback; |
| 19 | 19 |
| 20 class InspectorResourceContentLoader FINAL { | 20 class InspectorResourceContentLoader FINAL { |
| 21 WTF_MAKE_NONCOPYABLE(InspectorResourceContentLoader); | 21 WTF_MAKE_NONCOPYABLE(InspectorResourceContentLoader); |
| 22 WTF_MAKE_FAST_ALLOCATED; | 22 WTF_MAKE_FAST_ALLOCATED; |
| 23 public: | 23 public: |
| 24 InspectorResourceContentLoader(Page*); | 24 InspectorResourceContentLoader(Page*); |
| 25 void addListener(PassOwnPtr<VoidCallback>); | 25 void ensureResourcesContentLoaded(PassOwnPtr<VoidCallback>); |
| 26 ~InspectorResourceContentLoader(); | 26 ~InspectorResourceContentLoader(); |
| 27 bool hasFinished(); | 27 bool hasFinished(); |
| 28 void stop(); | 28 void stop(); |
| 29 | 29 |
| 30 private: | 30 private: |
| 31 class ResourceClient; | 31 class ResourceClient; |
| 32 | 32 |
| 33 void resourceFinished(ResourceClient*); | 33 void resourceFinished(ResourceClient*); |
| 34 void checkDone(); | 34 void checkDone(); |
| 35 void start(); |
| 35 | 36 |
| 36 Vector<OwnPtr<VoidCallback> > m_callbacks; | 37 Vector<OwnPtr<VoidCallback> > m_callbacks; |
| 37 bool m_allRequestsStarted; | 38 bool m_allRequestsStarted; |
| 39 bool m_started; |
| 40 Page* m_page; |
| 38 HashSet<ResourceClient*> m_pendingResourceClients; | 41 HashSet<ResourceClient*> m_pendingResourceClients; |
| 39 Vector<ResourcePtr<Resource> > m_resources; | 42 Vector<ResourcePtr<Resource> > m_resources; |
| 40 | 43 |
| 41 friend class ResourceClient; | 44 friend class ResourceClient; |
| 42 }; | 45 }; |
| 43 | 46 |
| 44 } // namespace WebCore | 47 } // namespace WebCore |
| 45 | 48 |
| 46 | 49 |
| 47 #endif // !defined(InspectorResourceContentLoader_h) | 50 #endif // !defined(InspectorResourceContentLoader_h) |
| OLD | NEW |