| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef UI_AURA_X11_ATOM_CACHE_H_ | |
| 6 #define UI_AURA_X11_ATOM_CACHE_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "ui/aura/aura_export.h" | |
| 10 | |
| 11 #include <X11/Xlib.h> | |
| 12 | |
| 13 #include <map> | |
| 14 #include <string> | |
| 15 | |
| 16 // Get rid of a macro from Xlib.h that conflicts with Aura's RootWindow class. | |
| 17 #undef RootWindow | |
| 18 | |
| 19 namespace aura { | |
| 20 | |
| 21 // Pre-caches all Atoms on first use to minimize roundtrips to the X11 | |
| 22 // server. Assumes that we only have a single X11 display, | |
| 23 // base::MessagePumpX::GetDefaultXDisplay(). | |
| 24 class AURA_EXPORT X11AtomCache { | |
| 25 public: | |
| 26 // Preinterns the NULL terminated list of string |to_cache_ on |xdisplay|. | |
| 27 X11AtomCache(Display* xdisplay, const char** to_cache); | |
| 28 ~X11AtomCache(); | |
| 29 | |
| 30 // Returns the pre-interned Atom without having to go to the x server. | |
| 31 ::Atom GetAtom(const char*) const; | |
| 32 | |
| 33 private: | |
| 34 Display* xdisplay_; | |
| 35 | |
| 36 std::map<std::string, ::Atom> cached_atoms_; | |
| 37 | |
| 38 DISALLOW_COPY_AND_ASSIGN(X11AtomCache); | |
| 39 }; | |
| 40 | |
| 41 } // namespace aura | |
| 42 | |
| 43 #endif // UI_AURA_ATOM_CACHE_H_ | |
| OLD | NEW |