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

Side by Side Diff: Source/core/accessibility/AXObjectCache.cpp

Issue 603193005: Move the Widget hierarchy to the Oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased upto r183571 Created 6 years, 2 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) 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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 333
334 AXObject* AXObjectCache::getOrCreate(Widget* widget) 334 AXObject* AXObjectCache::getOrCreate(Widget* widget)
335 { 335 {
336 if (!widget) 336 if (!widget)
337 return 0; 337 return 0;
338 338
339 if (AXObject* obj = get(widget)) 339 if (AXObject* obj = get(widget))
340 return obj; 340 return obj;
341 341
342 RefPtr<AXObject> newObj = nullptr; 342 RefPtr<AXObject> newObj = nullptr;
343 // FIXME: test for isScrollView() instead?
343 if (widget->isFrameView()) 344 if (widget->isFrameView())
344 newObj = AXScrollView::create(toFrameView(widget)); 345 newObj = AXScrollView::create(toFrameView(widget));
345 else if (widget->isScrollbar()) 346 else if (widget->isScrollbar())
346 newObj = AXScrollbar::create(toScrollbar(widget)); 347 newObj = AXScrollbar::create(toScrollbar(widget));
347 348
348 // Will crash later if we have two objects for the same widget. 349 // Will crash later if we have two objects for the same widget.
349 ASSERT(!get(widget)); 350 ASSERT(!get(widget));
350 351
351 // Catch the case if an (unsupported) widget type is used. Only FrameView an d ScrollBar are supported now. 352 // Catch the case if an (unsupported) widget type is used. Only FrameView an d ScrollBar are supported now.
352 ASSERT(newObj); 353 ASSERT(newObj);
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 // FIXME: Oilpan: Use a weak hashmap for this instead. 573 // FIXME: Oilpan: Use a weak hashmap for this instead.
573 void AXObjectCache::clearWeakMembers(Visitor* visitor) 574 void AXObjectCache::clearWeakMembers(Visitor* visitor)
574 { 575 {
575 Vector<Node*> deadNodes; 576 Vector<Node*> deadNodes;
576 for (HashMap<Node*, AXID>::iterator it = m_nodeObjectMapping.begin(); it != m_nodeObjectMapping.end(); ++it) { 577 for (HashMap<Node*, AXID>::iterator it = m_nodeObjectMapping.begin(); it != m_nodeObjectMapping.end(); ++it) {
577 if (!visitor->isAlive(it->key)) 578 if (!visitor->isAlive(it->key))
578 deadNodes.append(it->key); 579 deadNodes.append(it->key);
579 } 580 }
580 for (unsigned i = 0; i < deadNodes.size(); ++i) 581 for (unsigned i = 0; i < deadNodes.size(); ++i)
581 remove(deadNodes[i]); 582 remove(deadNodes[i]);
583
584 Vector<Widget*> deadWidgets;
585 for (HashMap<Widget*, AXID>::iterator it = m_widgetObjectMapping.begin(); it != m_widgetObjectMapping.end(); ++it) {
586 if (!visitor->isAlive(it->key))
587 deadWidgets.append(it->key);
588 }
589 for (unsigned i = 0; i < deadWidgets.size(); ++i)
590 remove(deadWidgets[i]);
582 } 591 }
583 592
584 AXID AXObjectCache::platformGenerateAXID() const 593 AXID AXObjectCache::platformGenerateAXID() const
585 { 594 {
586 static AXID lastUsedID = 0; 595 static AXID lastUsedID = 0;
587 596
588 // Generate a new ID. 597 // Generate a new ID.
589 AXID objID = lastUsedID; 598 AXID objID = lastUsedID;
590 do { 599 do {
591 ++objID; 600 ++objID;
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
1040 void AXObjectCache::setCanvasObjectBounds(Element* element, const LayoutRect& re ct) 1049 void AXObjectCache::setCanvasObjectBounds(Element* element, const LayoutRect& re ct)
1041 { 1050 {
1042 AXObject* obj = getOrCreate(element); 1051 AXObject* obj = getOrCreate(element);
1043 if (!obj) 1052 if (!obj)
1044 return; 1053 return;
1045 1054
1046 obj->setElementRect(rect); 1055 obj->setElementRect(rect);
1047 } 1056 }
1048 1057
1049 } // namespace blink 1058 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/core/accessibility/AXScrollView.h » ('j') | Source/core/frame/FrameView.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698