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

Side by Side Diff: ui/compositor/compositor.h

Issue 21026005: aura: Remove CreateOffscreenContext from ui::ContextFactory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: offscreencontext: rebase Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 UI_COMPOSITOR_COMPOSITOR_H_ 5 #ifndef UI_COMPOSITOR_COMPOSITOR_H_
6 #define UI_COMPOSITOR_COMPOSITOR_H_ 6 #define UI_COMPOSITOR_COMPOSITOR_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/containers/hash_tables.h" 10 #include "base/containers/hash_tables.h"
(...skipping 13 matching lines...) Expand all
24 24
25 class SkBitmap; 25 class SkBitmap;
26 26
27 namespace base { 27 namespace base {
28 class MessageLoopProxy; 28 class MessageLoopProxy;
29 class RunLoop; 29 class RunLoop;
30 } 30 }
31 31
32 namespace cc { 32 namespace cc {
33 class ContextProvider; 33 class ContextProvider;
34 class FakeContextProvider;
34 class Layer; 35 class Layer;
35 class LayerTreeDebugState; 36 class LayerTreeDebugState;
36 class LayerTreeHost; 37 class LayerTreeHost;
37 } 38 }
38 39
39 namespace gfx { 40 namespace gfx {
40 class GLContext; 41 class GLContext;
41 class GLSurface; 42 class GLSurface;
42 class GLShareGroup; 43 class GLShareGroup;
43 class Point; 44 class Point;
(...skipping 29 matching lines...) Expand all
73 // If this function isn't called (for tests), a "default" factory will be 74 // If this function isn't called (for tests), a "default" factory will be
74 // created on the first call of GetInstance. 75 // created on the first call of GetInstance.
75 static void SetInstance(ContextFactory* instance); 76 static void SetInstance(ContextFactory* instance);
76 77
77 // Creates an output surface for the given compositor. The factory may keep 78 // Creates an output surface for the given compositor. The factory may keep
78 // per-compositor data (e.g. a shared context), that needs to be cleaned up 79 // per-compositor data (e.g. a shared context), that needs to be cleaned up
79 // by calling RemoveCompositor when the compositor gets destroyed. 80 // by calling RemoveCompositor when the compositor gets destroyed.
80 virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface( 81 virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface(
81 Compositor* compositor) = 0; 82 Compositor* compositor) = 0;
82 83
83 // Creates a context used for offscreen rendering. This context can be shared
84 // with all compositors.
85 virtual scoped_ptr<WebKit::WebGraphicsContext3D> CreateOffscreenContext() = 0;
86
87 // Creates a reflector that copies the content of the |mirrored_compositor| 84 // Creates a reflector that copies the content of the |mirrored_compositor|
88 // onto |mirroing_layer|. 85 // onto |mirroing_layer|.
89 virtual scoped_refptr<Reflector> CreateReflector( 86 virtual scoped_refptr<Reflector> CreateReflector(
90 Compositor* mirrored_compositor, 87 Compositor* mirrored_compositor,
91 Layer* mirroring_layer) = 0; 88 Layer* mirroring_layer) = 0;
92 // Removes the reflector, which stops the mirroring. 89 // Removes the reflector, which stops the mirroring.
93 virtual void RemoveReflector(scoped_refptr<Reflector> reflector) = 0; 90 virtual void RemoveReflector(scoped_refptr<Reflector> reflector) = 0;
94 91
95 virtual scoped_refptr<cc::ContextProvider> 92 virtual scoped_refptr<cc::ContextProvider>
96 OffscreenContextProviderForMainThread() = 0; 93 OffscreenContextProviderForMainThread() = 0;
97 virtual scoped_refptr<cc::ContextProvider> 94 virtual scoped_refptr<cc::ContextProvider>
98 OffscreenContextProviderForCompositorThread() = 0; 95 OffscreenContextProviderForCompositorThread() = 0;
99 96
100 // Destroys per-compositor data. 97 // Destroys per-compositor data.
101 virtual void RemoveCompositor(Compositor* compositor) = 0; 98 virtual void RemoveCompositor(Compositor* compositor) = 0;
102 }; 99 };
103 100
104 // The default factory that creates in-process contexts. 101 // The default factory that creates in-process contexts.
105 class COMPOSITOR_EXPORT DefaultContextFactory : public ContextFactory { 102 class COMPOSITOR_EXPORT DefaultContextFactory : public ContextFactory {
106 public: 103 public:
107 DefaultContextFactory(); 104 DefaultContextFactory();
108 virtual ~DefaultContextFactory(); 105 virtual ~DefaultContextFactory();
109 106
110 // ContextFactory implementation 107 // ContextFactory implementation
111 virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface( 108 virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface(
112 Compositor* compositor) OVERRIDE; 109 Compositor* compositor) OVERRIDE;
113 virtual scoped_ptr<WebKit::WebGraphicsContext3D> CreateOffscreenContext()
114 OVERRIDE;
115 110
116 virtual scoped_refptr<Reflector> CreateReflector( 111 virtual scoped_refptr<Reflector> CreateReflector(
117 Compositor* compositor, 112 Compositor* compositor,
118 Layer* layer) OVERRIDE; 113 Layer* layer) OVERRIDE;
119 virtual void RemoveReflector(scoped_refptr<Reflector> reflector) OVERRIDE; 114 virtual void RemoveReflector(scoped_refptr<Reflector> reflector) OVERRIDE;
120 115
121 virtual scoped_refptr<cc::ContextProvider> 116 virtual scoped_refptr<cc::ContextProvider>
122 OffscreenContextProviderForMainThread() OVERRIDE; 117 OffscreenContextProviderForMainThread() OVERRIDE;
123 virtual scoped_refptr<cc::ContextProvider> 118 virtual scoped_refptr<cc::ContextProvider>
124 OffscreenContextProviderForCompositorThread() OVERRIDE; 119 OffscreenContextProviderForCompositorThread() OVERRIDE;
125 virtual void RemoveCompositor(Compositor* compositor) OVERRIDE; 120 virtual void RemoveCompositor(Compositor* compositor) OVERRIDE;
126 121
127 bool Initialize(); 122 bool Initialize();
128 123
129 private: 124 private:
130 scoped_ptr<WebKit::WebGraphicsContext3D> CreateContextCommon( 125 static scoped_ptr<WebKit::WebGraphicsContext3D> CreateContextCommon(
131 Compositor* compositor, 126 Compositor* compositor,
132 bool offscreen); 127 bool offscreen);
133 128
134 scoped_refptr<ContextProviderFromContextFactory> 129 scoped_refptr<cc::FakeContextProvider> offscreen_contexts_main_thread_;
135 offscreen_contexts_main_thread_; 130 scoped_refptr<cc::FakeContextProvider> offscreen_contexts_compositor_thread_;
136 scoped_refptr<ContextProviderFromContextFactory>
137 offscreen_contexts_compositor_thread_;
138 131
139 DISALLOW_COPY_AND_ASSIGN(DefaultContextFactory); 132 DISALLOW_COPY_AND_ASSIGN(DefaultContextFactory);
140 }; 133 };
141 134
142 // The factory that creates test contexts. 135 // The factory that creates test contexts.
143 class COMPOSITOR_EXPORT TestContextFactory : public ContextFactory { 136 class COMPOSITOR_EXPORT TestContextFactory : public ContextFactory {
144 public: 137 public:
145 TestContextFactory(); 138 TestContextFactory();
146 virtual ~TestContextFactory(); 139 virtual ~TestContextFactory();
147 140
148 // ContextFactory implementation 141 // ContextFactory implementation
149 virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface( 142 virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface(
150 Compositor* compositor) OVERRIDE; 143 Compositor* compositor) OVERRIDE;
151 virtual scoped_ptr<WebKit::WebGraphicsContext3D> CreateOffscreenContext()
152 OVERRIDE;
153 144
154 virtual scoped_refptr<Reflector> CreateReflector( 145 virtual scoped_refptr<Reflector> CreateReflector(
155 Compositor* mirrored_compositor, 146 Compositor* mirrored_compositor,
156 Layer* mirroring_layer) OVERRIDE; 147 Layer* mirroring_layer) OVERRIDE;
157 virtual void RemoveReflector(scoped_refptr<Reflector> reflector) OVERRIDE; 148 virtual void RemoveReflector(scoped_refptr<Reflector> reflector) OVERRIDE;
158 149
159 virtual scoped_refptr<cc::ContextProvider> 150 virtual scoped_refptr<cc::ContextProvider>
160 OffscreenContextProviderForMainThread() OVERRIDE; 151 OffscreenContextProviderForMainThread() OVERRIDE;
161 virtual scoped_refptr<cc::ContextProvider> 152 virtual scoped_refptr<cc::ContextProvider>
162 OffscreenContextProviderForCompositorThread() OVERRIDE; 153 OffscreenContextProviderForCompositorThread() OVERRIDE;
163 virtual void RemoveCompositor(Compositor* compositor) OVERRIDE; 154 virtual void RemoveCompositor(Compositor* compositor) OVERRIDE;
164 155
165 private: 156 private:
166 scoped_refptr<ContextProviderFromContextFactory> 157 static scoped_ptr<WebKit::WebGraphicsContext3D> CreateOffscreenContext();
167 offscreen_contexts_main_thread_; 158
168 scoped_refptr<ContextProviderFromContextFactory> 159 scoped_refptr<cc::FakeContextProvider> offscreen_contexts_main_thread_;
169 offscreen_contexts_compositor_thread_; 160 scoped_refptr<cc::ContextProvider> offscreen_contexts_compositor_thread_;
170 161
171 DISALLOW_COPY_AND_ASSIGN(TestContextFactory); 162 DISALLOW_COPY_AND_ASSIGN(TestContextFactory);
172 }; 163 };
173 164
174 // Texture provide an abstraction over the external texture that can be passed 165 // Texture provide an abstraction over the external texture that can be passed
175 // to a layer. 166 // to a layer.
176 class COMPOSITOR_EXPORT Texture : public base::RefCounted<Texture> { 167 class COMPOSITOR_EXPORT Texture : public base::RefCounted<Texture> {
177 public: 168 public:
178 Texture(bool flipped, const gfx::Size& size, float device_scale_factor); 169 Texture(bool flipped, const gfx::Size& size, float device_scale_factor);
179 170
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 bool disable_schedule_composite_; 431 bool disable_schedule_composite_;
441 432
442 CompositorLock* compositor_lock_; 433 CompositorLock* compositor_lock_;
443 434
444 DISALLOW_COPY_AND_ASSIGN(Compositor); 435 DISALLOW_COPY_AND_ASSIGN(Compositor);
445 }; 436 };
446 437
447 } // namespace ui 438 } // namespace ui
448 439
449 #endif // UI_COMPOSITOR_COMPOSITOR_H_ 440 #endif // UI_COMPOSITOR_COMPOSITOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698