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

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, 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 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 d3182fd4f02bdb7b9aee7bfb125e619efc32f8d8..ee1b8855608defc5f2a01325a84a0125e172fe40 100644
--- a/Source/modules/accessibility/AXObject.h
+++ b/Source/modules/accessibility/AXObject.h
@@ -213,21 +213,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> {
haraken 2015/05/28 10:48:40 Add final.
keishi 2015/06/08 06:27:20 Done.
+public:
+ static PassOwnPtrWillBeRawPtr<AccessibilityText> create(const String& t, const AccessibilityTextSource& s)
haraken 2015/05/28 10:48:40 t => text s => source
keishi 2015/06/08 06:27:20 Done.
+ {
+ return adoptPtrWillBeNoop<AccessibilityText>(new AccessibilityText(t, s, nullptr));
haraken 2015/05/28 10:48:41 adoptPtrWillBeNoop<AccessibilityText> => adoptPtrW
keishi 2015/06/08 06:27:21 Done.
+ }
+ static PassOwnPtrWillBeRawPtr<AccessibilityText> create(const String& t, const AccessibilityTextSource& s, const RefPtrWillBeRawPtr<AXObject> element)
+ {
+ return adoptPtrWillBeNoop<AccessibilityText>(new AccessibilityText(t, s, nullptr));
haraken 2015/05/28 10:48:40 Ditto.
keishi 2015/06/08 06:27:20 Done.
+ }
+
+ String text() { return m_text; }
haraken 2015/05/28 10:48:41 Add const.
keishi 2015/06/08 06:27:20 Done.
+ AccessibilityTextSource textSource() { return m_textSource; }
haraken 2015/05/28 10:48:41 Ditto.
keishi 2015/06/08 06:27:20 Done.
+ AXObject* textElement() { return m_textElement.get(); }
haraken 2015/05/28 10:48:41 Ditto.
keishi 2015/06/08 06:27:20 Done.
+
+ 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)
haraken 2015/05/28 10:48:40 This looks strange... RefPtr => PassRefPtr ?
keishi 2015/06/08 06:27:20 Done.
+ : m_text(t)
+ , m_textSource(s)
+ , m_textElement(element)
{ }
+
+ String m_text;
+ AccessibilityTextSource m_textSource;
+ RefPtrWillBeMember<AXObject> m_textElement;
};
enum AccessibilityOrientation {
@@ -350,9 +365,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 {
@@ -377,6 +392,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
@@ -527,13 +543,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);
+ virtual String name(AXNameFrom&, WillBeHeapVector<RawPtrWillBeMember<AXObject>>& nameObjects);
// 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
@@ -541,7 +557,7 @@ public:
virtual String placeholder(AXNameFrom, AXDescriptionFrom) { return String(); }
// Internal function used by name and description, above.
- virtual String textAlternative(bool recursive, bool inAriaLabelledByTraversal, HashSet<AXObject*>& visited, AXNameFrom*, Vector<AXObject*>* nameObjects) { return String(); }
+ virtual String textAlternative(bool recursive, bool inAriaLabelledByTraversal, WillBeHeapHashSet<RawPtrWillBeMember<AXObject>>& visited, AXNameFrom*, WillBeHeapVector<RawPtrWillBeMember<AXObject>>* nameObjects) { return String(); }
// Returns result of Accessible Name Calculation algorithm.
// This is a simpler high-level interface to |name| used by Inspector.
@@ -771,7 +787,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().
@@ -782,9 +798,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;
haraken 2015/05/28 10:48:41 I think this should be a Member. AXObjectCache own
keishi 2015/06/08 06:27:20 Done.
// 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