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

Side by Side Diff: content/browser/renderer_host/compositing_iosurface_context_mac.h

Issue 147493011: Use base::ScopedTypeRef for CGL types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase again Created 6 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/renderer_host/compositing_iosurface_context_mac.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/mac/scoped_nsobject.h"
15 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
16 #include "base/memory/scoped_ptr.h" 16 #include "base/memory/scoped_ptr.h"
17 #include "content/browser/renderer_host/display_link_mac.h" 17 #include "content/browser/renderer_host/display_link_mac.h"
18 #include "ui/gl/scoped_cgl.h"
18 19
19 namespace content { 20 namespace content {
20 21
21 enum CoreAnimationStatus { 22 enum CoreAnimationStatus {
22 CORE_ANIMATION_DISABLED, 23 CORE_ANIMATION_DISABLED,
23 CORE_ANIMATION_ENABLED, 24 CORE_ANIMATION_ENABLED,
24 }; 25 };
25 CoreAnimationStatus GetCoreAnimationStatus(); 26 CoreAnimationStatus GetCoreAnimationStatus();
26 27
27 class CompositingIOSurfaceShaderPrograms; 28 class CompositingIOSurfaceShaderPrograms;
(...skipping 25 matching lines...) Expand all
53 bool IsVendorIntel(); 54 bool IsVendorIntel();
54 55
55 DisplayLinkMac* display_link() { return display_link_; } 56 DisplayLinkMac* display_link() { return display_link_; }
56 57
57 private: 58 private:
58 friend class base::RefCounted<CompositingIOSurfaceContext>; 59 friend class base::RefCounted<CompositingIOSurfaceContext>;
59 60
60 CompositingIOSurfaceContext( 61 CompositingIOSurfaceContext(
61 int window_number, 62 int window_number,
62 NSOpenGLContext* nsgl_context, 63 NSOpenGLContext* nsgl_context,
63 CGLContextObj clg_context_strong, 64 base::ScopedTypeRef<CGLContextObj> clg_context_strong,
64 CGLContextObj clg_context, 65 CGLContextObj clg_context,
65 bool is_vsync_disabled_, 66 bool is_vsync_disabled_,
66 scoped_refptr<DisplayLinkMac> display_link, 67 scoped_refptr<DisplayLinkMac> display_link,
67 scoped_ptr<CompositingIOSurfaceShaderPrograms> shader_program_cache); 68 scoped_ptr<CompositingIOSurfaceShaderPrograms> shader_program_cache);
68 ~CompositingIOSurfaceContext(); 69 ~CompositingIOSurfaceContext();
69 70
70 int window_number_; 71 int window_number_;
71 base::scoped_nsobject<NSOpenGLContext> nsgl_context_; 72 base::scoped_nsobject<NSOpenGLContext> nsgl_context_;
72 CGLContextObj cgl_context_strong_; 73 base::ScopedTypeRef<CGLContextObj> cgl_context_strong_;
73 // Weak, backed by |nsgl_context_| or |cgl_context_strong_|. 74 // Weak, backed by |nsgl_context_| or |cgl_context_strong_|.
74 CGLContextObj cgl_context_; 75 CGLContextObj cgl_context_;
75 76
76 bool is_vsync_disabled_; 77 bool is_vsync_disabled_;
77 scoped_ptr<CompositingIOSurfaceShaderPrograms> shader_program_cache_; 78 scoped_ptr<CompositingIOSurfaceShaderPrograms> shader_program_cache_;
78 bool can_be_shared_; 79 bool can_be_shared_;
79 80
80 bool initialized_is_intel_; 81 bool initialized_is_intel_;
81 bool is_intel_; 82 bool is_intel_;
82 GLint screen_; 83 GLint screen_;
83 84
84 // Display link for getting vsync info. 85 // Display link for getting vsync info.
85 scoped_refptr<DisplayLinkMac> display_link_; 86 scoped_refptr<DisplayLinkMac> display_link_;
86 87
87 // The global map from window number and window ordering to 88 // The global map from window number and window ordering to
88 // context data. 89 // context data.
89 typedef std::map<int, CompositingIOSurfaceContext*> WindowMap; 90 typedef std::map<int, CompositingIOSurfaceContext*> WindowMap;
90 static base::LazyInstance<WindowMap> window_map_; 91 static base::LazyInstance<WindowMap> window_map_;
91 static WindowMap* window_map(); 92 static WindowMap* window_map();
92 }; 93 };
93 94
94 } // namespace content 95 } // namespace content
95 96
96 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITING_IOSURFACE_CONTEXT_MAC_H_ 97 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITING_IOSURFACE_CONTEXT_MAC_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/compositing_iosurface_context_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698