Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009, 2010 Apple 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 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 531 AXID axID = m_renderObjectMapping.get(renderer); | 531 AXID axID = m_renderObjectMapping.get(renderer); |
| 532 remove(axID); | 532 remove(axID); |
| 533 m_renderObjectMapping.remove(renderer); | 533 m_renderObjectMapping.remove(renderer); |
| 534 } | 534 } |
| 535 | 535 |
| 536 void AXObjectCache::remove(Node* node) | 536 void AXObjectCache::remove(Node* node) |
| 537 { | 537 { |
| 538 if (!node) | 538 if (!node) |
| 539 return; | 539 return; |
| 540 | 540 |
| 541 removeNodeForUse(node); | 541 removeNodeForUse(node); |
|
Mads Ager (chromium)
2014/04/24 14:12:14
This is where it is cleared and it is called form
| |
| 542 | 542 |
| 543 // This is all safe even if we didn't have a mapping. | 543 // This is all safe even if we didn't have a mapping. |
| 544 AXID axID = m_nodeObjectMapping.get(node); | 544 AXID axID = m_nodeObjectMapping.get(node); |
| 545 remove(axID); | 545 remove(axID); |
| 546 m_nodeObjectMapping.remove(node); | 546 m_nodeObjectMapping.remove(node); |
| 547 | 547 |
| 548 if (node->renderer()) { | 548 if (node->renderer()) { |
| 549 remove(node->renderer()); | 549 remove(node->renderer()); |
| 550 return; | 550 return; |
| 551 } | 551 } |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 564 void AXObjectCache::remove(AbstractInlineTextBox* inlineTextBox) | 564 void AXObjectCache::remove(AbstractInlineTextBox* inlineTextBox) |
| 565 { | 565 { |
| 566 if (!inlineTextBox) | 566 if (!inlineTextBox) |
| 567 return; | 567 return; |
| 568 | 568 |
| 569 AXID axID = m_inlineTextBoxObjectMapping.get(inlineTextBox); | 569 AXID axID = m_inlineTextBoxObjectMapping.get(inlineTextBox); |
| 570 remove(axID); | 570 remove(axID); |
| 571 m_inlineTextBoxObjectMapping.remove(inlineTextBox); | 571 m_inlineTextBoxObjectMapping.remove(inlineTextBox); |
| 572 } | 572 } |
| 573 | 573 |
| 574 // FIXME: Oilpan: Use a weak hashmap for this instead. | |
| 575 void AXObjectCache::clearWeakMembers(Visitor* visitor) | |
| 576 { | |
| 577 Vector<Node*> deadNodes; | |
| 578 for (HashMap<Node*, AXID>::iterator it = m_nodeObjectMapping.begin(); it != m_nodeObjectMapping.end(); ++it) { | |
| 579 if (!visitor->isAlive(it->key)) | |
| 580 deadNodes.append(it->key); | |
| 581 } | |
| 582 for (unsigned i = 0; i < deadNodes.size(); ++i) | |
| 583 remove(deadNodes[i]); | |
| 584 } | |
| 585 | |
| 574 AXID AXObjectCache::platformGenerateAXID() const | 586 AXID AXObjectCache::platformGenerateAXID() const |
| 575 { | 587 { |
| 576 static AXID lastUsedID = 0; | 588 static AXID lastUsedID = 0; |
| 577 | 589 |
| 578 // Generate a new ID. | 590 // Generate a new ID. |
| 579 AXID objID = lastUsedID; | 591 AXID objID = lastUsedID; |
| 580 do { | 592 do { |
| 581 ++objID; | 593 ++objID; |
| 582 } while (!objID || HashTraits<AXID>::isDeletedValue(objID) || m_idsInUse.con tains(objID)); | 594 } while (!objID || HashTraits<AXID>::isDeletedValue(objID) || m_idsInUse.con tains(objID)); |
| 583 | 595 |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1000 { | 1012 { |
| 1001 postPlatformNotification(getOrCreate(scrollView), AXScrollPositionChanged); | 1013 postPlatformNotification(getOrCreate(scrollView), AXScrollPositionChanged); |
| 1002 } | 1014 } |
| 1003 | 1015 |
| 1004 void AXObjectCache::handleScrollPositionChanged(RenderObject* renderObject) | 1016 void AXObjectCache::handleScrollPositionChanged(RenderObject* renderObject) |
| 1005 { | 1017 { |
| 1006 postPlatformNotification(getOrCreate(renderObject), AXScrollPositionChanged) ; | 1018 postPlatformNotification(getOrCreate(renderObject), AXScrollPositionChanged) ; |
| 1007 } | 1019 } |
| 1008 | 1020 |
| 1009 } // namespace WebCore | 1021 } // namespace WebCore |
| OLD | NEW |