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

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

Issue 235113002: Oilpan: Remove guardRef and guardDeref from TreeScope. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Only perform weak processing of the event handler registry if the document is active. Created 6 years, 8 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 * 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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 PluginDocumentClass = 1 << 3, 208 PluginDocumentClass = 1 << 3,
209 MediaDocumentClass = 1 << 4, 209 MediaDocumentClass = 1 << 4,
210 SVGDocumentClass = 1 << 5, 210 SVGDocumentClass = 1 << 5,
211 XMLDocumentClass = 1 << 6, 211 XMLDocumentClass = 1 << 6,
212 }; 212 };
213 213
214 typedef unsigned char DocumentClassFlags; 214 typedef unsigned char DocumentClassFlags;
215 215
216 class Document; 216 class Document;
217 217
218 class DocumentVisibilityObserver { 218 class DocumentVisibilityObserver : public WillBeGarbageCollectedMixin {
219 public: 219 public:
220 DocumentVisibilityObserver(Document&); 220 DocumentVisibilityObserver(Document&);
221 virtual ~DocumentVisibilityObserver(); 221 virtual ~DocumentVisibilityObserver();
222 222
223 virtual void didChangeVisibilityState(PageVisibilityState) = 0; 223 virtual void didChangeVisibilityState(PageVisibilityState) = 0;
224 224
225 // Classes that inherit Node and DocumentVisibilityObserver must have a 225 // Classes that inherit Node and DocumentVisibilityObserver must have a
226 // virtual override of Node::didMoveToNewDocument that calls 226 // virtual override of Node::didMoveToNewDocument that calls
227 // DocumentVisibilityObserver::setDocument 227 // DocumentVisibilityObserver::setDocument
228 void setObservedDocument(Document&); 228 void setObservedDocument(Document&);
229 229
230 private: 230 private:
231 void registerObserver(Document&); 231 void registerObserver(Document&);
232 void unregisterObserver(); 232 void unregisterObserver();
233 Document* m_document; 233 Document* m_document;
haraken 2014/04/25 14:30:32 Just to confirm: This raw pointer looks safe becau
Mads Ager (chromium) 2014/04/28 09:45:21 Yes.
234 }; 234 };
235 235
236 class Document : public ContainerNode, public TreeScope, public SecurityContext, public ExecutionContext, public ExecutionContextClient 236 class Document : public ContainerNode, public TreeScope, public SecurityContext, public ExecutionContext, public ExecutionContextClient
237 , public DocumentSupplementable, public LifecycleContext<Document> { 237 , public DocumentSupplementable, public LifecycleContext<Document> {
238 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(Document); 238 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(Document);
239 public: 239 public:
240 static PassRefPtr<Document> create(const DocumentInit& initializer = Documen tInit()) 240 static PassRefPtr<Document> create(const DocumentInit& initializer = Documen tInit())
241 { 241 {
242 return adoptRef(new Document(initializer)); 242 return adoptRef(new Document(initializer));
243 } 243 }
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 852
853 Vector<IconURL> iconURLs(int iconTypesMask); 853 Vector<IconURL> iconURLs(int iconTypesMask);
854 854
855 void setUseSecureKeyboardEntryWhenActive(bool); 855 void setUseSecureKeyboardEntryWhenActive(bool);
856 bool useSecureKeyboardEntryWhenActive() const; 856 bool useSecureKeyboardEntryWhenActive() const;
857 857
858 void updateFocusAppearanceSoon(bool restorePreviousSelection); 858 void updateFocusAppearanceSoon(bool restorePreviousSelection);
859 void cancelFocusAppearanceUpdate(); 859 void cancelFocusAppearanceUpdate();
860 860
861 // Extension for manipulating canvas drawing contexts for use in CSS 861 // Extension for manipulating canvas drawing contexts for use in CSS
862 void getCSSCanvasContext(const String& type, const String& name, int width, int height, bool&, RefPtr<CanvasRenderingContext2D>&, bool&, RefPtr<WebGLRenderi ngContext>&); 862 void getCSSCanvasContext(const String& type, const String& name, int width, int height, bool&, RefPtrWillBeRawPtr<CanvasRenderingContext2D>&, bool&, RefPtrW illBeRawPtr<WebGLRenderingContext>&);
863 HTMLCanvasElement& getCSSCanvasElement(const String& name); 863 HTMLCanvasElement& getCSSCanvasElement(const String& name);
864 864
865 bool isDNSPrefetchEnabled() const { return m_isDNSPrefetchEnabled; } 865 bool isDNSPrefetchEnabled() const { return m_isDNSPrefetchEnabled; }
866 void parseDNSPrefetchControlHeader(const String&); 866 void parseDNSPrefetchControlHeader(const String&);
867 867
868 // FIXME(crbug.com/305497): This should be removed once DOMWindow is an Exec utionContext. 868 // FIXME(crbug.com/305497): This should be removed once DOMWindow is an Exec utionContext.
869 virtual void postTask(PassOwnPtr<ExecutionContextTask>) OVERRIDE; // Execute s the task on context's thread asynchronously. 869 virtual void postTask(PassOwnPtr<ExecutionContextTask>) OVERRIDE; // Execute s the task on context's thread asynchronously.
870 870
871 virtual void tasksWereSuspended() OVERRIDE FINAL; 871 virtual void tasksWereSuspended() OVERRIDE FINAL;
872 virtual void tasksWereResumed() OVERRIDE FINAL; 872 virtual void tasksWereResumed() OVERRIDE FINAL;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 934
935 bool hasFullscreenElementStack() const { return m_hasFullscreenElementStack; } 935 bool hasFullscreenElementStack() const { return m_hasFullscreenElementStack; }
936 void setHasFullscreenElementStack() { m_hasFullscreenElementStack = true; } 936 void setHasFullscreenElementStack() { m_hasFullscreenElementStack = true; }
937 937
938 void webkitExitPointerLock(); 938 void webkitExitPointerLock();
939 Element* webkitPointerLockElement() const; 939 Element* webkitPointerLockElement() const;
940 940
941 // Used to allow element that loads data without going through a FrameLoader to delay the 'load' event. 941 // Used to allow element that loads data without going through a FrameLoader to delay the 'load' event.
942 void incrementLoadEventDelayCount() { ++m_loadEventDelayCount; } 942 void incrementLoadEventDelayCount() { ++m_loadEventDelayCount; }
943 void decrementLoadEventDelayCount(); 943 void decrementLoadEventDelayCount();
944 bool isDelayingLoadEvent() const { return m_loadEventDelayCount; } 944 void checkLoadEventSoon();
945 bool isDelayingLoadEvent();
945 void loadPluginsSoon(); 946 void loadPluginsSoon();
946 947
947 PassRefPtrWillBeRawPtr<Touch> createTouch(DOMWindow*, EventTarget*, int iden tifier, int pageX, int pageY, int screenX, int screenY, int radiusX, int radiusY , float rotationAngle, float force) const; 948 PassRefPtrWillBeRawPtr<Touch> createTouch(DOMWindow*, EventTarget*, int iden tifier, int pageX, int pageY, int screenX, int screenY, int radiusX, int radiusY , float rotationAngle, float force) const;
948 PassRefPtrWillBeRawPtr<TouchList> createTouchList(WillBeHeapVector<RefPtrWil lBeMember<Touch> >&) const; 949 PassRefPtrWillBeRawPtr<TouchList> createTouchList(WillBeHeapVector<RefPtrWil lBeMember<Touch> >&) const;
949 950
950 const DocumentTiming& timing() const { return m_documentTiming; } 951 const DocumentTiming& timing() const { return m_documentTiming; }
951 952
952 int requestAnimationFrame(PassOwnPtr<RequestAnimationFrameCallback>); 953 int requestAnimationFrame(PassOwnPtr<RequestAnimationFrameCallback>);
953 void cancelAnimationFrame(int id); 954 void cancelAnimationFrame(int id);
954 void serviceScriptedAnimations(double monotonicAnimationStartTime); 955 void serviceScriptedAnimations(double monotonicAnimationStartTime);
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
1103 bool dirtyElementsForLayerUpdate(); 1104 bool dirtyElementsForLayerUpdate();
1104 void updateDistributionIfNeeded(); 1105 void updateDistributionIfNeeded();
1105 void updateUseShadowTreesIfNeeded(); 1106 void updateUseShadowTreesIfNeeded();
1106 void evaluateMediaQueryListIfNeeded(); 1107 void evaluateMediaQueryListIfNeeded();
1107 1108
1108 void updateRenderTree(StyleRecalcChange); 1109 void updateRenderTree(StyleRecalcChange);
1109 void updateStyle(StyleRecalcChange); 1110 void updateStyle(StyleRecalcChange);
1110 1111
1111 void detachParser(); 1112 void detachParser();
1112 1113
1114 void clearWeakMembers(Visitor*);
1115
1113 virtual bool isDocument() const OVERRIDE FINAL { return true; } 1116 virtual bool isDocument() const OVERRIDE FINAL { return true; }
1114 1117
1115 virtual void childrenChanged(bool changedByParser = false, Node* beforeChang e = 0, Node* afterChange = 0, int childCountDelta = 0) OVERRIDE; 1118 virtual void childrenChanged(bool changedByParser = false, Node* beforeChang e = 0, Node* afterChange = 0, int childCountDelta = 0) OVERRIDE;
1116 1119
1117 virtual String nodeName() const OVERRIDE FINAL; 1120 virtual String nodeName() const OVERRIDE FINAL;
1118 virtual NodeType nodeType() const OVERRIDE FINAL; 1121 virtual NodeType nodeType() const OVERRIDE FINAL;
1119 virtual bool childTypeAllowed(NodeType) const OVERRIDE FINAL; 1122 virtual bool childTypeAllowed(NodeType) const OVERRIDE FINAL;
1120 virtual PassRefPtr<Node> cloneNode(bool deep = true) OVERRIDE FINAL; 1123 virtual PassRefPtr<Node> cloneNode(bool deep = true) OVERRIDE FINAL;
1121 void cloneDataFromDocument(const Document&); 1124 void cloneDataFromDocument(const Document&);
1122 1125
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1228 static uint64_t s_globalTreeVersion; 1231 static uint64_t s_globalTreeVersion;
1229 1232
1230 HashSet<NodeIterator*> m_nodeIterators; 1233 HashSet<NodeIterator*> m_nodeIterators;
1231 HashSet<Range*> m_ranges; 1234 HashSet<Range*> m_ranges;
1232 1235
1233 unsigned short m_listenerTypes; 1236 unsigned short m_listenerTypes;
1234 1237
1235 MutationObserverOptions m_mutationObserverTypes; 1238 MutationObserverOptions m_mutationObserverTypes;
1236 1239
1237 OwnPtrWillBePersistent<StyleEngine> m_styleEngine; 1240 OwnPtrWillBePersistent<StyleEngine> m_styleEngine;
1238 RefPtrWillBePersistent<StyleSheetList> m_styleSheetList; 1241 RefPtrWillBeMember<StyleSheetList> m_styleSheetList;
1239 1242
1240 OwnPtr<FormController> m_formController; 1243 OwnPtr<FormController> m_formController;
1241 1244
1242 TextLinkColors m_textLinkColors; 1245 TextLinkColors m_textLinkColors;
1243 const OwnPtr<VisitedLinkState> m_visitedLinkState; 1246 const OwnPtr<VisitedLinkState> m_visitedLinkState;
1244 1247
1245 bool m_visuallyOrdered; 1248 bool m_visuallyOrdered;
1246 ReadyState m_readyState; 1249 ReadyState m_readyState;
1247 bool m_isParsing; 1250 bool m_isParsing;
1248 1251
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
1369 Document* m_templateDocumentHost; // Manually managed weakref (backpointer f rom m_templateDocument). 1372 Document* m_templateDocumentHost; // Manually managed weakref (backpointer f rom m_templateDocument).
1370 1373
1371 Timer<Document> m_didAssociateFormControlsTimer; 1374 Timer<Document> m_didAssociateFormControlsTimer;
1372 HashSet<RefPtr<Element> > m_associatedFormControls; 1375 HashSet<RefPtr<Element> > m_associatedFormControls;
1373 1376
1374 HashSet<SVGUseElement*> m_useElementsNeedingUpdate; 1377 HashSet<SVGUseElement*> m_useElementsNeedingUpdate;
1375 HashSet<Element*> m_layerUpdateElements; 1378 HashSet<Element*> m_layerUpdateElements;
1376 1379
1377 bool m_hasViewportUnits; 1380 bool m_hasViewportUnits;
1378 1381
1379 HashSet<DocumentVisibilityObserver*> m_visibilityObservers; 1382 typedef WillBeHeapHashSet<RawPtrWillBeWeakMember<DocumentVisibilityObserver> > DocumentVisibilityObserverSet;
1383 DocumentVisibilityObserverSet m_visibilityObservers;
1380 }; 1384 };
1381 1385
1382 inline void Document::notifyRemovePendingSheetIfNeeded() 1386 inline void Document::notifyRemovePendingSheetIfNeeded()
1383 { 1387 {
1384 if (m_needsNotifyRemoveAllPendingStylesheet) 1388 if (m_needsNotifyRemoveAllPendingStylesheet)
1385 didRemoveAllPendingStylesheet(); 1389 didRemoveAllPendingStylesheet();
1386 } 1390 }
1387 1391
1388 inline bool Document::shouldOverrideLegacyDescription(ViewportDescription::Type origin) 1392 inline bool Document::shouldOverrideLegacyDescription(ViewportDescription::Type origin)
1389 { 1393 {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1433 inline bool Node::isDocumentNode() const 1437 inline bool Node::isDocumentNode() const
1434 { 1438 {
1435 return this == document(); 1439 return this == document();
1436 } 1440 }
1437 1441
1438 Node* eventTargetNodeForDocument(Document*); 1442 Node* eventTargetNodeForDocument(Document*);
1439 1443
1440 } // namespace WebCore 1444 } // namespace WebCore
1441 1445
1442 #endif // Document_h 1446 #endif // Document_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698