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

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

Issue 330383004: Oilpan: Introduce TempRangeScope to avoid needless Range attaches on Document. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address review comments. Created 6 years, 5 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 | Annotate | Revision Log
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 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 static PassRefPtrWillBeRawPtr<Node> processContentsBetweenOffsets(ActionType , PassRefPtrWillBeRawPtr<DocumentFragment>, Node*, unsigned startOffset, unsigne d endOffset, ExceptionState&); 163 static PassRefPtrWillBeRawPtr<Node> processContentsBetweenOffsets(ActionType , PassRefPtrWillBeRawPtr<DocumentFragment>, Node*, unsigned startOffset, unsigne d endOffset, ExceptionState&);
164 static void processNodes(ActionType, WillBeHeapVector<RefPtrWillBeMember<Nod e> >&, PassRefPtrWillBeRawPtr<Node> oldContainer, PassRefPtrWillBeRawPtr<Node> n ewContainer, ExceptionState&); 164 static void processNodes(ActionType, WillBeHeapVector<RefPtrWillBeMember<Nod e> >&, PassRefPtrWillBeRawPtr<Node> oldContainer, PassRefPtrWillBeRawPtr<Node> n ewContainer, ExceptionState&);
165 enum ContentsProcessDirection { ProcessContentsForward, ProcessContentsBackw ard }; 165 enum ContentsProcessDirection { ProcessContentsForward, ProcessContentsBackw ard };
166 static PassRefPtrWillBeRawPtr<Node> processAncestorsAndTheirSiblings(ActionT ype, Node* container, ContentsProcessDirection, PassRefPtrWillBeRawPtr<Node> clo nedContainer, Node* commonRoot, ExceptionState&); 166 static PassRefPtrWillBeRawPtr<Node> processAncestorsAndTheirSiblings(ActionT ype, Node* container, ContentsProcessDirection, PassRefPtrWillBeRawPtr<Node> clo nedContainer, Node* commonRoot, ExceptionState&);
167 167
168 RefPtrWillBeMember<Document> m_ownerDocument; // Cannot be null. 168 RefPtrWillBeMember<Document> m_ownerDocument; // Cannot be null.
169 RangeBoundaryPoint m_start; 169 RangeBoundaryPoint m_start;
170 RangeBoundaryPoint m_end; 170 RangeBoundaryPoint m_end;
171 }; 171 };
172 172
173 #if ENABLE(OILPAN)
174 // Ranges are registered on the owner document so that they can be
175 // updated via the document when the document changes. Ranges are
176 // often used as short-lived results of subcomputations that become
177 // unreachable without any document modifications. Such short-lived
178 // ranges need not be registered with the document. When a
179 // TemporaryRangeScope is on the stack created range objects are not
180 // attached to the document. With Oilpan this is important to not
181 // build up a large set of ranges on the Document that we will waste
182 // time updating even though they will never be needed.
183 class TemporaryRangeScope {
184 public:
185 TemporaryRangeScope() { ++s_nesting; }
186 ~TemporaryRangeScope() { --s_nesting; }
187 static bool active() { return s_nesting != 0; }
yosin_UTC9 2014/06/25 01:22:20 nit: Just |return s_nesting|
188 private:
189 static unsigned s_nesting;
190 };
191 #else
192 class TemporaryRangeScope {
193 public:
194 TemporaryRangeScope() { }
195 static bool active() { return false; }
196 };
197 #endif
198
173 PassRefPtrWillBeRawPtr<Range> rangeOfContents(Node*); 199 PassRefPtrWillBeRawPtr<Range> rangeOfContents(Node*);
174 200
175 bool areRangesEqual(const Range*, const Range*); 201 bool areRangesEqual(const Range*, const Range*);
176 202
177 } // namespace 203 } // namespace
178 204
179 #ifndef NDEBUG 205 #ifndef NDEBUG
180 // Outside the WebCore namespace for ease of invocation from gdb. 206 // Outside the WebCore namespace for ease of invocation from gdb.
181 void showTree(const WebCore::Range*); 207 void showTree(const WebCore::Range*);
182 #endif 208 #endif
183 209
184 #endif 210 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698