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

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

Issue 10381063: Aura/ash split: Don't use X11 window borders. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Part 2: Patch minimization and puts event processing in X11WindowEventFilter. Created 8 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
Index: ui/base/x/x11_atom_cache.h
diff --git a/ui/base/x/x11_atom_cache.h b/ui/base/x/x11_atom_cache.h
new file mode 100644
index 0000000000000000000000000000000000000000..531e84a81841ecf7cf3ff94b65086814f6372bc7
--- /dev/null
+++ b/ui/base/x/x11_atom_cache.h
@@ -0,0 +1,57 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_BASE_X_X11_ATOM_CACHE_H_
+#define UI_BASE_X_X11_ATOM_CACHE_H_
+
+#include "base/basictypes.h"
+#include "base/memory/singleton.h"
+#include "ui/base/ui_export.h"
+
+#include <X11/Xlib.h>
+
+// Get rid of a macro from Xlib.h that conflicts with Aura's RootWindow class.
+#undef RootWindow
+
+namespace ui {
+
+// Pre-caches all Atoms on first use to minimize roundtrips to the X11
+// server. Assumes that we only have a single X11 display,
+// base::MessagePumpX::GetDefaultXDisplay().
+class UI_EXPORT X11AtomCache {
+ public:
+ static X11AtomCache* GetInstance();
+
+ // Names of cached atoms that we fetch during the constructor to minimize
+ // round trips to the X11 server.
+ enum AtomName {
+ WM_DELETE_WINDOW = 0,
+ _NET_WM_MOVERESIZE,
+ _NET_WM_PING,
+ _NET_WM_PID,
+ WM_S0,
+
+ _MOTIF_WM_HINTS,
+
+ ATOM_COUNT
+ };
+
+ // Returns the pre-interned Atom by enum instead of string.
+ ::Atom GetAtom(AtomName name) const;
+
+ private:
+ friend struct DefaultSingletonTraits<X11AtomCache>;
+
+ // Constructor performs all interning
+ X11AtomCache();
+ ~X11AtomCache();
+
+ ::Atom cached_atoms_[ATOM_COUNT];
+
+ DISALLOW_COPY_AND_ASSIGN(X11AtomCache);
+};
+
+} // namespace ui
+
+#endif // UI_BASE_X_ATOM_CACHE_H_

Powered by Google App Engine
This is Rietveld 408576698