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

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

Issue 280123002: Oilpan: move LiveNodeList collections to the heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Have NodeRareData clear out NodeListsNodeData instead. Created 6 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 | « Source/core/dom/ContainerNode.cpp ('k') | Source/core/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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 * Retrieve all nodes that intersect a rect in the window's document, until it is fully enclosed by 339 * Retrieve all nodes that intersect a rect in the window's document, until it is fully enclosed by
340 * the boundaries of a node. 340 * the boundaries of a node.
341 * 341 *
342 * @param centerX x reference for the rectangle in CSS pixels 342 * @param centerX x reference for the rectangle in CSS pixels
343 * @param centerY y reference for the rectangle in CSS pixels 343 * @param centerY y reference for the rectangle in CSS pixels
344 * @param topPadding How much to expand the top of the rectangle 344 * @param topPadding How much to expand the top of the rectangle
345 * @param rightPadding How much to expand the right of the rectangle 345 * @param rightPadding How much to expand the right of the rectangle
346 * @param bottomPadding How much to expand the bottom of the rectangle 346 * @param bottomPadding How much to expand the bottom of the rectangle
347 * @param leftPadding How much to expand the left of the rectangle 347 * @param leftPadding How much to expand the left of the rectangle
348 */ 348 */
349 PassRefPtr<NodeList> nodesFromRect(int centerX, int centerY, 349 PassRefPtrWillBeRawPtr<NodeList> nodesFromRect(int centerX, int centerY,
350 unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsi gned leftPadding, 350 unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsi gned leftPadding,
351 HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::ConfusingAndOftenMisusedDisallowShadowC ontent) const; 351 HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::ConfusingAndOftenMisusedDisallowShadowC ontent) const;
352 Element* elementFromPoint(int x, int y) const; 352 Element* elementFromPoint(int x, int y) const;
353 PassRefPtrWillBeRawPtr<Range> caretRangeFromPoint(int x, int y); 353 PassRefPtrWillBeRawPtr<Range> caretRangeFromPoint(int x, int y);
354 354
355 String readyState() const; 355 String readyState() const;
356 356
357 String defaultCharset() const; 357 String defaultCharset() const;
358 358
359 AtomicString inputEncoding() const { return Document::encodingName(); } 359 AtomicString inputEncoding() const { return Document::encodingName(); }
(...skipping 26 matching lines...) Expand all
386 void setHasXMLDeclaration(bool hasXMLDeclaration) { m_hasXMLDeclaration = ha sXMLDeclaration ? 1 : 0; } 386 void setHasXMLDeclaration(bool hasXMLDeclaration) { m_hasXMLDeclaration = ha sXMLDeclaration ? 1 : 0; }
387 387
388 virtual KURL baseURI() const OVERRIDE FINAL; 388 virtual KURL baseURI() const OVERRIDE FINAL;
389 389
390 String visibilityState() const; 390 String visibilityState() const;
391 bool hidden() const; 391 bool hidden() const;
392 void didChangeVisibilityState(); 392 void didChangeVisibilityState();
393 393
394 PassRefPtrWillBeRawPtr<Node> adoptNode(PassRefPtrWillBeRawPtr<Node> source, ExceptionState&); 394 PassRefPtrWillBeRawPtr<Node> adoptNode(PassRefPtrWillBeRawPtr<Node> source, ExceptionState&);
395 395
396 PassRefPtr<HTMLCollection> images(); 396 PassRefPtrWillBeRawPtr<HTMLCollection> images();
397 PassRefPtr<HTMLCollection> embeds(); 397 PassRefPtrWillBeRawPtr<HTMLCollection> embeds();
398 PassRefPtr<HTMLCollection> applets(); 398 PassRefPtrWillBeRawPtr<HTMLCollection> applets();
399 PassRefPtr<HTMLCollection> links(); 399 PassRefPtrWillBeRawPtr<HTMLCollection> links();
400 PassRefPtr<HTMLCollection> forms(); 400 PassRefPtrWillBeRawPtr<HTMLCollection> forms();
401 PassRefPtr<HTMLCollection> anchors(); 401 PassRefPtrWillBeRawPtr<HTMLCollection> anchors();
402 PassRefPtr<HTMLCollection> scripts(); 402 PassRefPtrWillBeRawPtr<HTMLCollection> scripts();
403 PassRefPtr<HTMLAllCollection> allForBinding(); 403 PassRefPtrWillBeRawPtr<HTMLAllCollection> allForBinding();
404 PassRefPtr<HTMLAllCollection> all(); 404 PassRefPtrWillBeRawPtr<HTMLAllCollection> all();
405 405
406 PassRefPtr<HTMLCollection> windowNamedItems(const AtomicString& name); 406 PassRefPtrWillBeRawPtr<HTMLCollection> windowNamedItems(const AtomicString& name);
407 PassRefPtr<HTMLCollection> documentNamedItems(const AtomicString& name); 407 PassRefPtrWillBeRawPtr<HTMLCollection> documentNamedItems(const AtomicString & name);
408 408
409 bool isHTMLDocument() const { return m_documentClasses & HTMLDocumentClass; } 409 bool isHTMLDocument() const { return m_documentClasses & HTMLDocumentClass; }
410 bool isXHTMLDocument() const { return m_documentClasses & XHTMLDocumentClass ; } 410 bool isXHTMLDocument() const { return m_documentClasses & XHTMLDocumentClass ; }
411 bool isXMLDocument() const { return m_documentClasses & XMLDocumentClass; } 411 bool isXMLDocument() const { return m_documentClasses & XMLDocumentClass; }
412 bool isImageDocument() const { return m_documentClasses & ImageDocumentClass ; } 412 bool isImageDocument() const { return m_documentClasses & ImageDocumentClass ; }
413 bool isSVGDocument() const { return m_documentClasses & SVGDocumentClass; } 413 bool isSVGDocument() const { return m_documentClasses & SVGDocumentClass; }
414 bool isPluginDocument() const { return m_documentClasses & PluginDocumentCla ss; } 414 bool isPluginDocument() const { return m_documentClasses & PluginDocumentCla ss; }
415 bool isMediaDocument() const { return m_documentClasses & MediaDocumentClass ; } 415 bool isMediaDocument() const { return m_documentClasses & MediaDocumentClass ; }
416 416
417 bool hasSVGRootNode() const; 417 bool hasSVGRootNode() const;
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 654
655 void updateHoverActiveState(const HitTestRequest&, Element*, const PlatformM ouseEvent* = 0); 655 void updateHoverActiveState(const HitTestRequest&, Element*, const PlatformM ouseEvent* = 0);
656 656
657 // Updates for :target (CSS3 selector). 657 // Updates for :target (CSS3 selector).
658 void setCSSTarget(Element*); 658 void setCSSTarget(Element*);
659 Element* cssTarget() const { return m_cssTarget; } 659 Element* cssTarget() const { return m_cssTarget; }
660 660
661 void scheduleRenderTreeUpdateIfNeeded(); 661 void scheduleRenderTreeUpdateIfNeeded();
662 bool hasPendingForcedStyleRecalc() const; 662 bool hasPendingForcedStyleRecalc() const;
663 663
664 void registerNodeList(LiveNodeListBase*); 664 void registerNodeList(const LiveNodeListBase*);
665 void unregisterNodeList(LiveNodeListBase*); 665 void unregisterNodeList(const LiveNodeListBase*);
666 void incrementNodeListWithIdNameCacheCount(); 666 void registerNodeListWithIdNameCache(const LiveNodeListBase*);
667 void decrementNodeListWithIdNameCacheCount(); 667 void unregisterNodeListWithIdNameCache(const LiveNodeListBase*);
668 bool shouldInvalidateNodeListCaches(const QualifiedName* attrName = 0) const ; 668 bool shouldInvalidateNodeListCaches(const QualifiedName* attrName = 0) const ;
669 void invalidateNodeListCaches(const QualifiedName* attrName); 669 void invalidateNodeListCaches(const QualifiedName* attrName);
670 670
671 void attachNodeIterator(NodeIterator*); 671 void attachNodeIterator(NodeIterator*);
672 void detachNodeIterator(NodeIterator*); 672 void detachNodeIterator(NodeIterator*);
673 void moveNodeIteratorsToNewDocument(Node&, Document&); 673 void moveNodeIteratorsToNewDocument(Node&, Document&);
674 674
675 void attachRange(Range*); 675 void attachRange(Range*);
676 void detachRange(Range*); 676 void detachRange(Range*);
677 677
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
1145 void internalAddMessage(MessageSource, MessageLevel, const String& message, const String& sourceURL, unsigned lineNumber, PassRefPtr<ScriptCallStack>, Scrip tState*); 1145 void internalAddMessage(MessageSource, MessageLevel, const String& message, const String& sourceURL, unsigned lineNumber, PassRefPtr<ScriptCallStack>, Scrip tState*);
1146 1146
1147 virtual double timerAlignmentInterval() const OVERRIDE FINAL; 1147 virtual double timerAlignmentInterval() const OVERRIDE FINAL;
1148 1148
1149 void updateTitle(const String&); 1149 void updateTitle(const String&);
1150 void updateFocusAppearanceTimerFired(Timer<Document>*); 1150 void updateFocusAppearanceTimerFired(Timer<Document>*);
1151 void updateBaseURL(); 1151 void updateBaseURL();
1152 1152
1153 void executeScriptsWaitingForResourcesIfNeeded(); 1153 void executeScriptsWaitingForResourcesIfNeeded();
1154 1154
1155 PassRefPtr<NodeList> handleZeroPadding(const HitTestRequest&, HitTestResult& ) const; 1155 PassRefPtrWillBeRawPtr<NodeList> handleZeroPadding(const HitTestRequest&, Hi tTestResult&) const;
1156 1156
1157 void loadEventDelayTimerFired(Timer<Document>*); 1157 void loadEventDelayTimerFired(Timer<Document>*);
1158 void pluginLoadingTimerFired(Timer<Document>*); 1158 void pluginLoadingTimerFired(Timer<Document>*);
1159 1159
1160 PageVisibilityState pageVisibilityState() const; 1160 PageVisibilityState pageVisibilityState() const;
1161 1161
1162 PassRefPtr<HTMLCollection> ensureCachedCollection(CollectionType); 1162 PassRefPtrWillBeRawPtr<HTMLCollection> ensureCachedCollection(CollectionType );
1163 1163
1164 // Note that dispatching a window load event may cause the DOMWindow to be d etached from 1164 // Note that dispatching a window load event may cause the DOMWindow to be d etached from
1165 // the LocalFrame, so callers should take a reference to the DOMWindow (whic h owns us) to 1165 // the LocalFrame, so callers should take a reference to the DOMWindow (whic h owns us) to
1166 // prevent the Document from getting blown away from underneath them. 1166 // prevent the Document from getting blown away from underneath them.
1167 void dispatchWindowLoadEvent(); 1167 void dispatchWindowLoadEvent();
1168 1168
1169 void addListenerType(ListenerType listenerType) { m_listenerTypes |= listene rType; } 1169 void addListenerType(ListenerType listenerType) { m_listenerTypes |= listene rType; }
1170 void addMutationEventListenerTypeIfEnabled(ListenerType); 1170 void addMutationEventListenerTypeIfEnabled(ListenerType);
1171 1171
1172 void didAssociateFormControlsTimerFired(Timer<Document>*); 1172 void didAssociateFormControlsTimerFired(Timer<Document>*);
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
1297 String m_xmlVersion; 1297 String m_xmlVersion;
1298 unsigned m_xmlStandalone : 2; 1298 unsigned m_xmlStandalone : 2;
1299 unsigned m_hasXMLDeclaration : 1; 1299 unsigned m_hasXMLDeclaration : 1;
1300 1300
1301 AtomicString m_contentLanguage; 1301 AtomicString m_contentLanguage;
1302 1302
1303 DocumentEncodingData m_encodingData; 1303 DocumentEncodingData m_encodingData;
1304 1304
1305 InheritedBool m_designMode; 1305 InheritedBool m_designMode;
1306 1306
1307 HashSet<LiveNodeListBase*> m_listsInvalidatedAtDocument; 1307 WillBeHeapHashSet<RawPtrWillBeWeakMember<const LiveNodeListBase> > m_listsIn validatedAtDocument;
1308 #if ENABLE(OILPAN)
1309 // Oilpan keeps track of all registered NodeLists.
1310 //
1311 // FIXME: Oilpan: improve - only need to know if a NodeList
1312 // is currently alive or not for the different types.
1313 HeapHashSet<WeakMember<const LiveNodeListBase> > m_nodeLists[numNodeListInva lidationTypes];
1314 #else
1308 unsigned m_nodeListCounts[numNodeListInvalidationTypes]; 1315 unsigned m_nodeListCounts[numNodeListInvalidationTypes];
1316 #endif
1309 1317
1310 OwnPtrWillBeMember<SVGDocumentExtensions> m_svgExtensions; 1318 OwnPtrWillBeMember<SVGDocumentExtensions> m_svgExtensions;
1311 1319
1312 Vector<AnnotatedRegionValue> m_annotatedRegions; 1320 Vector<AnnotatedRegionValue> m_annotatedRegions;
1313 bool m_hasAnnotatedRegions; 1321 bool m_hasAnnotatedRegions;
1314 bool m_annotatedRegionsDirty; 1322 bool m_annotatedRegionsDirty;
1315 1323
1316 WillBeHeapHashMap<String, RefPtrWillBeMember<HTMLCanvasElement> > m_cssCanva sElements; 1324 WillBeHeapHashMap<String, RefPtrWillBeMember<HTMLCanvasElement> > m_cssCanva sElements;
1317 1325
1318 OwnPtr<SelectorQueryCache> m_selectorQueryCache; 1326 OwnPtr<SelectorQueryCache> m_selectorQueryCache;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
1407 } 1415 }
1408 1416
1409 inline bool Document::shouldOverrideLegacyDescription(ViewportDescription::Type origin) 1417 inline bool Document::shouldOverrideLegacyDescription(ViewportDescription::Type origin)
1410 { 1418 {
1411 // The different (legacy) meta tags have different priorities based on the t ype 1419 // The different (legacy) meta tags have different priorities based on the t ype
1412 // regardless of which order they appear in the DOM. The priority is given b y the 1420 // regardless of which order they appear in the DOM. The priority is given b y the
1413 // ViewportDescription::Type enum. 1421 // ViewportDescription::Type enum.
1414 return origin >= m_legacyViewportDescription.type; 1422 return origin >= m_legacyViewportDescription.type;
1415 } 1423 }
1416 1424
1417 inline void Document::incrementNodeListWithIdNameCacheCount()
1418 {
1419 m_nodeListCounts[InvalidateOnIdNameAttrChange]++;
1420 }
1421
1422 inline void Document::decrementNodeListWithIdNameCacheCount()
1423 {
1424 ASSERT(m_nodeListCounts[InvalidateOnIdNameAttrChange] > 0);
1425 m_nodeListCounts[InvalidateOnIdNameAttrChange]--;
1426 }
1427
1428 inline void Document::scheduleRenderTreeUpdateIfNeeded() 1425 inline void Document::scheduleRenderTreeUpdateIfNeeded()
1429 { 1426 {
1430 // Inline early out to avoid the function calls below. 1427 // Inline early out to avoid the function calls below.
1431 if (hasPendingStyleRecalc()) 1428 if (hasPendingStyleRecalc())
1432 return; 1429 return;
1433 if (shouldScheduleRenderTreeUpdate() && needsRenderTreeUpdate()) 1430 if (shouldScheduleRenderTreeUpdate() && needsRenderTreeUpdate())
1434 scheduleRenderTreeUpdate(); 1431 scheduleRenderTreeUpdate();
1435 } 1432 }
1436 1433
1437 DEFINE_TYPE_CASTS(Document, ExecutionContextClient, client, client->isDocument() , client.isDocument()); 1434 DEFINE_TYPE_CASTS(Document, ExecutionContextClient, client, client->isDocument() , client.isDocument());
(...skipping 16 matching lines...) Expand all
1454 inline bool Node::isDocumentNode() const 1451 inline bool Node::isDocumentNode() const
1455 { 1452 {
1456 return this == document(); 1453 return this == document();
1457 } 1454 }
1458 1455
1459 Node* eventTargetNodeForDocument(Document*); 1456 Node* eventTargetNodeForDocument(Document*);
1460 1457
1461 } // namespace WebCore 1458 } // namespace WebCore
1462 1459
1463 #endif // Document_h 1460 #endif // Document_h
OLDNEW
« no previous file with comments | « Source/core/dom/ContainerNode.cpp ('k') | Source/core/dom/Document.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698