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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp
diff --git a/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp
index e6e67c732f3df129031ba0821c0804b295cb8734..5636609527a0001ebb4f573519f5397c39a9a37e 100644
--- a/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp
+++ b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp
@@ -95,6 +95,20 @@ Member<DocumentMarkerList>& DocumentMarkerController::ListForType(
inline bool DocumentMarkerController::PossiblyHasMarkers(
DocumentMarker::MarkerTypes types) {
+ if (markers_.IsEmpty()) {
+ // It's possible for markers_ to become empty through garbage collection if
+ // all its Nodes are GC'ed since we only hold weak references, in which case
+ // possibly_existing_marker_types_ isn't reset to 0 as it is in the other
+ // codepaths that remove from markers_. Therefore, we check for this case
+ // here.
+
+ // Alternatively, we could handle this case at the time the Node is GC'ed,
+ // but that operation is more performance-sensitive than anywhere
+ // PossiblyHasMarkers() is used.
+ possibly_existing_marker_types_ = 0;
+ return false;
+ }
+
return possibly_existing_marker_types_.Intersects(types);
}
« 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