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

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: Rebase needed 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
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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(LiveNodeListBase*);
665 void unregisterNodeList(LiveNodeListBase*); 665 void unregisterNodeList(LiveNodeListBase*);
666 #if ENABLE(OILPAN)
667 void incrementNodeListWithIdNameCacheCount(const LiveNodeListBase*);
668 void decrementNodeListWithIdNameCacheCount(const LiveNodeListBase*);
669 #else
666 void incrementNodeListWithIdNameCacheCount(); 670 void incrementNodeListWithIdNameCacheCount();
667 void decrementNodeListWithIdNameCacheCount(); 671 void decrementNodeListWithIdNameCacheCount();
672 #endif
668 bool shouldInvalidateNodeListCaches(const QualifiedName* attrName = 0) const ; 673 bool shouldInvalidateNodeListCaches(const QualifiedName* attrName = 0) const ;
669 void invalidateNodeListCaches(const QualifiedName* attrName); 674 void invalidateNodeListCaches(const QualifiedName* attrName);
670 675
671 void attachNodeIterator(NodeIterator*); 676 void attachNodeIterator(NodeIterator*);
672 void detachNodeIterator(NodeIterator*); 677 void detachNodeIterator(NodeIterator*);
673 void moveNodeIteratorsToNewDocument(Node&, Document&); 678 void moveNodeIteratorsToNewDocument(Node&, Document&);
674 679
675 void attachRange(Range*); 680 void attachRange(Range*);
676 void detachRange(Range*); 681 void detachRange(Range*);
677 682
(...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*); 1150 void internalAddMessage(MessageSource, MessageLevel, const String& message, const String& sourceURL, unsigned lineNumber, PassRefPtr<ScriptCallStack>, Scrip tState*);
1146 1151
1147 virtual double timerAlignmentInterval() const OVERRIDE FINAL; 1152 virtual double timerAlignmentInterval() const OVERRIDE FINAL;
1148 1153
1149 void updateTitle(const String&); 1154 void updateTitle(const String&);
1150 void updateFocusAppearanceTimerFired(Timer<Document>*); 1155 void updateFocusAppearanceTimerFired(Timer<Document>*);
1151 void updateBaseURL(); 1156 void updateBaseURL();
1152 1157
1153 void executeScriptsWaitingForResourcesIfNeeded(); 1158 void executeScriptsWaitingForResourcesIfNeeded();
1154 1159
1155 PassRefPtr<NodeList> handleZeroPadding(const HitTestRequest&, HitTestResult& ) const; 1160 PassRefPtrWillBeRawPtr<NodeList> handleZeroPadding(const HitTestRequest&, Hi tTestResult&) const;
1156 1161
1157 void loadEventDelayTimerFired(Timer<Document>*); 1162 void loadEventDelayTimerFired(Timer<Document>*);
1158 void pluginLoadingTimerFired(Timer<Document>*); 1163 void pluginLoadingTimerFired(Timer<Document>*);
1159 1164
1160 PageVisibilityState pageVisibilityState() const; 1165 PageVisibilityState pageVisibilityState() const;
1161 1166
1162 PassRefPtr<HTMLCollection> ensureCachedCollection(CollectionType); 1167 PassRefPtrWillBeRawPtr<HTMLCollection> ensureCachedCollection(CollectionType );
1163 1168
1164 // Note that dispatching a window load event may cause the DOMWindow to be d etached from 1169 // 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 1170 // 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. 1171 // prevent the Document from getting blown away from underneath them.
1167 void dispatchWindowLoadEvent(); 1172 void dispatchWindowLoadEvent();
1168 1173
1169 void addListenerType(ListenerType listenerType) { m_listenerTypes |= listene rType; } 1174 void addListenerType(ListenerType listenerType) { m_listenerTypes |= listene rType; }
1170 void addMutationEventListenerTypeIfEnabled(ListenerType); 1175 void addMutationEventListenerTypeIfEnabled(ListenerType);
1171 1176
1172 void didAssociateFormControlsTimerFired(Timer<Document>*); 1177 void didAssociateFormControlsTimerFired(Timer<Document>*);
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
1297 String m_xmlVersion; 1302 String m_xmlVersion;
1298 unsigned m_xmlStandalone : 2; 1303 unsigned m_xmlStandalone : 2;
1299 unsigned m_hasXMLDeclaration : 1; 1304 unsigned m_hasXMLDeclaration : 1;
1300 1305
1301 AtomicString m_contentLanguage; 1306 AtomicString m_contentLanguage;
1302 1307
1303 DocumentEncodingData m_encodingData; 1308 DocumentEncodingData m_encodingData;
1304 1309
1305 InheritedBool m_designMode; 1310 InheritedBool m_designMode;
1306 1311
1307 HashSet<LiveNodeListBase*> m_listsInvalidatedAtDocument; 1312 WillBeHeapHashSet<RawPtrWillBeWeakMember<LiveNodeListBase> > m_listsInvalida tedAtDocument;
1313 #if ENABLE(OILPAN)
1314 // Oilpan keeps track of all registered NodeLists.
1315 //
1316 // FIXME: Oilpan: improve - only need to know if a NodeList is
1317 // is currently alive or not for the different types.
Mads Ager (chromium) 2014/05/15 10:54:24 is is -> is
sof 2014/05/15 22:15:57 Done.
1318 HeapHashSet<WeakMember<LiveNodeListBase> > m_nodeLists[numNodeListInvalidati onTypes];
1319 #else
1308 unsigned m_nodeListCounts[numNodeListInvalidationTypes]; 1320 unsigned m_nodeListCounts[numNodeListInvalidationTypes];
1321 #endif
1309 1322
1310 OwnPtrWillBeMember<SVGDocumentExtensions> m_svgExtensions; 1323 OwnPtrWillBeMember<SVGDocumentExtensions> m_svgExtensions;
1311 1324
1312 Vector<AnnotatedRegionValue> m_annotatedRegions; 1325 Vector<AnnotatedRegionValue> m_annotatedRegions;
1313 bool m_hasAnnotatedRegions; 1326 bool m_hasAnnotatedRegions;
1314 bool m_annotatedRegionsDirty; 1327 bool m_annotatedRegionsDirty;
1315 1328
1316 WillBeHeapHashMap<String, RefPtrWillBeMember<HTMLCanvasElement> > m_cssCanva sElements; 1329 WillBeHeapHashMap<String, RefPtrWillBeMember<HTMLCanvasElement> > m_cssCanva sElements;
1317 1330
1318 OwnPtr<SelectorQueryCache> m_selectorQueryCache; 1331 OwnPtr<SelectorQueryCache> m_selectorQueryCache;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
1407 } 1420 }
1408 1421
1409 inline bool Document::shouldOverrideLegacyDescription(ViewportDescription::Type origin) 1422 inline bool Document::shouldOverrideLegacyDescription(ViewportDescription::Type origin)
1410 { 1423 {
1411 // The different (legacy) meta tags have different priorities based on the t ype 1424 // 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 1425 // regardless of which order they appear in the DOM. The priority is given b y the
1413 // ViewportDescription::Type enum. 1426 // ViewportDescription::Type enum.
1414 return origin >= m_legacyViewportDescription.type; 1427 return origin >= m_legacyViewportDescription.type;
1415 } 1428 }
1416 1429
1430 #if !ENABLE(OILPAN)
1417 inline void Document::incrementNodeListWithIdNameCacheCount() 1431 inline void Document::incrementNodeListWithIdNameCacheCount()
1418 { 1432 {
1419 m_nodeListCounts[InvalidateOnIdNameAttrChange]++; 1433 m_nodeListCounts[InvalidateOnIdNameAttrChange]++;
1420 } 1434 }
1421 1435
1422 inline void Document::decrementNodeListWithIdNameCacheCount() 1436 inline void Document::decrementNodeListWithIdNameCacheCount()
1423 { 1437 {
1424 ASSERT(m_nodeListCounts[InvalidateOnIdNameAttrChange] > 0); 1438 ASSERT(m_nodeListCounts[InvalidateOnIdNameAttrChange] > 0);
1425 m_nodeListCounts[InvalidateOnIdNameAttrChange]--; 1439 m_nodeListCounts[InvalidateOnIdNameAttrChange]--;
1426 } 1440 }
1441 #endif
1427 1442
1428 inline void Document::scheduleRenderTreeUpdateIfNeeded() 1443 inline void Document::scheduleRenderTreeUpdateIfNeeded()
1429 { 1444 {
1430 // Inline early out to avoid the function calls below. 1445 // Inline early out to avoid the function calls below.
1431 if (hasPendingStyleRecalc()) 1446 if (hasPendingStyleRecalc())
1432 return; 1447 return;
1433 if (shouldScheduleRenderTreeUpdate() && needsRenderTreeUpdate()) 1448 if (shouldScheduleRenderTreeUpdate() && needsRenderTreeUpdate())
1434 scheduleRenderTreeUpdate(); 1449 scheduleRenderTreeUpdate();
1435 } 1450 }
1436 1451
(...skipping 17 matching lines...) Expand all
1454 inline bool Node::isDocumentNode() const 1469 inline bool Node::isDocumentNode() const
1455 { 1470 {
1456 return this == document(); 1471 return this == document();
1457 } 1472 }
1458 1473
1459 Node* eventTargetNodeForDocument(Document*); 1474 Node* eventTargetNodeForDocument(Document*);
1460 1475
1461 } // namespace WebCore 1476 } // namespace WebCore
1462 1477
1463 #endif // Document_h 1478 #endif // Document_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698