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

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

Issue 2657443005: Migrate WTF::HashSet::add() to ::insert() [part 1 of N] (Closed)
Patch Set: Created 3 years, 10 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 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 AXID AXObjectCacheImpl::getAXID(AXObject* obj) { 535 AXID AXObjectCacheImpl::getAXID(AXObject* obj) {
536 // check for already-assigned ID 536 // check for already-assigned ID
537 AXID objID = obj->axObjectID(); 537 AXID objID = obj->axObjectID();
538 if (objID) { 538 if (objID) {
539 ASSERT(m_idsInUse.contains(objID)); 539 ASSERT(m_idsInUse.contains(objID));
540 return objID; 540 return objID;
541 } 541 }
542 542
543 objID = platformGenerateAXID(); 543 objID = platformGenerateAXID();
544 544
545 m_idsInUse.add(objID); 545 m_idsInUse.insert(objID);
546 obj->setAXObjectID(objID); 546 obj->setAXObjectID(objID);
547 547
548 return objID; 548 return objID;
549 } 549 }
550 550
551 void AXObjectCacheImpl::removeAXID(AXObject* object) { 551 void AXObjectCacheImpl::removeAXID(AXObject* object) {
552 if (!object) 552 if (!object)
553 return; 553 return;
554 554
555 AXID objID = object->axObjectID(); 555 AXID objID = object->axObjectID();
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 HeapVector<Member<AXObject>>& ownedChildren) { 705 HeapVector<Member<AXObject>>& ownedChildren) {
706 // 706 //
707 // Update the map from the AXID of this element to the ids of the owned 707 // Update the map from the AXID of this element to the ids of the owned
708 // children, and the reverse map from ids to possible AXID owners. 708 // children, and the reverse map from ids to possible AXID owners.
709 // 709 //
710 710
711 HashSet<String> currentIds = m_ariaOwnerToIdsMapping.get(owner->axObjectID()); 711 HashSet<String> currentIds = m_ariaOwnerToIdsMapping.get(owner->axObjectID());
712 HashSet<String> newIds; 712 HashSet<String> newIds;
713 bool idsChanged = false; 713 bool idsChanged = false;
714 for (const String& id : idVector) { 714 for (const String& id : idVector) {
715 newIds.add(id); 715 newIds.insert(id);
716 if (!currentIds.contains(id)) { 716 if (!currentIds.contains(id)) {
717 idsChanged = true; 717 idsChanged = true;
718 HashSet<AXID>* owners = m_idToAriaOwnersMapping.get(id); 718 HashSet<AXID>* owners = m_idToAriaOwnersMapping.get(id);
719 if (!owners) { 719 if (!owners) {
720 owners = new HashSet<AXID>(); 720 owners = new HashSet<AXID>();
721 m_idToAriaOwnersMapping.set(id, WTF::wrapUnique(owners)); 721 m_idToAriaOwnersMapping.set(id, WTF::wrapUnique(owners));
722 } 722 }
723 owners->add(owner->axObjectID()); 723 owners->insert(owner->axObjectID());
724 } 724 }
725 } 725 }
726 for (const String& id : currentIds) { 726 for (const String& id : currentIds) {
727 if (!newIds.contains(id)) { 727 if (!newIds.contains(id)) {
728 idsChanged = true; 728 idsChanged = true;
729 HashSet<AXID>* owners = m_idToAriaOwnersMapping.get(id); 729 HashSet<AXID>* owners = m_idToAriaOwnersMapping.get(id);
730 if (owners) { 730 if (owners) {
731 owners->remove(owner->axObjectID()); 731 owners->remove(owner->axObjectID());
732 if (owners->isEmpty()) 732 if (owners->isEmpty())
733 m_idToAriaOwnersMapping.remove(id); 733 m_idToAriaOwnersMapping.remove(id);
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
1252 visitor->trace(m_document); 1252 visitor->trace(m_document);
1253 visitor->trace(m_nodeObjectMapping); 1253 visitor->trace(m_nodeObjectMapping);
1254 1254
1255 visitor->trace(m_objects); 1255 visitor->trace(m_objects);
1256 visitor->trace(m_notificationsToPost); 1256 visitor->trace(m_notificationsToPost);
1257 1257
1258 AXObjectCache::trace(visitor); 1258 AXObjectCache::trace(visitor);
1259 } 1259 }
1260 1260
1261 } // namespace blink 1261 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698