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

Unified Diff: ui/gfx/x/x11_types.h

Issue 1001833005: Update from https://crrev.com/320343 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Supress Created 5 years, 9 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
« no previous file with comments | « ui/gfx/skia_util.cc ('k') | ui/gl/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/x/x11_types.h
diff --git a/ui/gfx/x/x11_types.h b/ui/gfx/x/x11_types.h
index 945776d3bfa7ce6359d1c94f8ab572a3ebac6bf9..82ce8389bd99bde7c97c22a0a85be33d26c5b9b3 100644
--- a/ui/gfx/x/x11_types.h
+++ b/ui/gfx/x/x11_types.h
@@ -6,6 +6,7 @@
#define UI_GFX_X_X11_UTIL_H_
#include "base/basictypes.h"
+#include "base/memory/scoped_ptr.h"
#include "ui/gfx/gfx_export.h"
typedef unsigned long XAtom;
@@ -14,8 +15,20 @@ typedef struct _XImage XImage;
typedef struct _XGC *GC;
typedef struct _XDisplay XDisplay;
+extern "C" {
+int XFree(void*);
+}
+
namespace gfx {
+template <class T, class R, R (*F)(T*)>
+struct XObjectDeleter {
+ inline void operator()(void* ptr) const { F(static_cast<T*>(ptr)); }
+};
+
+template <class T, class D = XObjectDeleter<void, int, XFree>>
+using XScopedPtr = scoped_ptr<T, D>;
+
// TODO(oshima|evan): This assume there is one display and doesn't work
// undef multiple displays/monitor environment. Remove this and change the
// chrome codebase to get the display from window.
« no previous file with comments | « ui/gfx/skia_util.cc ('k') | ui/gl/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698