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 #ifndef CHROME_GPU_X_UTIL_H_ | 5 #ifndef CHROME_GPU_X_UTIL_H_ |
6 #define CHROME_GPU_X_UTIL_H_ | 6 #define CHROME_GPU_X_UTIL_H_ |
7 | 7 |
8 // Some X-Windows specific stuff. This can be included on any platform, and will | 8 // Some X-Windows specific stuff. This can be included on any platform, and will |
9 // be a NOP on non-Linux ones. | 9 // be a NOP on non-Linux ones. |
10 | 10 |
11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
12 #include "content/common/gpu/gpu_config.h" | 12 #include "content/common/gpu/gpu_config.h" |
13 | 13 |
14 #if defined(USE_X11) | 14 #if defined(USE_X11) |
15 | 15 |
| 16 namespace content { |
| 17 |
16 // Forward declares ------------------------------------------------------------ | 18 // Forward declares ------------------------------------------------------------ |
17 // | 19 // |
18 // X Windows headers do a lot of evil stuff, like "#define Status int" which | 20 // X Windows headers do a lot of evil stuff, like "#define Status int" which |
19 // will cause many problems when combined with our other header files (like | 21 // will cause many problems when combined with our other header files (like |
20 // ones that define a class local enum called "Status." | 22 // ones that define a class local enum called "Status." |
21 // | 23 // |
22 // These definitions are not Kosher, but allow us to remove this dependency and | 24 // These definitions are not Kosher, but allow us to remove this dependency and |
23 // actually compile X at all. | 25 // actually compile X at all. |
24 | 26 |
25 typedef unsigned long XID; | 27 typedef unsigned long XID; |
26 | 28 |
27 extern "C" { | 29 extern "C" { |
28 | 30 |
29 typedef struct _XDisplay Display; | 31 typedef struct _XDisplay Display; |
30 typedef struct __GLXcontextRec *GLXContext; | 32 typedef struct __GLXcontextRec *GLXContext; |
31 | 33 |
32 } // extern "C" | 34 } // extern "C" |
33 | 35 |
34 // Utils ----------------------------------------------------------------------- | 36 // Utils ----------------------------------------------------------------------- |
35 | 37 |
36 // scoped_ptr functor for XFree(). Use as follows: | 38 // scoped_ptr functor for XFree(). Use as follows: |
37 // scoped_ptr_mallox<XVisualInfo, ScopedPtrXFree> foo(...); | 39 // scoped_ptr_mallox<XVisualInfo, ScopedPtrXFree> foo(...); |
38 // where "XVisualInfo" is any X type that is freed with XFree. | 40 // where "XVisualInfo" is any X type that is freed with XFree. |
39 class ScopedPtrXFree { | 41 class ScopedPtrXFree { |
40 public: | 42 public: |
41 void operator()(void* x) const; | 43 void operator()(void* x) const; |
42 }; | 44 }; |
43 | 45 |
| 46 } // namespace content |
| 47 |
44 #endif // USE_X11 | 48 #endif // USE_X11 |
45 | 49 |
46 #endif // CHROME_GPU_X_UTIL_H_ | 50 #endif // CHROME_GPU_X_UTIL_H_ |
OLD | NEW |