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

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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 1227 matching lines...) Expand 10 before | Expand all | Expand 10 after
1346 1358
1347 void AXObjectCacheImpl::setCanvasObjectBounds(Element* element, const LayoutRect & rect) 1359 void AXObjectCacheImpl::setCanvasObjectBounds(Element* element, const LayoutRect & rect)
1348 { 1360 {
1349 AXObject* obj = getOrCreate(element); 1361 AXObject* obj = getOrCreate(element);
1350 if (!obj) 1362 if (!obj)
1351 return; 1363 return;
1352 1364
1353 obj->setElementRect(rect); 1365 obj->setElementRect(rect);
1354 } 1366 }
1355 1367
1368 DEFINE_TRACE(AXObjectCacheImpl)
1369 {
1370 visitor->template registerWeakMembers<AXObjectCacheImpl, &AXObjectCacheImpl: :clearWeakMembers>(this);
1371 AXObjectCache::trace(visitor);
1372 }
1373
1356 } // namespace blink 1374 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698