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

Side by Side Diff: ui/views/accessibility/ax_aura_obj_cache.h

Issue 1629403004: Remove all descendant views from AXAuraObjCache when a view is removed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Only compile unit tests on aura platforms Created 4 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
« no previous file with comments | « no previous file | ui/views/accessibility/ax_aura_obj_cache.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_VIEWS_ACCESSIBILITY_AX_AURA_OBJ_CACHE_H_ 5 #ifndef UI_VIEWS_ACCESSIBILITY_AX_AURA_OBJ_CACHE_H_
6 #define UI_VIEWS_ACCESSIBILITY_AX_AURA_OBJ_CACHE_H_ 6 #define UI_VIEWS_ACCESSIBILITY_AX_AURA_OBJ_CACHE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 20 matching lines...) Expand all
31 public: 31 public:
32 // Get the single instance of this class. 32 // Get the single instance of this class.
33 static AXAuraObjCache* GetInstance(); 33 static AXAuraObjCache* GetInstance();
34 34
35 // Get or create an entry in the cache based on an Aura view. 35 // Get or create an entry in the cache based on an Aura view.
36 AXAuraObjWrapper* GetOrCreate(View* view); 36 AXAuraObjWrapper* GetOrCreate(View* view);
37 AXAuraObjWrapper* GetOrCreate(Widget* widget); 37 AXAuraObjWrapper* GetOrCreate(Widget* widget);
38 AXAuraObjWrapper* GetOrCreate(aura::Window* window); 38 AXAuraObjWrapper* GetOrCreate(aura::Window* window);
39 39
40 // Gets an id given an Aura view. 40 // Gets an id given an Aura view.
41 int32_t GetID(View* view); 41 int32_t GetID(View* view) const;
42 int32_t GetID(Widget* widget); 42 int32_t GetID(Widget* widget) const;
43 int32_t GetID(aura::Window* window); 43 int32_t GetID(aura::Window* window) const;
44 44
45 // Gets the next unique id for this cache. Useful for non-Aura view backed 45 // Gets the next unique id for this cache. Useful for non-Aura view backed
46 // views. 46 // views.
47 int32_t GetNextID() { return current_id_++; } 47 int32_t GetNextID() { return current_id_++; }
48 48
49 // Removes an entry from this cache based on an Aura view. 49 // Removes an entry from this cache based on an Aura view.
50 void Remove(View* view); 50 void Remove(View* view);
51 void Remove(Widget* widget); 51 void Remove(Widget* widget);
52 void Remove(aura::Window* window); 52 void Remove(aura::Window* window);
53 53
(...skipping 17 matching lines...) Expand all
71 71
72 AXAuraObjCache(); 72 AXAuraObjCache();
73 virtual ~AXAuraObjCache(); 73 virtual ~AXAuraObjCache();
74 74
75 template <typename AuraViewWrapper, typename AuraView> 75 template <typename AuraViewWrapper, typename AuraView>
76 AXAuraObjWrapper* CreateInternal( 76 AXAuraObjWrapper* CreateInternal(
77 AuraView* aura_view, 77 AuraView* aura_view,
78 std::map<AuraView*, int32_t>& aura_view_to_id_map); 78 std::map<AuraView*, int32_t>& aura_view_to_id_map);
79 79
80 template <typename AuraView> 80 template <typename AuraView>
81 int32_t GetIDInternal(AuraView* aura_view, 81 int32_t GetIDInternal(
82 std::map<AuraView*, int32_t>& aura_view_to_id_map); 82 AuraView* aura_view,
83 const std::map<AuraView*, int32_t>& aura_view_to_id_map) const;
83 84
84 template <typename AuraView> 85 template <typename AuraView>
85 void RemoveInternal(AuraView* aura_view, 86 void RemoveInternal(AuraView* aura_view,
86 std::map<AuraView*, int32_t>& aura_view_to_id_map); 87 std::map<AuraView*, int32_t>& aura_view_to_id_map);
87 88
88 std::map<views::View*, int32_t> view_to_id_map_; 89 std::map<views::View*, int32_t> view_to_id_map_;
89 std::map<views::Widget*, int32_t> widget_to_id_map_; 90 std::map<views::Widget*, int32_t> widget_to_id_map_;
90 std::map<aura::Window*, int32_t> window_to_id_map_; 91 std::map<aura::Window*, int32_t> window_to_id_map_;
91 92
92 std::map<int32_t, AXAuraObjWrapper*> cache_; 93 std::map<int32_t, AXAuraObjWrapper*> cache_;
93 int32_t current_id_; 94 int32_t current_id_;
94 95
95 // True immediately when entering this object's destructor. 96 // True immediately when entering this object's destructor.
96 bool is_destroying_; 97 bool is_destroying_;
97 98
98 DISALLOW_COPY_AND_ASSIGN(AXAuraObjCache); 99 DISALLOW_COPY_AND_ASSIGN(AXAuraObjCache);
99 }; 100 };
100 101
101 } // namespace views 102 } // namespace views
102 103
103 #endif // UI_VIEWS_ACCESSIBILITY_AX_AURA_OBJ_CACHE_H_ 104 #endif // UI_VIEWS_ACCESSIBILITY_AX_AURA_OBJ_CACHE_H_
OLDNEW
« no previous file with comments | « no previous file | ui/views/accessibility/ax_aura_obj_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698