| OLD | NEW |
| 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 #include "ui/gfx/x/x11_atom_cache.h" | 5 #include "ui/gfx/x/x11_atom_cache.h" |
| 6 | 6 |
| 7 #include <X11/Xatom.h> | 7 #include <X11/Xatom.h> |
| 8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 "XdndLeave", | 149 "XdndLeave", |
| 150 "XdndPosition", | 150 "XdndPosition", |
| 151 "XdndProxy", | 151 "XdndProxy", |
| 152 "XdndSelection", | 152 "XdndSelection", |
| 153 "XdndStatus", | 153 "XdndStatus", |
| 154 "XdndTypeList", | 154 "XdndTypeList", |
| 155 nullptr}; | 155 nullptr}; |
| 156 | 156 |
| 157 } // namespace | 157 } // namespace |
| 158 | 158 |
| 159 namespace ui { | 159 namespace gfx { |
| 160 |
| 161 XAtom GetAtom(const char* name) { |
| 162 return X11AtomCache::GetInstance()->GetAtom(name); |
| 163 } |
| 160 | 164 |
| 161 X11AtomCache* X11AtomCache::GetInstance() { | 165 X11AtomCache* X11AtomCache::GetInstance() { |
| 162 return base::Singleton<X11AtomCache>::get(); | 166 return base::Singleton<X11AtomCache>::get(); |
| 163 } | 167 } |
| 164 | 168 |
| 165 X11AtomCache::X11AtomCache() : xdisplay_(gfx::GetXDisplay()) { | 169 X11AtomCache::X11AtomCache() : xdisplay_(gfx::GetXDisplay()) { |
| 166 int cache_count = 0; | 170 int cache_count = 0; |
| 167 for (const char* const* i = kAtomsToCache; *i; ++i) | 171 for (const char* const* i = kAtomsToCache; *i; ++i) |
| 168 ++cache_count; | 172 ++cache_count; |
| 169 | 173 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 184 | 188 |
| 185 if (it == cached_atoms_.end()) { | 189 if (it == cached_atoms_.end()) { |
| 186 XAtom atom = XInternAtom(xdisplay_, name, false); | 190 XAtom atom = XInternAtom(xdisplay_, name, false); |
| 187 cached_atoms_.insert(std::make_pair(name, atom)); | 191 cached_atoms_.insert(std::make_pair(name, atom)); |
| 188 return atom; | 192 return atom; |
| 189 } | 193 } |
| 190 | 194 |
| 191 return it->second; | 195 return it->second; |
| 192 } | 196 } |
| 193 | 197 |
| 194 } // namespace ui | 198 } // namespace gfx |
| OLD | NEW |