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

Side by Side Diff: ui/aura/x11_atom_cache.cc

Issue 10441028: aura/cros: Rename MessagePump{X => AuraX11} and move the atom cache into it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile error in file added in the interim Created 8 years, 6 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/aura/ui_controls_x11.cc ('k') | ui/base/x/events_x.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 #include "ui/aura/x11_atom_cache.h" 5 #include "ui/aura/x11_atom_cache.h"
6 6
7 #include <X11/Xatom.h> 7 #include <X11/Xatom.h>
8 8
9 #include "base/message_pump_aurax11.h"
9 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
10 #include "base/message_pump_x.h"
11 11
12 namespace aura { 12 namespace aura {
13 13
14 X11AtomCache::X11AtomCache(Display* xdisplay, const char** to_cache) 14 X11AtomCache::X11AtomCache(Display* xdisplay, const char** to_cache)
15 : xdisplay_(xdisplay) { 15 : xdisplay_(xdisplay) {
16 int cache_count = 0; 16 int cache_count = 0;
17 for (const char** i = to_cache; *i != NULL; i++) 17 for (const char** i = to_cache; *i != NULL; i++)
18 cache_count++; 18 cache_count++;
19 19
20 scoped_array< ::Atom> cached_atoms(new ::Atom[cache_count]); 20 scoped_array< ::Atom> cached_atoms(new ::Atom[cache_count]);
21 21
22 // Grab all the atoms we need now to minimize roundtrips to the X11 server. 22 // Grab all the atoms we need now to minimize roundtrips to the X11 server.
23 XInternAtoms(base::MessagePumpX::GetDefaultXDisplay(), 23 XInternAtoms(base::MessagePumpAuraX11::GetDefaultXDisplay(),
24 const_cast<char**>(to_cache), cache_count, False, 24 const_cast<char**>(to_cache), cache_count, False,
25 cached_atoms.get()); 25 cached_atoms.get());
26 26
27 for (int i = 0; i < cache_count; ++i) 27 for (int i = 0; i < cache_count; ++i)
28 cached_atoms_.insert(std::make_pair(to_cache[i], cached_atoms[i])); 28 cached_atoms_.insert(std::make_pair(to_cache[i], cached_atoms[i]));
29 } 29 }
30 30
31 X11AtomCache::~X11AtomCache() {} 31 X11AtomCache::~X11AtomCache() {}
32 32
33 ::Atom X11AtomCache::GetAtom(const char* name) const { 33 ::Atom X11AtomCache::GetAtom(const char* name) const {
34 std::map<std::string, ::Atom>::const_iterator it = cached_atoms_.find(name); 34 std::map<std::string, ::Atom>::const_iterator it = cached_atoms_.find(name);
35 CHECK(it != cached_atoms_.end()); 35 CHECK(it != cached_atoms_.end());
36 return it->second; 36 return it->second;
37 } 37 }
38 38
39 } // namespace aura 39 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/ui_controls_x11.cc ('k') | ui/base/x/events_x.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698