| 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_RENDERER_HOST_COMPOSITING_IOSURFACE_CONTEXT_MAC_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_COMPOSITING_IOSURFACE_CONTEXT_MAC_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_COMPOSITING_IOSURFACE_CONTEXT_MAC_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_COMPOSITING_IOSURFACE_CONTEXT_MAC_H_ |
| 7 | 7 |
| 8 #import <AppKit/NSOpenGL.h> | 8 #import <AppKit/NSOpenGL.h> |
| 9 #include <OpenGL/OpenGL.h> | 9 #include <OpenGL/OpenGL.h> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 // invalid, so they shouldn't be returned anymore by Get, but rather, new | 43 // invalid, so they shouldn't be returned anymore by Get, but rather, new |
| 44 // contexts should be created. This is called as a precaution when unexpected | 44 // contexts should be created. This is called as a precaution when unexpected |
| 45 // GL errors occur. | 45 // GL errors occur. |
| 46 void PoisonContextAndSharegroup(); | 46 void PoisonContextAndSharegroup(); |
| 47 bool HasBeenPoisoned() const { return poisoned_; } | 47 bool HasBeenPoisoned() const { return poisoned_; } |
| 48 | 48 |
| 49 CompositingIOSurfaceShaderPrograms* shader_program_cache() const { | 49 CompositingIOSurfaceShaderPrograms* shader_program_cache() const { |
| 50 return shader_program_cache_.get(); | 50 return shader_program_cache_.get(); |
| 51 } | 51 } |
| 52 CGLContextObj cgl_context() const { return cgl_context_; } | 52 CGLContextObj cgl_context() const { return cgl_context_; } |
| 53 bool is_vsync_disabled() const { return is_vsync_disabled_; } | |
| 54 int window_number() const { return window_number_; } | 53 int window_number() const { return window_number_; } |
| 55 | 54 |
| 56 // content::GpuDataManagerObserver implementation. | 55 // content::GpuDataManagerObserver implementation. |
| 57 virtual void OnGpuSwitching() OVERRIDE; | 56 virtual void OnGpuSwitching() OVERRIDE; |
| 58 | 57 |
| 59 private: | 58 private: |
| 60 friend class base::RefCounted<CompositingIOSurfaceContext>; | 59 friend class base::RefCounted<CompositingIOSurfaceContext>; |
| 61 | 60 |
| 62 CompositingIOSurfaceContext( | 61 CompositingIOSurfaceContext( |
| 63 int window_number, | 62 int window_number, |
| 64 base::ScopedTypeRef<CGLContextObj> clg_context_strong, | 63 base::ScopedTypeRef<CGLContextObj> clg_context_strong, |
| 65 CGLContextObj clg_context, | 64 CGLContextObj clg_context, |
| 66 bool is_vsync_disabled_, | |
| 67 scoped_ptr<CompositingIOSurfaceShaderPrograms> shader_program_cache); | 65 scoped_ptr<CompositingIOSurfaceShaderPrograms> shader_program_cache); |
| 68 virtual ~CompositingIOSurfaceContext(); | 66 virtual ~CompositingIOSurfaceContext(); |
| 69 | 67 |
| 70 int window_number_; | 68 int window_number_; |
| 71 base::ScopedTypeRef<CGLContextObj> cgl_context_strong_; | 69 base::ScopedTypeRef<CGLContextObj> cgl_context_strong_; |
| 72 // Weak, backed by |cgl_context_strong_|. | 70 // Weak, backed by |cgl_context_strong_|. |
| 73 CGLContextObj cgl_context_; | 71 CGLContextObj cgl_context_; |
| 74 | 72 |
| 75 bool is_vsync_disabled_; | |
| 76 scoped_ptr<CompositingIOSurfaceShaderPrograms> shader_program_cache_; | 73 scoped_ptr<CompositingIOSurfaceShaderPrograms> shader_program_cache_; |
| 77 bool poisoned_; | 74 bool poisoned_; |
| 78 | 75 |
| 79 // The global map from window number and window ordering to | 76 // The global map from window number and window ordering to |
| 80 // context data. | 77 // context data. |
| 81 typedef std::map<int, CompositingIOSurfaceContext*> WindowMap; | 78 typedef std::map<int, CompositingIOSurfaceContext*> WindowMap; |
| 82 static base::LazyInstance<WindowMap> window_map_; | 79 static base::LazyInstance<WindowMap> window_map_; |
| 83 static WindowMap* window_map(); | 80 static WindowMap* window_map(); |
| 84 }; | 81 }; |
| 85 | 82 |
| 86 } // namespace content | 83 } // namespace content |
| 87 | 84 |
| 88 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITING_IOSURFACE_CONTEXT_MAC_H_ | 85 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITING_IOSURFACE_CONTEXT_MAC_H_ |
| OLD | NEW |