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

Side by Side Diff: third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp

Issue 2891843003: Fix bug causing DCHECKs to be hit in DocumentMarkerController (Closed)
Patch Set: Modify PossiblyHasMarkers() instead of removing DCHECKs Created 3 years, 7 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
« no previous file with comments | « no previous file | no next file » | 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
7 * reserved. 7 * reserved.
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 88
89 Member<DocumentMarkerList>& DocumentMarkerController::ListForType( 89 Member<DocumentMarkerList>& DocumentMarkerController::ListForType(
90 MarkerLists* marker_lists, 90 MarkerLists* marker_lists,
91 DocumentMarker::MarkerType type) { 91 DocumentMarker::MarkerType type) {
92 const size_t marker_list_index = MarkerTypeToMarkerIndex(type); 92 const size_t marker_list_index = MarkerTypeToMarkerIndex(type);
93 return (*marker_lists)[marker_list_index]; 93 return (*marker_lists)[marker_list_index];
94 } 94 }
95 95
96 inline bool DocumentMarkerController::PossiblyHasMarkers( 96 inline bool DocumentMarkerController::PossiblyHasMarkers(
97 DocumentMarker::MarkerTypes types) { 97 DocumentMarker::MarkerTypes types) {
98 if (markers_.IsEmpty()) {
99 // It's possible for markers_ to become empty through garbage collection if
100 // all its Nodes are GC'ed since we only hold weak references, in which case
101 // possibly_existing_marker_types_ isn't reset to 0 as it is in the other
102 // codepaths that remove from markers_. Therefore, we check for this case
103 // here.
104
105 // Alternatively, we could handle this case at the time the Node is GC'ed,
106 // but that operation is more performance-sensitive than anywhere
107 // PossiblyHasMarkers() is used.
108 possibly_existing_marker_types_ = 0;
109 return false;
110 }
111
98 return possibly_existing_marker_types_.Intersects(types); 112 return possibly_existing_marker_types_.Intersects(types);
99 } 113 }
100 114
101 DocumentMarkerController::DocumentMarkerController(Document& document) 115 DocumentMarkerController::DocumentMarkerController(Document& document)
102 : possibly_existing_marker_types_(0), document_(&document) { 116 : possibly_existing_marker_types_(0), document_(&document) {
103 SetContext(&document); 117 SetContext(&document);
104 } 118 }
105 119
106 void DocumentMarkerController::Clear() { 120 void DocumentMarkerController::Clear() {
107 markers_.clear(); 121 markers_.clear();
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 } 755 }
742 756
743 } // namespace blink 757 } // namespace blink
744 758
745 #ifndef NDEBUG 759 #ifndef NDEBUG
746 void showDocumentMarkers(const blink::DocumentMarkerController* controller) { 760 void showDocumentMarkers(const blink::DocumentMarkerController* controller) {
747 if (controller) 761 if (controller)
748 controller->ShowMarkers(); 762 controller->ShowMarkers();
749 } 763 }
750 #endif 764 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698