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

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

Issue 311263003: Delete non-CoreAnimation code in RWHVMac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@swappressure
Patch Set: Update driver bug Created 6 years, 6 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
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/public/browser/gpu_data_manager_observer.h" 17 #include "content/public/browser/gpu_data_manager_observer.h"
18 #include "ui/gl/scoped_cgl.h" 18 #include "ui/gl/scoped_cgl.h"
19 19
20 namespace content { 20 namespace content {
21 21
22 enum CoreAnimationStatus {
23 CORE_ANIMATION_DISABLED,
24 CORE_ANIMATION_ENABLED,
25 };
26 CoreAnimationStatus GetCoreAnimationStatus();
27
28 class CompositingIOSurfaceShaderPrograms; 22 class CompositingIOSurfaceShaderPrograms;
29 23
30 class CompositingIOSurfaceContext 24 class CompositingIOSurfaceContext
31 : public base::RefCounted<CompositingIOSurfaceContext>, 25 : public base::RefCounted<CompositingIOSurfaceContext>,
32 public content::GpuDataManagerObserver { 26 public content::GpuDataManagerObserver {
33 public: 27 public:
34 enum { 28 enum {
35 // The number used to look up the context used for async readback and for 29 // The number used to look up the context used for async readback and for
36 // initializing the IOSurface. 30 // initializing the IOSurface.
37 kOffscreenContextWindowNumber = -2, 31 kOffscreenContextWindowNumber = -2,
(...skipping 10 matching lines...) Expand all
48 // Mark that all the GL contexts in the same sharegroup as this context as 42 // Mark that all the GL contexts in the same sharegroup as this context as
49 // 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
50 // 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
51 // GL errors occur. 45 // GL errors occur.
52 void PoisonContextAndSharegroup(); 46 void PoisonContextAndSharegroup();
53 bool HasBeenPoisoned() const { return poisoned_; } 47 bool HasBeenPoisoned() const { return poisoned_; }
54 48
55 CompositingIOSurfaceShaderPrograms* shader_program_cache() const { 49 CompositingIOSurfaceShaderPrograms* shader_program_cache() const {
56 return shader_program_cache_.get(); 50 return shader_program_cache_.get();
57 } 51 }
58 NSOpenGLContext* nsgl_context() const;
59 CGLContextObj cgl_context() const { return cgl_context_; } 52 CGLContextObj cgl_context() const { return cgl_context_; }
60 bool is_vsync_disabled() const { return is_vsync_disabled_; } 53 bool is_vsync_disabled() const { return is_vsync_disabled_; }
61 int window_number() const { return window_number_; } 54 int window_number() const { return window_number_; }
62 55
63 // content::GpuDataManagerObserver implementation. 56 // content::GpuDataManagerObserver implementation.
64 virtual void OnGpuSwitching() OVERRIDE; 57 virtual void OnGpuSwitching() OVERRIDE;
65 58
66 private: 59 private:
67 friend class base::RefCounted<CompositingIOSurfaceContext>; 60 friend class base::RefCounted<CompositingIOSurfaceContext>;
68 61
69 CompositingIOSurfaceContext( 62 CompositingIOSurfaceContext(
70 int window_number, 63 int window_number,
71 NSOpenGLContext* nsgl_context,
72 base::ScopedTypeRef<CGLContextObj> clg_context_strong, 64 base::ScopedTypeRef<CGLContextObj> clg_context_strong,
73 CGLContextObj clg_context, 65 CGLContextObj clg_context,
74 bool is_vsync_disabled_, 66 bool is_vsync_disabled_,
75 scoped_ptr<CompositingIOSurfaceShaderPrograms> shader_program_cache); 67 scoped_ptr<CompositingIOSurfaceShaderPrograms> shader_program_cache);
76 virtual ~CompositingIOSurfaceContext(); 68 virtual ~CompositingIOSurfaceContext();
77 69
78 int window_number_; 70 int window_number_;
79 base::scoped_nsobject<NSOpenGLContext> nsgl_context_;
80 base::ScopedTypeRef<CGLContextObj> cgl_context_strong_; 71 base::ScopedTypeRef<CGLContextObj> cgl_context_strong_;
81 // Weak, backed by |nsgl_context_| or |cgl_context_strong_|. 72 // Weak, backed by |cgl_context_strong_|.
82 CGLContextObj cgl_context_; 73 CGLContextObj cgl_context_;
83 74
84 bool is_vsync_disabled_; 75 bool is_vsync_disabled_;
85 scoped_ptr<CompositingIOSurfaceShaderPrograms> shader_program_cache_; 76 scoped_ptr<CompositingIOSurfaceShaderPrograms> shader_program_cache_;
86 bool poisoned_; 77 bool poisoned_;
87 78
88 // The global map from window number and window ordering to 79 // The global map from window number and window ordering to
89 // context data. 80 // context data.
90 typedef std::map<int, CompositingIOSurfaceContext*> WindowMap; 81 typedef std::map<int, CompositingIOSurfaceContext*> WindowMap;
91 static base::LazyInstance<WindowMap> window_map_; 82 static base::LazyInstance<WindowMap> window_map_;
92 static WindowMap* window_map(); 83 static WindowMap* window_map();
93 }; 84 };
94 85
95 } // namespace content 86 } // namespace content
96 87
97 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITING_IOSURFACE_CONTEXT_MAC_H_ 88 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITING_IOSURFACE_CONTEXT_MAC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698