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

Side by Side Diff: ui/gfx/x/x11_atom_cache.h

Issue 392153002: Remove X11/Xlib.h include from selection_requestor.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « ui/base/x/x11_util.cc ('k') | ui/gfx/x/x11_atom_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 (c) 2012 The Chromium Authors. All rights reserved. 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 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_GFX_X_X11_ATOM_CACHE_H_ 5 #ifndef UI_GFX_X_X11_ATOM_CACHE_H_
6 #define UI_GFX_X_X11_ATOM_CACHE_H_ 6 #define UI_GFX_X_X11_ATOM_CACHE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "ui/gfx/gfx_export.h" 12 #include "ui/gfx/gfx_export.h"
13 13 #include "ui/gfx/x/x11_types.h"
14 typedef unsigned long Atom;
15 typedef struct _XDisplay XDisplay;
16 14
17 namespace ui { 15 namespace ui {
18 16
19 // Pre-caches all Atoms on first use to minimize roundtrips to the X11 17 // Pre-caches all Atoms on first use to minimize roundtrips to the X11
20 // server. By default, GetAtom() will CHECK() that atoms accessed through 18 // server. By default, GetAtom() will CHECK() that atoms accessed through
21 // GetAtom() were passed to the constructor, but this behaviour can be changed 19 // GetAtom() were passed to the constructor, but this behaviour can be changed
22 // with allow_uncached_atoms(). 20 // with allow_uncached_atoms().
23 class GFX_EXPORT X11AtomCache { 21 class GFX_EXPORT X11AtomCache {
24 public: 22 public:
25 // Preinterns the NULL terminated list of string |to_cache_ on |xdisplay|. 23 // Preinterns the NULL terminated list of string |to_cache_ on |xdisplay|.
26 X11AtomCache(XDisplay* xdisplay, const char** to_cache); 24 X11AtomCache(XDisplay* xdisplay, const char** to_cache);
27 ~X11AtomCache(); 25 ~X11AtomCache();
28 26
29 // Returns the pre-interned Atom without having to go to the x server. 27 // Returns the pre-interned Atom without having to go to the x server.
30 Atom GetAtom(const char*) const; 28 XAtom GetAtom(const char*) const;
31 29
32 // When an Atom isn't in the list of items we've cached, we should look it 30 // When an Atom isn't in the list of items we've cached, we should look it
33 // up, cache it locally, and then return the result. 31 // up, cache it locally, and then return the result.
34 void allow_uncached_atoms() { uncached_atoms_allowed_ = true; } 32 void allow_uncached_atoms() { uncached_atoms_allowed_ = true; }
35 33
36 private: 34 private:
37 XDisplay* xdisplay_; 35 XDisplay* xdisplay_;
38 36
39 bool uncached_atoms_allowed_; 37 bool uncached_atoms_allowed_;
40 38
41 mutable std::map<std::string, Atom> cached_atoms_; 39 mutable std::map<std::string, XAtom> cached_atoms_;
42 40
43 DISALLOW_COPY_AND_ASSIGN(X11AtomCache); 41 DISALLOW_COPY_AND_ASSIGN(X11AtomCache);
44 }; 42 };
45 43
46 } // namespace ui 44 } // namespace ui
47 45
48 #endif // UI_GFX_X_X11_ATOM_CACHE_H_ 46 #endif // UI_GFX_X_X11_ATOM_CACHE_H_
OLDNEW
« no previous file with comments | « ui/base/x/x11_util.cc ('k') | ui/gfx/x/x11_atom_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698