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

Unified Diff: Source/modules/accessibility/AXObject.h

Issue 1072273006: Oilpan: Prepare moving AXObject to heap (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
Index: Source/modules/accessibility/AXObject.h
diff --git a/Source/modules/accessibility/AXObject.h b/Source/modules/accessibility/AXObject.h
index dfeb0dcd88d0203967f667463a5299ab58ed6454..7bc85b8e15b4bb7a44a9d07525a6c8230f7ea989 100644
--- a/Source/modules/accessibility/AXObject.h
+++ b/Source/modules/accessibility/AXObject.h
@@ -211,21 +211,36 @@ enum AccessibilityState {
AXVisitedState
};
-struct AccessibilityText {
- String text;
- AccessibilityTextSource textSource;
- RefPtr<AXObject> textElement;
-
- AccessibilityText(const String& t, const AccessibilityTextSource& s)
- : text(t)
- , textSource(s)
- { }
+class AccessibilityText : public NoBaseWillBeGarbageCollectedFinalized<AccessibilityText> {
+public:
+ static PassOwnPtrWillBeRawPtr<AccessibilityText> create(const String& t, const AccessibilityTextSource& s)
+ {
+ return adoptPtrWillBeNoop<AccessibilityText>(new AccessibilityText(t, s, nullptr));
+ }
+ static PassOwnPtrWillBeRawPtr<AccessibilityText> create(const String& t, const AccessibilityTextSource& s, const RefPtrWillBeRawPtr<AXObject> element)
+ {
+ return adoptPtrWillBeNoop<AccessibilityText>(new AccessibilityText(t, s, nullptr));
+ }
+
+ String text() { return m_text; }
+ AccessibilityTextSource textSource() { return m_textSource; }
+ AXObject* textElement() { return m_textElement.get(); }
+
+ DEFINE_INLINE_TRACE()
+ {
+ visitor->trace(m_textElement);
+ }
- AccessibilityText(const String& t, const AccessibilityTextSource& s, const RefPtr<AXObject> element)
- : text(t)
- , textSource(s)
- , textElement(element)
+private:
+ AccessibilityText(const String& t, const AccessibilityTextSource& s, const RefPtrWillBeRawPtr<AXObject> element)
+ : m_text(t)
+ , m_textSource(s)
+ , m_textElement(element)
{ }
+
+ String m_text;
+ AccessibilityTextSource m_textSource;
+ RefPtrWillBeMember<AXObject> m_textElement;
};
enum AccessibilityOrientation {
@@ -338,9 +353,9 @@ struct IgnoredReason {
{ }
};
-class MODULES_EXPORT AXObject : public RefCounted<AXObject> {
+class MODULES_EXPORT AXObject : public RefCountedWillBeGarbageCollectedFinalized<AXObject> {
public:
- typedef Vector<RefPtr<AXObject>> AccessibilityChildrenVector;
+ typedef WillBeHeapVector<RefPtrWillBeMember<AXObject>> AccessibilityChildrenVector;
struct PlainTextRange {
@@ -365,6 +380,7 @@ protected:
public:
virtual ~AXObject();
+ DECLARE_VIRTUAL_TRACE();
// After constructing an AXObject, it must be given a
// unique ID, then added to AXObjectCacheImpl, and finally init() must
@@ -515,13 +531,13 @@ public:
// Retrieves the accessible name of the object, an enum indicating where the name
// was derived from, and a list of objects that were used to derive the name, if any.
- virtual String name(AXNameFrom&, Vector<AXObject*>& nameObjects) { return String(); }
+ virtual String name(AXNameFrom&, WillBeHeapVector<RawPtrWillBeMember<AXObject>>& nameObjects) { return String(); }
// Takes the result of nameFrom from calling |name|, above, and retrieves the
// accessible description of the object, which is secondary to |name|, an enum indicating
// where the description was derived from, and a list of objects that were used to
// derive the description, if any.
- virtual String description(AXNameFrom, AXDescriptionFrom&, Vector<AXObject*>& descriptionObjects) { return String(); }
+ virtual String description(AXNameFrom, AXDescriptionFrom&, WillBeHeapVector<RawPtrWillBeMember<AXObject>>& descriptionObjects) { return String(); }
// Takes the result of nameFrom and descriptionFrom from calling |name| and |description|,
// above, and retrieves the placeholder of the object, if present and if it wasn't already
@@ -737,7 +753,7 @@ protected:
bool m_detached;
- mutable AXObject* m_parent;
+ mutable RawPtrWillBeMember<AXObject> m_parent;
// The following cached attribute values (the ones starting with m_cached*)
// are only valid if m_lastModificationCount matches AXObjectCacheImpl::modificationCount().
@@ -748,9 +764,9 @@ protected:
mutable bool m_cachedIsDescendantOfDisabledNode : 1;
mutable bool m_cachedHasInheritedPresentationalRole : 1;
mutable bool m_cachedIsPresentationalChild : 1;
- mutable const AXObject* m_cachedLiveRegionRoot;
+ mutable RawPtrWillBeMember<const AXObject> m_cachedLiveRegionRoot;
- AXObjectCacheImpl* m_axObjectCache;
+ RawPtrWillBeWeakMember<AXObjectCacheImpl> m_axObjectCache;
// Updates the cached attribute values. This may be recursive, so to prevent deadlocks,
// functions called here may only search up the tree (ancestors), not down.

Powered by Google App Engine
This is Rietveld 408576698