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

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

Issue 17447007: Change WGC3DInProcessCBImpl factories to return a base class pointer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « ui/aura/bench/bench_main.cc ('k') | ui/compositor/compositor.cc » ('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) 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 static void SetInstance(ContextFactory* instance); 75 static void SetInstance(ContextFactory* instance);
76 76
77 // Creates an output surface for the given compositor. The factory may keep 77 // 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 78 // per-compositor data (e.g. a shared context), that needs to be cleaned up
79 // by calling RemoveCompositor when the compositor gets destroyed. 79 // by calling RemoveCompositor when the compositor gets destroyed.
80 virtual cc::OutputSurface* CreateOutputSurface( 80 virtual cc::OutputSurface* CreateOutputSurface(
81 Compositor* compositor) = 0; 81 Compositor* compositor) = 0;
82 82
83 // Creates a context used for offscreen rendering. This context can be shared 83 // Creates a context used for offscreen rendering. This context can be shared
84 // with all compositors. 84 // with all compositors.
85 virtual WebKit::WebGraphicsContext3D* CreateOffscreenContext() = 0; 85 virtual scoped_ptr<WebKit::WebGraphicsContext3D> CreateOffscreenContext() = 0;
86 86
87 // Creates a reflector that copies the content of the |mirrored_compositor| 87 // Creates a reflector that copies the content of the |mirrored_compositor|
88 // onto |mirroing_layer|. 88 // onto |mirroing_layer|.
89 virtual scoped_refptr<Reflector> CreateReflector( 89 virtual scoped_refptr<Reflector> CreateReflector(
90 Compositor* mirrored_compositor, 90 Compositor* mirrored_compositor,
91 Layer* mirroring_layer) = 0; 91 Layer* mirroring_layer) = 0;
92 // Removes the reflector, which stops the mirroring. 92 // Removes the reflector, which stops the mirroring.
93 virtual void RemoveReflector(scoped_refptr<Reflector> reflector) = 0; 93 virtual void RemoveReflector(scoped_refptr<Reflector> reflector) = 0;
94 94
95 virtual scoped_refptr<cc::ContextProvider> 95 virtual scoped_refptr<cc::ContextProvider>
96 OffscreenContextProviderForMainThread() = 0; 96 OffscreenContextProviderForMainThread() = 0;
97 virtual scoped_refptr<cc::ContextProvider> 97 virtual scoped_refptr<cc::ContextProvider>
98 OffscreenContextProviderForCompositorThread() = 0; 98 OffscreenContextProviderForCompositorThread() = 0;
99 99
100 // Destroys per-compositor data. 100 // Destroys per-compositor data.
101 virtual void RemoveCompositor(Compositor* compositor) = 0; 101 virtual void RemoveCompositor(Compositor* compositor) = 0;
102 }; 102 };
103 103
104 // The default factory that creates in-process contexts. 104 // The default factory that creates in-process contexts.
105 class COMPOSITOR_EXPORT DefaultContextFactory : public ContextFactory { 105 class COMPOSITOR_EXPORT DefaultContextFactory : public ContextFactory {
106 public: 106 public:
107 DefaultContextFactory(); 107 DefaultContextFactory();
108 virtual ~DefaultContextFactory(); 108 virtual ~DefaultContextFactory();
109 109
110 // ContextFactory implementation 110 // ContextFactory implementation
111 virtual cc::OutputSurface* CreateOutputSurface( 111 virtual cc::OutputSurface* CreateOutputSurface(
112 Compositor* compositor) OVERRIDE; 112 Compositor* compositor) OVERRIDE;
113 virtual WebKit::WebGraphicsContext3D* CreateOffscreenContext() OVERRIDE; 113 virtual scoped_ptr<WebKit::WebGraphicsContext3D> CreateOffscreenContext()
114 OVERRIDE;
114 115
115 virtual scoped_refptr<Reflector> CreateReflector( 116 virtual scoped_refptr<Reflector> CreateReflector(
116 Compositor* compositor, 117 Compositor* compositor,
117 Layer* layer) OVERRIDE; 118 Layer* layer) OVERRIDE;
118 virtual void RemoveReflector(scoped_refptr<Reflector> reflector) OVERRIDE; 119 virtual void RemoveReflector(scoped_refptr<Reflector> reflector) OVERRIDE;
119 120
120 virtual scoped_refptr<cc::ContextProvider> 121 virtual scoped_refptr<cc::ContextProvider>
121 OffscreenContextProviderForMainThread() OVERRIDE; 122 OffscreenContextProviderForMainThread() OVERRIDE;
122 virtual scoped_refptr<cc::ContextProvider> 123 virtual scoped_refptr<cc::ContextProvider>
123 OffscreenContextProviderForCompositorThread() OVERRIDE; 124 OffscreenContextProviderForCompositorThread() OVERRIDE;
124 virtual void RemoveCompositor(Compositor* compositor) OVERRIDE; 125 virtual void RemoveCompositor(Compositor* compositor) OVERRIDE;
125 126
126 bool Initialize(); 127 bool Initialize();
127 128
128 private: 129 private:
129 WebKit::WebGraphicsContext3D* CreateContextCommon( 130 scoped_ptr<WebKit::WebGraphicsContext3D> CreateContextCommon(
130 Compositor* compositor, 131 Compositor* compositor,
131 bool offscreen); 132 bool offscreen);
132 133
133 scoped_refptr<ContextProviderFromContextFactory> 134 scoped_refptr<ContextProviderFromContextFactory>
134 offscreen_contexts_main_thread_; 135 offscreen_contexts_main_thread_;
135 scoped_refptr<ContextProviderFromContextFactory> 136 scoped_refptr<ContextProviderFromContextFactory>
136 offscreen_contexts_compositor_thread_; 137 offscreen_contexts_compositor_thread_;
137 138
138 DISALLOW_COPY_AND_ASSIGN(DefaultContextFactory); 139 DISALLOW_COPY_AND_ASSIGN(DefaultContextFactory);
139 }; 140 };
140 141
141 // The factory that creates test contexts. 142 // The factory that creates test contexts.
142 class COMPOSITOR_EXPORT TestContextFactory : public ContextFactory { 143 class COMPOSITOR_EXPORT TestContextFactory : public ContextFactory {
143 public: 144 public:
144 TestContextFactory(); 145 TestContextFactory();
145 virtual ~TestContextFactory(); 146 virtual ~TestContextFactory();
146 147
147 // ContextFactory implementation 148 // ContextFactory implementation
148 virtual cc::OutputSurface* CreateOutputSurface( 149 virtual cc::OutputSurface* CreateOutputSurface(
149 Compositor* compositor) OVERRIDE; 150 Compositor* compositor) OVERRIDE;
150 virtual WebKit::WebGraphicsContext3D* CreateOffscreenContext() OVERRIDE; 151 virtual scoped_ptr<WebKit::WebGraphicsContext3D> CreateOffscreenContext()
152 OVERRIDE;
151 153
152 virtual scoped_refptr<Reflector> CreateReflector( 154 virtual scoped_refptr<Reflector> CreateReflector(
153 Compositor* mirrored_compositor, 155 Compositor* mirrored_compositor,
154 Layer* mirroring_layer) OVERRIDE; 156 Layer* mirroring_layer) OVERRIDE;
155 virtual void RemoveReflector(scoped_refptr<Reflector> reflector) OVERRIDE; 157 virtual void RemoveReflector(scoped_refptr<Reflector> reflector) OVERRIDE;
156 158
157 virtual scoped_refptr<cc::ContextProvider> 159 virtual scoped_refptr<cc::ContextProvider>
158 OffscreenContextProviderForMainThread() OVERRIDE; 160 OffscreenContextProviderForMainThread() OVERRIDE;
159 virtual scoped_refptr<cc::ContextProvider> 161 virtual scoped_refptr<cc::ContextProvider>
160 OffscreenContextProviderForCompositorThread() OVERRIDE; 162 OffscreenContextProviderForCompositorThread() OVERRIDE;
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 bool disable_schedule_composite_; 455 bool disable_schedule_composite_;
454 456
455 CompositorLock* compositor_lock_; 457 CompositorLock* compositor_lock_;
456 458
457 DISALLOW_COPY_AND_ASSIGN(Compositor); 459 DISALLOW_COPY_AND_ASSIGN(Compositor);
458 }; 460 };
459 461
460 } // namespace ui 462 } // namespace ui
461 463
462 #endif // UI_COMPOSITOR_COMPOSITOR_H_ 464 #endif // UI_COMPOSITOR_COMPOSITOR_H_
OLDNEW
« no previous file with comments | « ui/aura/bench/bench_main.cc ('k') | ui/compositor/compositor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698