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