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

Side by Side Diff: Source/WebCore/dom/Document.h

Issue 12518022: Merge 143840 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1410/
Patch Set: Created 7 years, 9 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/WebCore/WebCore.exp.in ('k') | Source/WebCore/dom/Document.cpp » ('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 * 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, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
9 * Copyright (C) 2011 Google Inc. All rights reserved. 9 * Copyright (C) 2011 Google Inc. All rights reserved.
10 * 10 *
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 { 221 {
222 return adoptRef(new Document(frame, url, true, false)); 222 return adoptRef(new Document(frame, url, true, false));
223 } 223 }
224 virtual ~Document(); 224 virtual ~Document();
225 225
226 MediaQueryMatcher* mediaQueryMatcher(); 226 MediaQueryMatcher* mediaQueryMatcher();
227 227
228 using ContainerNode::ref; 228 using ContainerNode::ref;
229 using ContainerNode::deref; 229 using ContainerNode::deref;
230 230
231 // Nodes belonging to this document hold guard references -
232 // these are enough to keep the document from being destroyed, but
233 // not enough to keep it from removing its children. This allows a
234 // node that outlives its document to still have a valid document
235 // pointer without introducing reference cycles.
236 void guardRef()
237 {
238 ASSERT(!m_deletionHasBegun);
239 ++m_guardRefCount;
240 }
241
242 void guardDeref()
243 {
244 ASSERT(!m_deletionHasBegun);
245 --m_guardRefCount;
246 if (!m_guardRefCount && !refCount()) {
247 #ifndef NDEBUG
248 m_deletionHasBegun = true;
249 #endif
250 delete this;
251 }
252 }
253
254 Element* getElementById(const AtomicString& id) const; 231 Element* getElementById(const AtomicString& id) const;
255 232
256 virtual bool canContainRangeEndPoint() const { return true; } 233 virtual bool canContainRangeEndPoint() const { return true; }
257 234
258 Element* getElementByAccessKey(const String& key); 235 Element* getElementByAccessKey(const String& key);
259 void invalidateAccessKeyMap(); 236 void invalidateAccessKeyMap();
260 237
261 SelectorQueryCache* selectorQueryCache(); 238 SelectorQueryCache* selectorQueryCache();
262 239
263 // DOM methods & attributes for Document 240 // DOM methods & attributes for Document
(...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after
1210 Document(Frame*, const KURL&, bool isXHTML, bool isHTML); 1187 Document(Frame*, const KURL&, bool isXHTML, bool isHTML);
1211 1188
1212 virtual void didUpdateSecurityOrigin() OVERRIDE; 1189 virtual void didUpdateSecurityOrigin() OVERRIDE;
1213 1190
1214 void clearXMLVersion() { m_xmlVersion = String(); } 1191 void clearXMLVersion() { m_xmlVersion = String(); }
1215 1192
1216 private: 1193 private:
1217 friend class Node; 1194 friend class Node;
1218 friend class IgnoreDestructiveWriteCountIncrementer; 1195 friend class IgnoreDestructiveWriteCountIncrementer;
1219 1196
1220 void removedLastRef(); 1197 virtual void dispose() OVERRIDE;
1221 1198
1222 void detachParser(); 1199 void detachParser();
1223 1200
1224 typedef void (*ArgumentsCallback)(const String& keyString, const String& val ueString, Document*, void* data); 1201 typedef void (*ArgumentsCallback)(const String& keyString, const String& val ueString, Document*, void* data);
1225 void processArguments(const String& features, void* data, ArgumentsCallback) ; 1202 void processArguments(const String& features, void* data, ArgumentsCallback) ;
1226 1203
1227 virtual bool isDocument() const { return true; } 1204 virtual bool isDocument() const { return true; }
1228 1205
1229 virtual void childrenChanged(bool changedByParser = false, Node* beforeChang e = 0, Node* afterChange = 0, int childCountDelta = 0); 1206 virtual void childrenChanged(bool changedByParser = false, Node* beforeChang e = 0, Node* afterChange = 0, int childCountDelta = 0);
1230 1207
1231 virtual String nodeName() const; 1208 virtual String nodeName() const;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1279 void addDocumentToFullScreenChangeEventQueue(Document*); 1256 void addDocumentToFullScreenChangeEventQueue(Document*);
1280 #endif 1257 #endif
1281 1258
1282 void setVisualUpdatesAllowed(ReadyState); 1259 void setVisualUpdatesAllowed(ReadyState);
1283 void setVisualUpdatesAllowed(bool); 1260 void setVisualUpdatesAllowed(bool);
1284 void visualUpdatesSuppressionTimerFired(Timer<Document>*); 1261 void visualUpdatesSuppressionTimerFired(Timer<Document>*);
1285 1262
1286 void addListenerType(ListenerType listenerType) { m_listenerTypes |= listene rType; } 1263 void addListenerType(ListenerType listenerType) { m_listenerTypes |= listene rType; }
1287 void addMutationEventListenerTypeIfEnabled(ListenerType); 1264 void addMutationEventListenerTypeIfEnabled(ListenerType);
1288 1265
1289 int m_guardRefCount;
1290
1291 void styleResolverThrowawayTimerFired(Timer<Document>*); 1266 void styleResolverThrowawayTimerFired(Timer<Document>*);
1292 Timer<Document> m_styleResolverThrowawayTimer; 1267 Timer<Document> m_styleResolverThrowawayTimer;
1293 double m_lastStyleResolverAccessTime; 1268 double m_lastStyleResolverAccessTime;
1294 1269
1295 OwnPtr<StyleResolver> m_styleResolver; 1270 OwnPtr<StyleResolver> m_styleResolver;
1296 bool m_didCalculateStyleResolver; 1271 bool m_didCalculateStyleResolver;
1297 bool m_hasDirtyStyleResolver; 1272 bool m_hasDirtyStyleResolver;
1298 bool m_hasNodesWithPlaceholderStyle; 1273 bool m_hasNodesWithPlaceholderStyle;
1299 bool m_needsNotifyRemoveAllPendingStylesheet; 1274 bool m_needsNotifyRemoveAllPendingStylesheet;
1300 // But sometimes you need to ignore pending stylesheet count to 1275 // But sometimes you need to ignore pending stylesheet count to
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
1596 return this == documentInternal(); 1571 return this == documentInternal();
1597 } 1572 }
1598 1573
1599 inline Node::Node(Document* document, ConstructionType type) 1574 inline Node::Node(Document* document, ConstructionType type)
1600 : m_nodeFlags(type) 1575 : m_nodeFlags(type)
1601 , m_parentOrShadowHostNode(0) 1576 , m_parentOrShadowHostNode(0)
1602 , m_treeScope(document) 1577 , m_treeScope(document)
1603 , m_previous(0) 1578 , m_previous(0)
1604 , m_next(0) 1579 , m_next(0)
1605 { 1580 {
1606 if (document) 1581 if (!m_treeScope)
1607 document->guardRef();
1608 else
1609 m_treeScope = TreeScope::noDocumentInstance(); 1582 m_treeScope = TreeScope::noDocumentInstance();
1583 m_treeScope->guardRef();
1610 1584
1611 #if !defined(NDEBUG) || (defined(DUMP_NODE_STATISTICS) && DUMP_NODE_STATISTICS) 1585 #if !defined(NDEBUG) || (defined(DUMP_NODE_STATISTICS) && DUMP_NODE_STATISTICS)
1612 trackForDebugging(); 1586 trackForDebugging();
1613 #endif 1587 #endif
1614 InspectorCounters::incrementCounter(InspectorCounters::NodeCounter); 1588 InspectorCounters::incrementCounter(InspectorCounters::NodeCounter);
1615 } 1589 }
1616 1590
1617 Node* eventTargetNodeForDocument(Document*); 1591 Node* eventTargetNodeForDocument(Document*);
1618 1592
1619 } // namespace WebCore 1593 } // namespace WebCore
1620 1594
1621 #endif // Document_h 1595 #endif // Document_h
OLDNEW
« no previous file with comments | « Source/WebCore/WebCore.exp.in ('k') | Source/WebCore/dom/Document.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698