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

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

Issue 478483002: Remove code used by --disable-delegated-renderer on Mac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 4 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/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 class CompositingIOSurfaceShaderPrograms;
23
24 class CompositingIOSurfaceContext 22 class CompositingIOSurfaceContext
25 : public base::RefCounted<CompositingIOSurfaceContext>, 23 : public base::RefCounted<CompositingIOSurfaceContext>,
26 public content::GpuDataManagerObserver { 24 public content::GpuDataManagerObserver {
27 public: 25 public:
28 enum { 26 enum {
29 // The number used to look up the context used for async readback and for 27 // The number used to look up the context used for async readback and for
30 // initializing the IOSurface. 28 // initializing the IOSurface.
31 kOffscreenContextWindowNumber = -2, 29 kOffscreenContextWindowNumber = -2,
32 // The number used to look up the context used by CAOpenGLLayers. 30 // The number used to look up the context used by CAOpenGLLayers.
33 kCALayerContextWindowNumber = -3, 31 kCALayerContextWindowNumber = -3,
34 }; 32 };
35 33
36 // Get or create a GL context for the specified window with the specified 34 // Get or create a GL context for the specified window with the specified
37 // surface ordering. Share these GL contexts as much as possible because 35 // surface ordering. Share these GL contexts as much as possible because
38 // creating and destroying them can be expensive 36 // creating and destroying them can be expensive
39 // http://crbug.com/180463 37 // http://crbug.com/180463
40 static scoped_refptr<CompositingIOSurfaceContext> Get(int window_number); 38 static scoped_refptr<CompositingIOSurfaceContext> Get(int window_number);
41 39
42 // Mark that all the GL contexts in the same sharegroup as this context as 40 // Mark that all the GL contexts in the same sharegroup as this context as
43 // invalid, so they shouldn't be returned anymore by Get, but rather, new 41 // 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 42 // contexts should be created. This is called as a precaution when unexpected
45 // GL errors occur. 43 // GL errors occur.
46 void PoisonContextAndSharegroup(); 44 void PoisonContextAndSharegroup();
47 bool HasBeenPoisoned() const { return poisoned_; } 45 bool HasBeenPoisoned() const { return poisoned_; }
48 46
49 CompositingIOSurfaceShaderPrograms* shader_program_cache() const {
50 return shader_program_cache_.get();
51 }
52 CGLContextObj cgl_context() const { return cgl_context_; } 47 CGLContextObj cgl_context() const { return cgl_context_; }
53 int window_number() const { return window_number_; } 48 int window_number() const { return window_number_; }
54 49
55 // content::GpuDataManagerObserver implementation. 50 // content::GpuDataManagerObserver implementation.
56 virtual void OnGpuSwitching() OVERRIDE; 51 virtual void OnGpuSwitching() OVERRIDE;
57 52
58 private: 53 private:
59 friend class base::RefCounted<CompositingIOSurfaceContext>; 54 friend class base::RefCounted<CompositingIOSurfaceContext>;
60 55
61 CompositingIOSurfaceContext( 56 CompositingIOSurfaceContext(
62 int window_number, 57 int window_number,
63 base::ScopedTypeRef<CGLContextObj> clg_context_strong, 58 base::ScopedTypeRef<CGLContextObj> clg_context_strong,
64 CGLContextObj clg_context, 59 CGLContextObj clg_context);
65 scoped_ptr<CompositingIOSurfaceShaderPrograms> shader_program_cache);
66 virtual ~CompositingIOSurfaceContext(); 60 virtual ~CompositingIOSurfaceContext();
67 61
68 int window_number_; 62 int window_number_;
69 base::ScopedTypeRef<CGLContextObj> cgl_context_strong_; 63 base::ScopedTypeRef<CGLContextObj> cgl_context_strong_;
70 // Weak, backed by |cgl_context_strong_|. 64 // Weak, backed by |cgl_context_strong_|.
71 CGLContextObj cgl_context_; 65 CGLContextObj cgl_context_;
72 66
73 scoped_ptr<CompositingIOSurfaceShaderPrograms> shader_program_cache_;
74 bool poisoned_; 67 bool poisoned_;
75 68
76 // The global map from window number and window ordering to 69 // The global map from window number and window ordering to
77 // context data. 70 // context data.
78 typedef std::map<int, CompositingIOSurfaceContext*> WindowMap; 71 typedef std::map<int, CompositingIOSurfaceContext*> WindowMap;
79 static base::LazyInstance<WindowMap> window_map_; 72 static base::LazyInstance<WindowMap> window_map_;
80 static WindowMap* window_map(); 73 static WindowMap* window_map();
81 }; 74 };
82 75
83 } // namespace content 76 } // namespace content
84 77
85 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITING_IOSURFACE_CONTEXT_MAC_H_ 78 #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