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

Side by Side Diff: Source/core/dom/Range.cpp

Issue 1335573004: Introduce Range::dispose() for prompt detachment from owner Document. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: split out rangeContents() switch Created 5 years, 3 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 | « Source/core/dom/Range.h ('k') | Source/core/editing/spellcheck/SpellCheckRequester.h » ('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 * (C) 1999 Lars Knoll (knoll@kde.org) 2 * (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Gunnstein Lye (gunnstein@netcom.no) 3 * (C) 2000 Gunnstein Lye (gunnstein@netcom.no)
4 * (C) 2000 Frederik Holljen (frederik.holljen@hig.no) 4 * (C) 2000 Frederik Holljen (frederik.holljen@hig.no)
5 * (C) 2001 Peter Kelly (pmk@post.com) 5 * (C) 2001 Peter Kelly (pmk@post.com)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
7 * Copyright (C) 2011 Motorola Mobility. All rights reserved. 7 * Copyright (C) 2011 Motorola Mobility. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 // Always detach (even if we've already detached) to fix https://bugs.webkit .org/show_bug.cgi?id=26044 128 // Always detach (even if we've already detached) to fix https://bugs.webkit .org/show_bug.cgi?id=26044
129 m_ownerDocument->detachRange(this); 129 m_ownerDocument->detachRange(this);
130 #endif 130 #endif
131 131
132 #ifndef NDEBUG 132 #ifndef NDEBUG
133 rangeCounter.decrement(); 133 rangeCounter.decrement();
134 #endif 134 #endif
135 } 135 }
136 #endif 136 #endif
137 137
138 void Range::dispose()
139 {
140 #if ENABLE(OILPAN)
141 // A prompt detach from the owning Document helps avoid GC overhead.
142 m_ownerDocument->detachRange(this);
143 #endif
144 }
145
138 void Range::setDocument(Document& document) 146 void Range::setDocument(Document& document)
139 { 147 {
140 ASSERT(m_ownerDocument != document); 148 ASSERT(m_ownerDocument != document);
141 ASSERT(m_ownerDocument); 149 ASSERT(m_ownerDocument);
142 m_ownerDocument->detachRange(this); 150 m_ownerDocument->detachRange(this);
143 m_ownerDocument = &document; 151 m_ownerDocument = &document;
144 m_start.setToStartOfNode(document); 152 m_start.setToStartOfNode(document);
145 m_end.setToStartOfNode(document); 153 m_end.setToStartOfNode(document);
146 m_ownerDocument->attachRange(this); 154 m_ownerDocument->attachRange(this);
147 } 155 }
(...skipping 1534 matching lines...) Expand 10 before | Expand all | Expand 10 after
1682 { 1690 {
1683 if (range && range->boundaryPointsValid()) { 1691 if (range && range->boundaryPointsValid()) {
1684 range->startContainer()->showTreeAndMark(range->startContainer(), "S", r ange->endContainer(), "E"); 1692 range->startContainer()->showTreeAndMark(range->startContainer(), "S", r ange->endContainer(), "E");
1685 fprintf(stderr, "start offset: %d, end offset: %d\n", range->startOffset (), range->endOffset()); 1693 fprintf(stderr, "start offset: %d, end offset: %d\n", range->startOffset (), range->endOffset());
1686 } else { 1694 } else {
1687 fprintf(stderr, "Cannot show tree if range is null, or if boundary point s are invalid.\n"); 1695 fprintf(stderr, "Cannot show tree if range is null, or if boundary point s are invalid.\n");
1688 } 1696 }
1689 } 1697 }
1690 1698
1691 #endif 1699 #endif
OLDNEW
« no previous file with comments | « Source/core/dom/Range.h ('k') | Source/core/editing/spellcheck/SpellCheckRequester.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698