OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 EditingMarkerList_h | 5 #ifndef EditingMarkerList_h |
6 #define EditingMarkerList_h | 6 #define EditingMarkerList_h |
7 | 7 |
8 #include "core/editing/markers/DocumentMarkerList.h" | 8 #include "core/editing/markers/DocumentMarkerList.h" |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
11 | 11 |
12 class DocumentMarker; | 12 class DocumentMarker; |
13 | 13 |
14 // EditingMarkerList is a subclass of DocumentMarkerList that takes advantage of | 14 // EditingMarkerList is a subclass of DocumentMarkerList that takes advantage of |
15 // the fact that its markers are sorted if they are inserted in a sorted order, | 15 // the fact that its markers are sorted if they are inserted in a sorted order, |
16 // but also supports efficiently inserting markers in non-sorted order. | 16 // but also supports efficiently inserting markers in non-sorted order. |
17 // TODO(rlanday): Currently if markers are inserted in non-sorted order, this | 17 // TODO(rlanday): Currently if markers are inserted in non-sorted order, this |
18 // class just leaves them non-sorted until the list is cleared; is it ever | 18 // class just leaves them non-sorted until the list is cleared; is it ever |
19 // advantageous to pre-emptively sort the list? | 19 // advantageous to pre-emptively sort the list? |
20 class CORE_EXPORT EditingMarkerList : public DocumentMarkerList { | 20 class CORE_EXPORT EditingMarkerList : public DocumentMarkerList { |
21 public: | 21 public: |
22 EditingMarkerList(); | 22 EditingMarkerList(); |
23 | 23 |
24 // DocumentMarkerList implementations | 24 // DocumentMarkerList implementations |
25 bool isEditingMarkerList() const final; | 25 bool isEditingMarkerList() const final; |
26 | 26 |
27 void add(DocumentMarker*) override; | 27 void add(DocumentMarker*) override; |
28 void clear() final; | 28 void clear() final; |
29 | 29 |
30 DECLARE_VIRTUAL_TRACE(); | |
31 | |
32 protected: | 30 protected: |
33 // TODO(rlanday): determine if/when we should sort the marker list to improve | 31 // TODO(rlanday): determine if/when we should sort the marker list to improve |
34 // performance | 32 // performance |
35 bool markerListIsSorted() const final; | 33 bool markerListIsSorted() const final; |
36 | 34 |
37 bool m_markersAreSorted; | 35 bool m_markersAreSorted; |
38 | 36 |
39 DISALLOW_COPY_AND_ASSIGN(EditingMarkerList); | 37 DISALLOW_COPY_AND_ASSIGN(EditingMarkerList); |
40 }; | 38 }; |
41 | 39 |
42 DEFINE_TYPE_CASTS(EditingMarkerList, | 40 DEFINE_TYPE_CASTS(EditingMarkerList, |
43 DocumentMarkerList, | 41 DocumentMarkerList, |
44 list, | 42 list, |
45 list->isEditingMarkerList(), | 43 list->isEditingMarkerList(), |
46 list.isEditingMarkerList()); | 44 list.isEditingMarkerList()); |
47 | 45 |
48 } // namespace blink | 46 } // namespace blink |
49 | 47 |
50 #endif // EditingMarkerList_h | 48 #endif // EditingMarkerList_h |
OLD | NEW |