| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 SVGTreeScopeResources_h | 5 #ifndef SVGTreeScopeResources_h |
| 6 #define SVGTreeScopeResources_h | 6 #define SVGTreeScopeResources_h |
| 7 | 7 |
| 8 #include "platform/heap/Handle.h" | 8 #include "platform/heap/Handle.h" |
| 9 #include "wtf/Forward.h" | 9 #include "wtf/Forward.h" |
| 10 #include "wtf/HashMap.h" | 10 #include "wtf/HashMap.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 // element's id (which is used to identify a resource.) | 22 // element's id (which is used to identify a resource.) |
| 23 class SVGTreeScopeResources | 23 class SVGTreeScopeResources |
| 24 : public GarbageCollectedFinalized<SVGTreeScopeResources> { | 24 : public GarbageCollectedFinalized<SVGTreeScopeResources> { |
| 25 WTF_MAKE_NONCOPYABLE(SVGTreeScopeResources); | 25 WTF_MAKE_NONCOPYABLE(SVGTreeScopeResources); |
| 26 | 26 |
| 27 public: | 27 public: |
| 28 explicit SVGTreeScopeResources(TreeScope*); | 28 explicit SVGTreeScopeResources(TreeScope*); |
| 29 ~SVGTreeScopeResources(); | 29 ~SVGTreeScopeResources(); |
| 30 | 30 |
| 31 void updateResource(const AtomicString& id, LayoutSVGResourceContainer*); | 31 void updateResource(const AtomicString& id, LayoutSVGResourceContainer*); |
| 32 void removeResource(const AtomicString& id); | 32 void updateResource(const AtomicString& oldId, |
| 33 const AtomicString& newId, |
| 34 LayoutSVGResourceContainer*); |
| 35 void removeResource(const AtomicString& id, LayoutSVGResourceContainer*); |
| 33 LayoutSVGResourceContainer* resourceById(const AtomicString& id) const; | 36 LayoutSVGResourceContainer* resourceById(const AtomicString& id) const; |
| 34 | 37 |
| 35 // Pending resources are such which are referenced by any object in the SVG | 38 // Pending resources are such which are referenced by any object in the SVG |
| 36 // document, but do NOT exist yet. For instance, dynamically built gradients | 39 // document, but do NOT exist yet. For instance, dynamically built gradients |
| 37 // / patterns / clippers... | 40 // / patterns / clippers... |
| 38 void addPendingResource(const AtomicString& id, Element&); | 41 void addPendingResource(const AtomicString& id, Element&); |
| 39 bool isElementPendingResource(Element&, const AtomicString& id) const; | 42 bool isElementPendingResource(Element&, const AtomicString& id) const; |
| 40 void notifyResourceAvailable(const AtomicString& id); | 43 void notifyResourceAvailable(const AtomicString& id); |
| 41 void removeElementFromPendingResources(Element&); | 44 void removeElementFromPendingResources(Element&); |
| 42 | 45 |
| 43 DECLARE_TRACE(); | 46 DECLARE_TRACE(); |
| 44 | 47 |
| 45 private: | 48 private: |
| 46 void clearHasPendingResourcesIfPossible(Element&); | 49 void clearHasPendingResourcesIfPossible(Element&); |
| 47 | 50 |
| 48 using SVGPendingElements = HeapHashSet<Member<Element>>; | 51 using SVGPendingElements = HeapHashSet<Member<Element>>; |
| 52 using ResourceMap = HashMap<AtomicString, LayoutSVGResourceContainer*>; |
| 49 | 53 |
| 50 HashMap<AtomicString, LayoutSVGResourceContainer*> m_resources; | 54 void registerResource(const AtomicString& id, LayoutSVGResourceContainer*); |
| 55 void unregisterResource(ResourceMap::iterator); |
| 56 void notifyPendingClients(const AtomicString& id); |
| 57 |
| 58 ResourceMap m_resources; |
| 51 // Resources that are pending. | 59 // Resources that are pending. |
| 52 HeapHashMap<AtomicString, Member<SVGPendingElements>> m_pendingResources; | 60 HeapHashMap<AtomicString, Member<SVGPendingElements>> m_pendingResources; |
| 61 Member<TreeScope> m_treeScope; |
| 53 }; | 62 }; |
| 54 | 63 |
| 55 } // namespace blink | 64 } // namespace blink |
| 56 | 65 |
| 57 #endif // SVGTreeScopeResources_h | 66 #endif // SVGTreeScopeResources_h |
| OLD | NEW |