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

Side by Side Diff: third_party/WebKit/Source/core/dom/SynchronousMutationNotifier.h

Issue 2692093003: Rewrite DocumentMarkerController to use SynchronousMutationObserver (Closed)
Patch Set: Don't try to use -1 as default value for unsigned int Created 3 years, 10 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 SynchronousMutationNotifier_h 5 #ifndef SynchronousMutationNotifier_h
6 #define SynchronousMutationNotifier_h 6 #define SynchronousMutationNotifier_h
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "core/CoreExport.h" 9 #include "core/CoreExport.h"
10 #include "platform/LifecycleNotifier.h" 10 #include "platform/LifecycleNotifier.h"
11 11
12 namespace blink { 12 namespace blink {
13 13
14 class CharacterData; 14 class CharacterData;
15 class ContainerNode; 15 class ContainerNode;
16 class Document; 16 class Document;
17 class Node; 17 class Node;
18 class NodeWithIndex; 18 class NodeWithIndex;
19 class SynchronousMutationObserver; 19 class SynchronousMutationObserver;
20 class Text; 20 class Text;
21 21
22 class CORE_EXPORT SynchronousMutationNotifier 22 class CORE_EXPORT SynchronousMutationNotifier
23 : public LifecycleNotifier<Document, SynchronousMutationObserver> { 23 : public LifecycleNotifier<Document, SynchronousMutationObserver> {
24 public: 24 public:
25 class ScopedNotificationSuppressor {
26 public:
27 ScopedNotificationSuppressor(SynchronousMutationNotifier*);
28 ~ScopedNotificationSuppressor();
29
30 private:
31 DISALLOW_COPY_AND_ASSIGN(ScopedNotificationSuppressor);
32
33 Persistent<SynchronousMutationNotifier> m_notifier;
34 };
35
36 DECLARE_VIRTUAL_TRACE();
37
25 // TODO(yosin): We will have |notifyXXX()| functions defined in 38 // TODO(yosin): We will have |notifyXXX()| functions defined in
26 // |SynchronousMutationObserver|. 39 // |SynchronousMutationObserver|.
27 void notifyChangeChildren(const ContainerNode&); 40 void notifyChangeChildren(const ContainerNode&);
28 void notifyMergeTextNodes(const Text& mergedNode, 41 void notifyMergeTextNodes(const Text& mergedNode,
29 const NodeWithIndex& nodeToBeRemovedWithIndex, 42 const NodeWithIndex& nodeToBeRemovedWithIndex,
30 unsigned oldLength); 43 unsigned oldLength);
31 void notifyMoveTreeToNewDocument(const Node&); 44 void notifyMoveTreeToNewDocument(const Node&);
32 void notifySplitTextNode(const Text&); 45 void notifySplitTextNode(const Text&);
33 void notifyUpdateCharacterData(CharacterData*, 46 void notifyUpdateCharacterData(CharacterData*,
34 unsigned offset, 47 unsigned offset,
35 unsigned oldLength, 48 unsigned oldLength,
36 unsigned newLength); 49 unsigned newLength);
37 void notifyNodeChildrenWillBeRemoved(ContainerNode&); 50 void notifyNodeChildrenWillBeRemoved(ContainerNode&);
38 void notifyNodeWillBeRemoved(Node&); 51 void notifyNodeWillBeRemoved(Node&);
39 52
53 void incrementSuppressorCount();
54 void decrementSuppressorCount();
55
40 protected: 56 protected:
41 SynchronousMutationNotifier(); 57 SynchronousMutationNotifier();
42 58
43 private: 59 private:
44 DISALLOW_COPY_AND_ASSIGN(SynchronousMutationNotifier); 60 DISALLOW_COPY_AND_ASSIGN(SynchronousMutationNotifier);
61
62 void notifyUpdateCharacterDataImmediately(CharacterData*,
63 unsigned offset,
64 unsigned oldLength,
65 unsigned newLength);
66 void flushPendingCharacterDataUpdate();
67
68 int m_suppressorCount;
69
70 // Data for pending character data update
71 Member<CharacterData> m_pendingCharacterData;
72 unsigned m_pendingOffset;
73 unsigned m_pendingOldLength;
74 unsigned m_pendingNewLength;
45 }; 75 };
46 76
47 } // namespace dom 77 } // namespace dom
48 78
49 #endif // SynchronousMutationNotifier_h 79 #endif // SynchronousMutationNotifier_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698