Chromium Code Reviews| Index: ui/gfx/x/x11_atom_cache.h |
| diff --git a/ui/gfx/x/x11_atom_cache.h b/ui/gfx/x/x11_atom_cache.h |
| index fd0b637ff99bb5bfaa91f81c099580fb1967cf50..91e68786fb0136c4b112c87bc218b3d8b7134bf0 100644 |
| --- a/ui/gfx/x/x11_atom_cache.h |
| +++ b/ui/gfx/x/x11_atom_cache.h |
| @@ -12,6 +12,11 @@ |
| #include "ui/gfx/gfx_export.h" |
| #include "ui/gfx/x/x11_types.h" |
| +namespace base { |
| +template <typename T> |
| +struct DefaultSingletonTraits; |
| +} |
| + |
| namespace ui { |
|
sadrul
2017/06/01 20:45:31
OK, I think my bad, but this should be gfx :(
Som
Tom Anderson
2017/06/01 21:20:42
Acknowledged.
|
| // Pre-caches all Atoms on first use to minimize roundtrips to the X11 |
| @@ -20,22 +25,19 @@ namespace ui { |
| // with allow_uncached_atoms(). |
| class GFX_EXPORT X11AtomCache { |
| public: |
| - // Preinterns the NULL terminated list of string |to_cache| on |xdisplay|. |
| - X11AtomCache(XDisplay* xdisplay, const char* const* to_cache); |
| - ~X11AtomCache(); |
| + static X11AtomCache* GetInstance(); |
| // Returns the pre-interned Atom without having to go to the x server. |
| XAtom GetAtom(const char*) const; |
| - // When an Atom isn't in the list of items we've cached, we should look it |
| - // up, cache it locally, and then return the result. |
| - void allow_uncached_atoms() { uncached_atoms_allowed_ = true; } |
| - |
| private: |
| + friend struct base::DefaultSingletonTraits<X11AtomCache>; |
| + |
| + X11AtomCache(); |
| + ~X11AtomCache(); |
| + |
| XDisplay* xdisplay_; |
| - bool uncached_atoms_allowed_; |
| - |
| mutable std::map<std::string, XAtom> cached_atoms_; |
| DISALLOW_COPY_AND_ASSIGN(X11AtomCache); |