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

Unified Diff: ui/base/x/x11_util.cc

Issue 2504743002: Linux Aura: Fixes and improvements for cursor loader (Closed)
Patch Set: Formatting Created 4 years, 1 month 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
« no previous file with comments | « ui/base/x/x11_util.h ('k') | ui/views/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/x/x11_util.cc
diff --git a/ui/base/x/x11_util.cc b/ui/base/x/x11_util.cc
index 4a2b16b1a1d98d261b33195d5c502e8faab58ac6..e0cb8d779f697aaea8c53a1b47f07efffecf4cbb 100644
--- a/ui/base/x/x11_util.cc
+++ b/ui/base/x/x11_util.cc
@@ -11,6 +11,7 @@
#include <ctype.h>
#include <sys/ipc.h>
#include <sys/shm.h>
+#include <X11/cursorfont.h>
#include <X11/extensions/shape.h>
#include <X11/extensions/XInput2.h>
#include <X11/Xcursor/Xcursor.h>
@@ -174,44 +175,6 @@ void ReleaseXImage(void* address, void* context) {
XDestroyImage(static_cast<XImage*>(context));
}
-// A process wide singleton that manages the usage of X cursors.
-class XCursorCache {
- public:
- XCursorCache() {}
- ~XCursorCache() {
- Clear();
- }
-
- ::Cursor GetCursor(int cursor_shape) {
- // Lookup cursor by attempting to insert a null value, which avoids
- // a second pass through the map after a cache miss.
- std::pair<std::map<int, ::Cursor>::iterator, bool> it = cache_.insert(
- std::make_pair(cursor_shape, 0));
- if (it.second) {
- XDisplay* display = gfx::GetXDisplay();
- it.first->second = XCreateFontCursor(display, cursor_shape);
- }
- return it.first->second;
- }
-
- void Clear() {
- XDisplay* display = gfx::GetXDisplay();
- for (std::map<int, ::Cursor>::iterator it =
- cache_.begin(); it != cache_.end(); ++it) {
- XFreeCursor(display, it->second);
- }
- cache_.clear();
- }
-
- private:
- // Maps X11 font cursor shapes to Cursor IDs.
- std::map<int, ::Cursor> cache_;
-
- DISALLOW_COPY_AND_ASSIGN(XCursorCache);
-};
-
-XCursorCache* cursor_cache = NULL;
-
// A process wide singleton cache for custom X cursors.
class XCustomCursorCache {
public:
@@ -311,12 +274,6 @@ bool QueryRenderSupport(Display* dpy) {
return render_supported;
}
-::Cursor GetXCursor(int cursor_shape) {
- if (!cursor_cache)
- cursor_cache = new XCursorCache;
- return cursor_cache->GetCursor(cursor_shape);
-}
-
::Cursor CreateReffedCustomXCursor(XcursorImage* image) {
return XCustomCursorCache::GetInstance()->InstallCustomCursor(image);
}
@@ -1314,11 +1271,6 @@ void XScopedCursor::reset(::Cursor cursor) {
namespace test {
-void ResetXCursorCache() {
- delete cursor_cache;
- cursor_cache = NULL;
-}
-
const XcursorImage* GetCachedXcursorImage(::Cursor cursor) {
return XCustomCursorCache::GetInstance()->GetXcursorImage(cursor);
}
« no previous file with comments | « ui/base/x/x11_util.h ('k') | ui/views/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698