| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. | 2 * Copyright (C) 2012 Adobe Systems Incorporated. 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above | 8 * 1. Redistributions of source code must retain the above |
| 9 * copyright notice, this list of conditions and the following | 9 * copyright notice, this list of conditions and the following |
| 10 * disclaimer. | 10 * disclaimer. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 26 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 27 * SUCH DAMAGE. | 27 * SUCH DAMAGE. |
| 28 */ | 28 */ |
| 29 | 29 |
| 30 #include "config.h" | 30 #include "config.h" |
| 31 #include "core/dom/NamedFlowCollection.h" | 31 #include "core/dom/NamedFlowCollection.h" |
| 32 | 32 |
| 33 #include "RuntimeEnabledFeatures.h" | 33 #include "RuntimeEnabledFeatures.h" |
| 34 #include "core/dom/DOMNamedFlowCollection.h" | 34 #include "core/dom/DOMNamedFlowCollection.h" |
| 35 #include "core/dom/Document.h" | 35 #include "core/dom/Document.h" |
| 36 #include "core/inspector/InspectorInstrumentation.h" | |
| 37 #include "wtf/text/AtomicString.h" | 36 #include "wtf/text/AtomicString.h" |
| 38 #include "wtf/text/StringHash.h" | 37 #include "wtf/text/StringHash.h" |
| 39 #include "wtf/text/WTFString.h" | 38 #include "wtf/text/WTFString.h" |
| 40 | 39 |
| 41 namespace WebCore { | 40 namespace WebCore { |
| 42 | 41 |
| 43 NamedFlowCollection::NamedFlowCollection(Document* document) | 42 NamedFlowCollection::NamedFlowCollection(Document* document) |
| 44 : DocumentLifecycleObserver(document) | 43 : DocumentLifecycleObserver(document) |
| 45 { | 44 { |
| 46 ASSERT(RuntimeEnabledFeatures::cssRegionsEnabled()); | 45 ASSERT(RuntimeEnabledFeatures::cssRegionsEnabled()); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 77 if (it != m_namedFlows.end()) { | 76 if (it != m_namedFlows.end()) { |
| 78 NamedFlow* namedFlow = *it; | 77 NamedFlow* namedFlow = *it; |
| 79 ASSERT(namedFlow->flowState() == NamedFlow::FlowStateNull); | 78 ASSERT(namedFlow->flowState() == NamedFlow::FlowStateNull); |
| 80 | 79 |
| 81 return namedFlow; | 80 return namedFlow; |
| 82 } | 81 } |
| 83 | 82 |
| 84 RefPtr<NamedFlow> newFlow = NamedFlow::create(this, flowName); | 83 RefPtr<NamedFlow> newFlow = NamedFlow::create(this, flowName); |
| 85 m_namedFlows.add(newFlow.get()); | 84 m_namedFlows.add(newFlow.get()); |
| 86 | 85 |
| 87 InspectorInstrumentation::didCreateNamedFlow(document(), newFlow.get()); | |
| 88 | |
| 89 return newFlow.release(); | 86 return newFlow.release(); |
| 90 } | 87 } |
| 91 | 88 |
| 92 void NamedFlowCollection::discardNamedFlow(NamedFlow* namedFlow) | 89 void NamedFlowCollection::discardNamedFlow(NamedFlow* namedFlow) |
| 93 { | 90 { |
| 94 // The document is not valid anymore so the collection will be destroyed any
way. | 91 // The document is not valid anymore so the collection will be destroyed any
way. |
| 95 if (!document()) | 92 if (!document()) |
| 96 return; | 93 return; |
| 97 | 94 |
| 98 ASSERT(namedFlow->flowState() == NamedFlow::FlowStateNull); | 95 ASSERT(namedFlow->flowState() == NamedFlow::FlowStateNull); |
| 99 ASSERT(m_namedFlows.contains(namedFlow)); | 96 ASSERT(m_namedFlows.contains(namedFlow)); |
| 100 | 97 |
| 101 InspectorInstrumentation::willRemoveNamedFlow(document(), namedFlow); | |
| 102 | |
| 103 m_namedFlows.remove(namedFlow); | 98 m_namedFlows.remove(namedFlow); |
| 104 } | 99 } |
| 105 | 100 |
| 106 Document* NamedFlowCollection::document() const | 101 Document* NamedFlowCollection::document() const |
| 107 { | 102 { |
| 108 return lifecycleContext(); | 103 return lifecycleContext(); |
| 109 } | 104 } |
| 110 | 105 |
| 111 PassRefPtr<DOMNamedFlowCollection> NamedFlowCollection::createCSSOMSnapshot() | 106 PassRefPtr<DOMNamedFlowCollection> NamedFlowCollection::createCSSOMSnapshot() |
| 112 { | 107 { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 125 static const bool safeToCompareToEmptyOrDeleted = true; | 120 static const bool safeToCompareToEmptyOrDeleted = true; |
| 126 }; | 121 }; |
| 127 | 122 |
| 128 // The HashTranslator is used to lookup a NamedFlow in the set using a name. | 123 // The HashTranslator is used to lookup a NamedFlow in the set using a name. |
| 129 struct NamedFlowCollection::NamedFlowHashTranslator { | 124 struct NamedFlowCollection::NamedFlowHashTranslator { |
| 130 static unsigned hash(const AtomicString& key) { return DefaultHash<AtomicStr
ing>::Hash::hash(key); } | 125 static unsigned hash(const AtomicString& key) { return DefaultHash<AtomicStr
ing>::Hash::hash(key); } |
| 131 static bool equal(NamedFlow* a, const AtomicString& b) { return a->name() ==
b; } | 126 static bool equal(NamedFlow* a, const AtomicString& b) { return a->name() ==
b; } |
| 132 }; | 127 }; |
| 133 | 128 |
| 134 } // namespace WebCore | 129 } // namespace WebCore |
| OLD | NEW |