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> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/lazy_instance.h" | 13 #include "base/lazy_instance.h" |
| 14 #include "base/mac/scoped_nsobject.h" |
14 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
15 #include "base/memory/scoped_nsobject.h" | |
16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
17 | 17 |
18 namespace content { | 18 namespace content { |
19 | 19 |
20 class CompositingIOSurfaceShaderPrograms; | 20 class CompositingIOSurfaceShaderPrograms; |
21 | 21 |
22 class CompositingIOSurfaceContext | 22 class CompositingIOSurfaceContext |
23 : public base::RefCounted<CompositingIOSurfaceContext> { | 23 : public base::RefCounted<CompositingIOSurfaceContext> { |
24 public: | 24 public: |
25 // Get or create a GL context for the specified window with the specified | 25 // Get or create a GL context for the specified window with the specified |
(...skipping 20 matching lines...) Expand all Loading... |
46 | 46 |
47 CompositingIOSurfaceContext( | 47 CompositingIOSurfaceContext( |
48 int window_number, | 48 int window_number, |
49 NSOpenGLContext* nsgl_context, | 49 NSOpenGLContext* nsgl_context, |
50 CGLContextObj clg_context, | 50 CGLContextObj clg_context, |
51 bool is_vsync_disabled_, | 51 bool is_vsync_disabled_, |
52 scoped_ptr<CompositingIOSurfaceShaderPrograms> shader_program_cache); | 52 scoped_ptr<CompositingIOSurfaceShaderPrograms> shader_program_cache); |
53 ~CompositingIOSurfaceContext(); | 53 ~CompositingIOSurfaceContext(); |
54 | 54 |
55 int window_number_; | 55 int window_number_; |
56 scoped_nsobject<NSOpenGLContext> nsgl_context_; | 56 base::scoped_nsobject<NSOpenGLContext> nsgl_context_; |
57 CGLContextObj cgl_context_; // weak, backed by |nsgl_context_| | 57 CGLContextObj cgl_context_; // weak, backed by |nsgl_context_| |
58 bool is_vsync_disabled_; | 58 bool is_vsync_disabled_; |
59 scoped_ptr<CompositingIOSurfaceShaderPrograms> shader_program_cache_; | 59 scoped_ptr<CompositingIOSurfaceShaderPrograms> shader_program_cache_; |
60 bool can_be_shared_; | 60 bool can_be_shared_; |
61 | 61 |
62 // The global map from window number and window ordering to | 62 // The global map from window number and window ordering to |
63 // context data. | 63 // context data. |
64 typedef std::map<int, CompositingIOSurfaceContext*> WindowMap; | 64 typedef std::map<int, CompositingIOSurfaceContext*> WindowMap; |
65 static base::LazyInstance<WindowMap> window_map_; | 65 static base::LazyInstance<WindowMap> window_map_; |
66 static WindowMap* window_map(); | 66 static WindowMap* window_map(); |
67 }; | 67 }; |
68 | 68 |
69 } // namespace content | 69 } // namespace content |
70 | 70 |
71 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITING_IOSURFACE_CONTEXT_MAC_H_ | 71 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITING_IOSURFACE_CONTEXT_MAC_H_ |
OLD | NEW |