| OLD | NEW |
| 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 #include "modules/accessibility/AXTableColumn.h" | 77 #include "modules/accessibility/AXTableColumn.h" |
| 78 #include "modules/accessibility/AXTableHeaderContainer.h" | 78 #include "modules/accessibility/AXTableHeaderContainer.h" |
| 79 #include "modules/accessibility/AXTableRow.h" | 79 #include "modules/accessibility/AXTableRow.h" |
| 80 #include "wtf/PassRefPtr.h" | 80 #include "wtf/PassRefPtr.h" |
| 81 | 81 |
| 82 namespace blink { | 82 namespace blink { |
| 83 | 83 |
| 84 using namespace HTMLNames; | 84 using namespace HTMLNames; |
| 85 | 85 |
| 86 // static | 86 // static |
| 87 AXObjectCache* AXObjectCacheImpl::create(Document& document) | 87 PassOwnPtrWillBeRawPtr<AXObjectCache> AXObjectCacheImpl::create(Document& docume
nt) |
| 88 { | 88 { |
| 89 return new AXObjectCacheImpl(document); | 89 return adoptPtrWillBeNoop(new AXObjectCacheImpl(document)); |
| 90 } | 90 } |
| 91 | 91 |
| 92 AXObjectCacheImpl::AXObjectCacheImpl(Document& document) | 92 AXObjectCacheImpl::AXObjectCacheImpl(Document& document) |
| 93 : m_document(document) | 93 : m_document(document) |
| 94 , m_modificationCount(0) | 94 , m_modificationCount(0) |
| 95 #if ENABLE(ASSERT) |
| 96 , m_hasBeenDisposed(false) |
| 97 #endif |
| 95 , m_notificationPostTimer(this, &AXObjectCacheImpl::notificationPostTimerFir
ed) | 98 , m_notificationPostTimer(this, &AXObjectCacheImpl::notificationPostTimerFir
ed) |
| 96 { | 99 { |
| 97 } | 100 } |
| 98 | 101 |
| 99 AXObjectCacheImpl::~AXObjectCacheImpl() | 102 AXObjectCacheImpl::~AXObjectCacheImpl() |
| 100 { | 103 { |
| 104 ASSERT(m_hasBeenDisposed); |
| 105 } |
| 106 |
| 107 void AXObjectCacheImpl::dispose() |
| 108 { |
| 101 m_notificationPostTimer.stop(); | 109 m_notificationPostTimer.stop(); |
| 102 | 110 |
| 103 HashMap<AXID, RefPtr<AXObject>>::iterator end = m_objects.end(); | 111 HashMap<AXID, RefPtr<AXObject>>::iterator end = m_objects.end(); |
| 104 for (HashMap<AXID, RefPtr<AXObject>>::iterator it = m_objects.begin(); it !=
end; ++it) { | 112 for (HashMap<AXID, RefPtr<AXObject>>::iterator it = m_objects.begin(); it !=
end; ++it) { |
| 105 AXObject* obj = (*it).value.get(); | 113 AXObject* obj = (*it).value.get(); |
| 106 obj->detach(); | 114 obj->detach(); |
| 107 removeAXID(obj); | 115 removeAXID(obj); |
| 108 } | 116 } |
| 117 |
| 118 #if ENABLE(ASSERT) |
| 119 m_hasBeenDisposed = true; |
| 120 #endif |
| 109 } | 121 } |
| 110 | 122 |
| 111 AXObject* AXObjectCacheImpl::root() | 123 AXObject* AXObjectCacheImpl::root() |
| 112 { | 124 { |
| 113 return getOrCreate(&m_document); | 125 return getOrCreate(&m_document); |
| 114 } | 126 } |
| 115 | 127 |
| 116 AXObject* AXObjectCacheImpl::focusedImageMapUIElement(HTMLAreaElement* areaEleme
nt) | 128 AXObject* AXObjectCacheImpl::focusedImageMapUIElement(HTMLAreaElement* areaEleme
nt) |
| 117 { | 129 { |
| 118 // Find the corresponding accessibility object for the HTMLAreaElement. This
should be | 130 // Find the corresponding accessibility object for the HTMLAreaElement. This
should be |
| (...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1347 | 1359 |
| 1348 void AXObjectCacheImpl::setCanvasObjectBounds(Element* element, const LayoutRect
& rect) | 1360 void AXObjectCacheImpl::setCanvasObjectBounds(Element* element, const LayoutRect
& rect) |
| 1349 { | 1361 { |
| 1350 AXObject* obj = getOrCreate(element); | 1362 AXObject* obj = getOrCreate(element); |
| 1351 if (!obj) | 1363 if (!obj) |
| 1352 return; | 1364 return; |
| 1353 | 1365 |
| 1354 obj->setElementRect(rect); | 1366 obj->setElementRect(rect); |
| 1355 } | 1367 } |
| 1356 | 1368 |
| 1369 DEFINE_TRACE(AXObjectCacheImpl) |
| 1370 { |
| 1371 visitor->template registerWeakMembers<AXObjectCacheImpl, &AXObjectCacheImpl:
:clearWeakMembers>(this); |
| 1372 AXObjectCache::trace(visitor); |
| 1373 } |
| 1374 |
| 1357 } // namespace blink | 1375 } // namespace blink |
| OLD | NEW |