Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Side by Side Diff: Source/core/dom/MutationObserver.h

Issue 1148383012: Oilpan: prefer eager finalization over prefinalizers. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: expand&improve comments Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/bindings/core/v8/ScriptPromiseResolver.cpp ('k') | Source/core/dom/MutationObserver.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 finalized as destructor accesses heap object members.
99 EAGERLY_FINALIZE();
99 DECLARE_TRACE(); 100 DECLARE_TRACE();
100 101
101 private: 102 private:
102 struct ObserverLessThan; 103 struct ObserverLessThan;
103 104
104 explicit MutationObserver(PassOwnPtrWillBeRawPtr<MutationCallback>); 105 explicit MutationObserver(PassOwnPtrWillBeRawPtr<MutationCallback>);
105 void deliver(); 106 void deliver();
106 bool shouldBeSuspended() const; 107 bool shouldBeSuspended() const;
107 108
108 void dispose();
109
110 OwnPtrWillBeMember<MutationCallback> m_callback; 109 OwnPtrWillBeMember<MutationCallback> m_callback;
111 MutationRecordVector m_records; 110 MutationRecordVector m_records;
112 MutationObserverRegistrationSet m_registrations; 111 MutationObserverRegistrationSet m_registrations;
113 unsigned m_priority; 112 unsigned m_priority;
114 }; 113 };
115 114
116 } // namespace blink 115 } // namespace blink
117 116
118 #endif // MutationObserver_h 117 #endif // MutationObserver_h
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/ScriptPromiseResolver.cpp ('k') | Source/core/dom/MutationObserver.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698