OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 CONTENT_BROWSER_COMPOSITOR_IO_SURFACE_CONTEXT_MAC_H_ | 5 #ifndef CONTENT_BROWSER_COMPOSITOR_IO_SURFACE_CONTEXT_MAC_H_ |
6 #define CONTENT_BROWSER_COMPOSITOR_IO_SURFACE_CONTEXT_MAC_H_ | 6 #define CONTENT_BROWSER_COMPOSITOR_IO_SURFACE_CONTEXT_MAC_H_ |
7 | 7 |
8 #include <OpenGL/OpenGL.h> | 8 #include <OpenGL/OpenGL.h> |
9 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 27 matching lines...) Expand all Loading... |
38 // Mark that all the GL contexts in the same sharegroup as this context as | 38 // Mark that all the GL contexts in the same sharegroup as this context as |
39 // invalid, so they shouldn't be returned anymore by Get, but rather, new | 39 // invalid, so they shouldn't be returned anymore by Get, but rather, new |
40 // contexts should be created. This is called as a precaution when unexpected | 40 // contexts should be created. This is called as a precaution when unexpected |
41 // GL errors occur, or after a GPU switch. | 41 // GL errors occur, or after a GPU switch. |
42 void PoisonContextAndSharegroup(); | 42 void PoisonContextAndSharegroup(); |
43 bool HasBeenPoisoned() const { return poisoned_; } | 43 bool HasBeenPoisoned() const { return poisoned_; } |
44 | 44 |
45 CGLContextObj cgl_context() const { return cgl_context_; } | 45 CGLContextObj cgl_context() const { return cgl_context_; } |
46 | 46 |
47 // content::GpuDataManagerObserver implementation. | 47 // content::GpuDataManagerObserver implementation. |
48 virtual void OnGpuSwitching() OVERRIDE; | 48 virtual void OnGpuSwitching() override; |
49 | 49 |
50 private: | 50 private: |
51 friend class base::RefCounted<IOSurfaceContext>; | 51 friend class base::RefCounted<IOSurfaceContext>; |
52 | 52 |
53 IOSurfaceContext( | 53 IOSurfaceContext( |
54 Type type, | 54 Type type, |
55 base::ScopedTypeRef<CGLContextObj> clg_context_strong); | 55 base::ScopedTypeRef<CGLContextObj> clg_context_strong); |
56 virtual ~IOSurfaceContext(); | 56 virtual ~IOSurfaceContext(); |
57 | 57 |
58 Type type_; | 58 Type type_; |
59 base::ScopedTypeRef<CGLContextObj> cgl_context_; | 59 base::ScopedTypeRef<CGLContextObj> cgl_context_; |
60 | 60 |
61 bool poisoned_; | 61 bool poisoned_; |
62 | 62 |
63 // The global map from window number and window ordering to | 63 // The global map from window number and window ordering to |
64 // context data. | 64 // context data. |
65 typedef std::map<Type, IOSurfaceContext*> TypeMap; | 65 typedef std::map<Type, IOSurfaceContext*> TypeMap; |
66 static base::LazyInstance<TypeMap> type_map_; | 66 static base::LazyInstance<TypeMap> type_map_; |
67 static TypeMap* type_map(); | 67 static TypeMap* type_map(); |
68 }; | 68 }; |
69 | 69 |
70 } // namespace content | 70 } // namespace content |
71 | 71 |
72 #endif // CONTENT_BROWSER_COMPOSITOR_IO_SURFACE_CONTEXT_MAC_H_ | 72 #endif // CONTENT_BROWSER_COMPOSITOR_IO_SURFACE_CONTEXT_MAC_H_ |
OLD | NEW |