| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 namespace WebCore { | 40 namespace WebCore { |
| 41 | 41 |
| 42 class Element; | 42 class Element; |
| 43 | 43 |
| 44 class CustomElementUpgradeCandidateMap { | 44 class CustomElementUpgradeCandidateMap { |
| 45 WTF_MAKE_NONCOPYABLE(CustomElementUpgradeCandidateMap); | 45 WTF_MAKE_NONCOPYABLE(CustomElementUpgradeCandidateMap); |
| 46 public: | 46 public: |
| 47 CustomElementUpgradeCandidateMap() { } | 47 CustomElementUpgradeCandidateMap() { } |
| 48 ~CustomElementUpgradeCandidateMap(); | 48 ~CustomElementUpgradeCandidateMap(); |
| 49 | 49 |
| 50 // API for CustomElement to notify observers |
| 50 static void elementWasDestroyed(Element*); | 51 static void elementWasDestroyed(Element*); |
| 51 | 52 |
| 53 // API for CustomElementRegistrationContext to save and take candidates |
| 54 |
| 55 typedef ListHashSet<Element*> ElementSet; |
| 56 |
| 52 void add(const CustomElementDescriptor&, Element*); | 57 void add(const CustomElementDescriptor&, Element*); |
| 53 void remove(Element*); | 58 void remove(Element*); |
| 54 | |
| 55 typedef ListHashSet<Element*> ElementSet; | |
| 56 ElementSet takeUpgradeCandidatesFor(const CustomElementDescriptor&); | 59 ElementSet takeUpgradeCandidatesFor(const CustomElementDescriptor&); |
| 57 | 60 |
| 58 private: | 61 private: |
| 59 // Maps elements to upgrade candidate maps observing their destruction | 62 // Maps elements to upgrade candidate maps observing them |
| 60 typedef HashMap<Element*, CustomElementUpgradeCandidateMap*> DestructionObse
rverMap; | 63 typedef HashMap<Element*, CustomElementUpgradeCandidateMap*> ElementObserver
Map; |
| 61 static DestructionObserverMap& destructionObservers(); | 64 static ElementObserverMap& elementObservers(); |
| 62 static void registerForElementDestructionNotification(Element*, CustomElemen
tUpgradeCandidateMap*); | 65 void observe(Element*); |
| 63 static void unregisterForElementDestructionNotification(Element*, CustomElem
entUpgradeCandidateMap*); | 66 void unobserve(Element*); |
| 64 | 67 |
| 65 typedef HashMap<Element*, CustomElementDescriptor> UpgradeCandidateMap; | 68 typedef HashMap<Element*, CustomElementDescriptor> UpgradeCandidateMap; |
| 66 UpgradeCandidateMap m_upgradeCandidates; | 69 UpgradeCandidateMap m_upgradeCandidates; |
| 67 | 70 |
| 68 typedef HashMap<CustomElementDescriptor, ElementSet> UnresolvedDefinitionMap
; | 71 typedef HashMap<CustomElementDescriptor, ElementSet> UnresolvedDefinitionMap
; |
| 69 UnresolvedDefinitionMap m_unresolvedDefinitions; | 72 UnresolvedDefinitionMap m_unresolvedDefinitions; |
| 70 }; | 73 }; |
| 71 | 74 |
| 72 } | 75 } |
| 73 | 76 |
| 74 #endif // CustomElementUpgradeCandidateMap_h | 77 #endif // CustomElementUpgradeCandidateMap_h |
| OLD | NEW |