Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 53 typedef unsigned char MutationObserverOptions; | 53 typedef unsigned char MutationObserverOptions; |
| 54 typedef unsigned char MutationRecordDeliveryOptions; | 54 typedef unsigned char MutationRecordDeliveryOptions; |
| 55 | 55 |
| 56 using MutationObserverSet = WillBeHeapHashSet<RefPtrWillBeMember<MutationObserve r>>; | 56 using MutationObserverSet = WillBeHeapHashSet<RefPtrWillBeMember<MutationObserve r>>; |
| 57 using MutationObserverRegistrationSet = WillBeHeapHashSet<RawPtrWillBeWeakMember <MutationObserverRegistration>>; | 57 using MutationObserverRegistrationSet = WillBeHeapHashSet<RawPtrWillBeWeakMember <MutationObserverRegistration>>; |
| 58 using MutationObserverVector = WillBeHeapVector<RefPtrWillBeMember<MutationObser ver>>; | 58 using MutationObserverVector = WillBeHeapVector<RefPtrWillBeMember<MutationObser ver>>; |
| 59 using MutationRecordVector = WillBeHeapVector<RefPtrWillBeMember<MutationRecord> >; | 59 using MutationRecordVector = WillBeHeapVector<RefPtrWillBeMember<MutationRecord> >; |
| 60 | 60 |
| 61 class MutationObserver final : public RefCountedWillBeGarbageCollectedFinalized< MutationObserver>, public ScriptWrappable { | 61 class MutationObserver final : public RefCountedWillBeGarbageCollectedFinalized< MutationObserver>, public ScriptWrappable { |
| 62 DEFINE_WRAPPERTYPEINFO(); | 62 DEFINE_WRAPPERTYPEINFO(); |
| 63 WILL_BE_USING_PRE_FINALIZER(MutationObserver, dispose); | |
| 64 public: | 63 public: |
| 65 enum MutationType { | 64 enum MutationType { |
| 66 ChildList = 1 << 0, | 65 ChildList = 1 << 0, |
| 67 Attributes = 1 << 1, | 66 Attributes = 1 << 1, |
| 68 CharacterData = 1 << 2, | 67 CharacterData = 1 << 2, |
| 69 | 68 |
| 70 AllMutationTypes = ChildList | Attributes | CharacterData | 69 AllMutationTypes = ChildList | Attributes | CharacterData |
| 71 }; | 70 }; |
| 72 | 71 |
| 73 enum ObservationFlags { | 72 enum ObservationFlags { |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 89 void observe(Node*, const MutationObserverInit&, ExceptionState&); | 88 void observe(Node*, const MutationObserverInit&, ExceptionState&); |
| 90 MutationRecordVector takeRecords(); | 89 MutationRecordVector takeRecords(); |
| 91 void disconnect(); | 90 void disconnect(); |
| 92 void observationStarted(MutationObserverRegistration*); | 91 void observationStarted(MutationObserverRegistration*); |
| 93 void observationEnded(MutationObserverRegistration*); | 92 void observationEnded(MutationObserverRegistration*); |
| 94 void enqueueMutationRecord(PassRefPtrWillBeRawPtr<MutationRecord>); | 93 void enqueueMutationRecord(PassRefPtrWillBeRawPtr<MutationRecord>); |
| 95 void setHasTransientRegistration(); | 94 void setHasTransientRegistration(); |
| 96 | 95 |
| 97 WillBeHeapHashSet<RawPtrWillBeMember<Node>> getObservedNodes() const; | 96 WillBeHeapHashSet<RawPtrWillBeMember<Node>> getObservedNodes() const; |
| 98 | 97 |
| 98 EAGERLY_FINALIZE(); | |
|
haraken
2015/06/04 01:02:31
Add a comment on why we want to eagerly finalize?
sof
2015/06/04 07:54:39
Added. (I couldn't come up with anything meaningfu
| |
| 99 DECLARE_TRACE(); | 99 DECLARE_TRACE(); |
| 100 | 100 |
| 101 private: | 101 private: |
| 102 struct ObserverLessThan; | 102 struct ObserverLessThan; |
| 103 | 103 |
| 104 explicit MutationObserver(PassOwnPtrWillBeRawPtr<MutationCallback>); | 104 explicit MutationObserver(PassOwnPtrWillBeRawPtr<MutationCallback>); |
| 105 void deliver(); | 105 void deliver(); |
| 106 bool shouldBeSuspended() const; | 106 bool shouldBeSuspended() const; |
| 107 | 107 |
| 108 void dispose(); | |
| 109 | |
| 110 OwnPtrWillBeMember<MutationCallback> m_callback; | 108 OwnPtrWillBeMember<MutationCallback> m_callback; |
| 111 MutationRecordVector m_records; | 109 MutationRecordVector m_records; |
| 112 MutationObserverRegistrationSet m_registrations; | 110 MutationObserverRegistrationSet m_registrations; |
| 113 unsigned m_priority; | 111 unsigned m_priority; |
| 114 }; | 112 }; |
| 115 | 113 |
| 116 } // namespace blink | 114 } // namespace blink |
| 117 | 115 |
| 118 #endif // MutationObserver_h | 116 #endif // MutationObserver_h |
| OLD | NEW |