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

Side by Side Diff: WebKit/chromium/src/WebAccessibilityCacheImpl.cpp

Issue 3398006: Merge 67418 - 2010-09-13 Chris Guillory <chris.guillory@google.com>... (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/517/
Patch Set: Created 10 years, 3 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) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 56
57 WebAccessibilityCache* WebAccessibilityCache::create() 57 WebAccessibilityCache* WebAccessibilityCache::create()
58 { 58 {
59 return new WebAccessibilityCacheImpl(); 59 return new WebAccessibilityCacheImpl();
60 } 60 }
61 61
62 // WeakHandle ------------------------------------------------------------- 62 // WeakHandle -------------------------------------------------------------
63 63
64 PassRefPtr<WebAccessibilityCacheImpl::WeakHandle> WebAccessibilityCacheImpl::Wea kHandle::create(AccessibilityObject* object) 64 PassRefPtr<WebAccessibilityCacheImpl::WeakHandle> WebAccessibilityCacheImpl::Wea kHandle::create(AccessibilityObject* object)
65 { 65 {
66 // FIXME: Remove resetting ref-count from AccessibilityObjectWrapper
67 RefPtr<WebAccessibilityCacheImpl::WeakHandle> weakHandle = adoptRef(new WebA ccessibilityCacheImpl::WeakHandle(object)); 66 RefPtr<WebAccessibilityCacheImpl::WeakHandle> weakHandle = adoptRef(new WebA ccessibilityCacheImpl::WeakHandle(object));
68 weakHandle->m_object->setWrapper(weakHandle.get()); 67 weakHandle->m_object->setWrapper(weakHandle.get());
69 68
70 return weakHandle.release(); 69 return weakHandle.release();
71 } 70 }
72 71
73 WebAccessibilityCacheImpl::WeakHandle::WeakHandle(AccessibilityObject* object) 72 WebAccessibilityCacheImpl::WeakHandle::WeakHandle(AccessibilityObject* object)
74 : AccessibilityObjectWrapper(object) 73 : AccessibilityObjectWrapper(object)
75 { 74 {
76 } 75 }
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 } 141 }
143 142
144 void WebAccessibilityCacheImpl::clear() 143 void WebAccessibilityCacheImpl::clear()
145 { 144 {
146 m_objectMap.clear(); 145 m_objectMap.clear();
147 m_idMap.clear(); 146 m_idMap.clear();
148 } 147 }
149 148
150 int WebAccessibilityCacheImpl::addOrGetId(const WebAccessibilityObject& object) 149 int WebAccessibilityCacheImpl::addOrGetId(const WebAccessibilityObject& object)
151 { 150 {
152 if (object.isNull()) 151 if (!object.isValid())
153 return invalidObjectId; 152 return invalidObjectId;
154 153
155 RefPtr<AccessibilityObject> o = toAccessibilityObject(object); 154 RefPtr<AccessibilityObject> o = toAccessibilityObject(object);
156 155
157 IdMap::iterator it = m_idMap.find(o.get()); 156 IdMap::iterator it = m_idMap.find(o.get());
158 157
159 if (it != m_idMap.end()) 158 if (it != m_idMap.end())
160 return it->second; 159 return it->second;
161 160
162 // Insert new accessibility object in hashmaps and return its newly 161 // Insert new accessibility object in hashmaps and return its newly
163 // assigned accessibility object id. 162 // assigned accessibility object id.
164 m_objectMap.set(m_nextNewId, WeakHandle::create(o.get())); 163 m_objectMap.set(m_nextNewId, WeakHandle::create(o.get()));
165 m_idMap.set(o.get(), m_nextNewId); 164 m_idMap.set(o.get(), m_nextNewId);
166 165
167 return m_nextNewId++; 166 return m_nextNewId++;
168 } 167 }
169 168
170 } 169 }
OLDNEW
« no previous file with comments | « WebKit/chromium/public/WebAccessibilityObject.h ('k') | WebKit/chromium/src/WebAccessibilityObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698