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

Side by Side Diff: Source/modules/accessibility/AXObjectCacheImpl.cpp

Issue 1081673003: Oilpan: Prepare to move AXObjectCache to the heap (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 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) 2014, Google Inc. All rights reserved. 2 * Copyright (C) 2014, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 #include "modules/accessibility/AXTableColumn.h" 78 #include "modules/accessibility/AXTableColumn.h"
79 #include "modules/accessibility/AXTableHeaderContainer.h" 79 #include "modules/accessibility/AXTableHeaderContainer.h"
80 #include "modules/accessibility/AXTableRow.h" 80 #include "modules/accessibility/AXTableRow.h"
81 #include "wtf/PassRefPtr.h" 81 #include "wtf/PassRefPtr.h"
82 82
83 namespace blink { 83 namespace blink {
84 84
85 using namespace HTMLNames; 85 using namespace HTMLNames;
86 86
87 // static 87 // static
88 PassOwnPtr<AXObjectCache> AXObjectCacheImpl::create(Document& document) 88 PassOwnPtrWillBeRawPtr<AXObjectCache> AXObjectCacheImpl::create(Document& docume nt)
89 { 89 {
90 return adoptPtr(new AXObjectCacheImpl(document)); 90 return adoptPtrWillBeNoop(new AXObjectCacheImpl(document));
91 } 91 }
92 92
93 AXObjectCacheImpl::AXObjectCacheImpl(Document& document) 93 AXObjectCacheImpl::AXObjectCacheImpl(Document& document)
94 : m_document(document) 94 : m_document(document)
95 , m_modificationCount(0) 95 , m_modificationCount(0)
96 #if ENABLE(ASSERT)
97 , m_hasBeenDisposed(false)
98 #endif
96 , m_notificationPostTimer(this, &AXObjectCacheImpl::notificationPostTimerFir ed) 99 , m_notificationPostTimer(this, &AXObjectCacheImpl::notificationPostTimerFir ed)
97 { 100 {
98 } 101 }
99 102
100 AXObjectCacheImpl::~AXObjectCacheImpl() 103 AXObjectCacheImpl::~AXObjectCacheImpl()
101 { 104 {
105 ASSERT(m_hasBeenDisposed);
106 }
107
108 void AXObjectCacheImpl::dispose()
109 {
102 m_notificationPostTimer.stop(); 110 m_notificationPostTimer.stop();
103 111
104 HashMap<AXID, RefPtr<AXObject>>::iterator end = m_objects.end(); 112 HashMap<AXID, RefPtr<AXObject>>::iterator end = m_objects.end();
105 for (HashMap<AXID, RefPtr<AXObject>>::iterator it = m_objects.begin(); it != end; ++it) { 113 for (HashMap<AXID, RefPtr<AXObject>>::iterator it = m_objects.begin(); it != end; ++it) {
106 AXObject* obj = (*it).value.get(); 114 AXObject* obj = (*it).value.get();
107 obj->detach(); 115 obj->detach();
108 removeAXID(obj); 116 removeAXID(obj);
109 } 117 }
118
119 #if ENABLE(ASSERT)
120 m_hasBeenDisposed = true;
121 #endif
110 } 122 }
111 123
112 AXObject* AXObjectCacheImpl::root() 124 AXObject* AXObjectCacheImpl::root()
113 { 125 {
114 return getOrCreate(&m_document); 126 return getOrCreate(&m_document);
115 } 127 }
116 128
117 AXObject* AXObjectCacheImpl::focusedImageMapUIElement(HTMLAreaElement* areaEleme nt) 129 AXObject* AXObjectCacheImpl::focusedImageMapUIElement(HTMLAreaElement* areaEleme nt)
118 { 130 {
119 // Find the corresponding accessibility object for the HTMLAreaElement. This should be 131 // Find the corresponding accessibility object for the HTMLAreaElement. This should be
(...skipping 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after
1340 1352
1341 void AXObjectCacheImpl::setCanvasObjectBounds(Element* element, const LayoutRect & rect) 1353 void AXObjectCacheImpl::setCanvasObjectBounds(Element* element, const LayoutRect & rect)
1342 { 1354 {
1343 AXObject* obj = getOrCreate(element); 1355 AXObject* obj = getOrCreate(element);
1344 if (!obj) 1356 if (!obj)
1345 return; 1357 return;
1346 1358
1347 obj->setElementRect(rect); 1359 obj->setElementRect(rect);
1348 } 1360 }
1349 1361
1362 DEFINE_TRACE(AXObjectCacheImpl)
1363 {
1364 AXObjectCache::trace(visitor);
haraken 2015/05/29 09:16:19 Make this a tail call.
keishi 2015/06/08 06:27:52 Done.
1365 visitor->template registerWeakMembers<AXObjectCacheImpl, &AXObjectCacheImpl: :clearWeakMembers>(this);
1366 }
1367
1350 } // namespace blink 1368 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698