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

Unified Diff: ui/gfx/x/x11_atom_cache.h

Issue 2914103002: Remove usages of XInternAtom (Closed)
Patch Set: Address sadrul and sergeyu comments Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/icc_profile_x11.cc ('k') | ui/gfx/x/x11_atom_cache.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 {
// 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);
« no previous file with comments | « ui/gfx/icc_profile_x11.cc ('k') | ui/gfx/x/x11_atom_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698