OLD | NEW |
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 "base/hash_tables.h" | 8 #include "base/hash_tables.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 // If this function isn't called (for tests), a "default" factory will be | 47 // If this function isn't called (for tests), a "default" factory will be |
48 // created on the first call of GetInstance. | 48 // created on the first call of GetInstance. |
49 static void SetInstance(ContextFactory* instance); | 49 static void SetInstance(ContextFactory* instance); |
50 | 50 |
51 // Creates a context for given compositor. The factory may keep per-compositor | 51 // Creates a context for given compositor. The factory may keep per-compositor |
52 // data (e.g. a shared context), that needs to be cleaned up by calling | 52 // data (e.g. a shared context), that needs to be cleaned up by calling |
53 // RemoveCompositor when the compositor gets destroyed. | 53 // RemoveCompositor when the compositor gets destroyed. |
54 virtual WebKit::WebGraphicsContext3D* CreateContext( | 54 virtual WebKit::WebGraphicsContext3D* CreateContext( |
55 Compositor* compositor) = 0; | 55 Compositor* compositor) = 0; |
56 | 56 |
| 57 // Creates an output surface for the given compositor. The factory may keep |
| 58 // per-compositor data (e.g. a shared context), that needs to be cleaned up |
| 59 // by calling RemoveCompositor when the compositor gets destroyed. |
| 60 virtual WebKit::WebCompositorOutputSurface* CreateOutputSurface( |
| 61 Compositor* compositor) = 0; |
| 62 |
57 // Creates a context used for offscreen rendering. This context can be shared | 63 // Creates a context used for offscreen rendering. This context can be shared |
58 // with all compositors. | 64 // with all compositors. |
59 virtual WebKit::WebGraphicsContext3D* CreateOffscreenContext() = 0; | 65 virtual WebKit::WebGraphicsContext3D* CreateOffscreenContext() = 0; |
60 | 66 |
61 // Destroys per-compositor data. | 67 // Destroys per-compositor data. |
62 virtual void RemoveCompositor(Compositor* compositor) = 0; | 68 virtual void RemoveCompositor(Compositor* compositor) = 0; |
63 }; | 69 }; |
64 | 70 |
65 // The default factory that creates in-process contexts. | 71 // The default factory that creates in-process contexts. |
66 class COMPOSITOR_EXPORT DefaultContextFactory : public ContextFactory { | 72 class COMPOSITOR_EXPORT DefaultContextFactory : public ContextFactory { |
67 public: | 73 public: |
68 DefaultContextFactory(); | 74 DefaultContextFactory(); |
69 virtual ~DefaultContextFactory(); | 75 virtual ~DefaultContextFactory(); |
70 | 76 |
71 // ContextFactory implementation | 77 // ContextFactory implementation |
72 virtual WebKit::WebGraphicsContext3D* CreateContext( | 78 virtual WebKit::WebGraphicsContext3D* CreateContext( |
73 Compositor* compositor) OVERRIDE; | 79 Compositor* compositor) OVERRIDE; |
| 80 virtual WebKit::WebCompositorOutputSurface* CreateOutputSurface( |
| 81 Compositor* compositor) OVERRIDE; |
74 virtual WebKit::WebGraphicsContext3D* CreateOffscreenContext() OVERRIDE; | 82 virtual WebKit::WebGraphicsContext3D* CreateOffscreenContext() OVERRIDE; |
75 virtual void RemoveCompositor(Compositor* compositor) OVERRIDE; | 83 virtual void RemoveCompositor(Compositor* compositor) OVERRIDE; |
76 | 84 |
77 bool Initialize(); | 85 bool Initialize(); |
78 | 86 |
79 void set_share_group(gfx::GLShareGroup* share_group) { | 87 void set_share_group(gfx::GLShareGroup* share_group) { |
80 share_group_ = share_group; | 88 share_group_ = share_group; |
81 } | 89 } |
82 | 90 |
83 private: | 91 private: |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 int last_ended_frame_; | 265 int last_ended_frame_; |
258 | 266 |
259 bool disable_schedule_composite_; | 267 bool disable_schedule_composite_; |
260 | 268 |
261 DISALLOW_COPY_AND_ASSIGN(Compositor); | 269 DISALLOW_COPY_AND_ASSIGN(Compositor); |
262 }; | 270 }; |
263 | 271 |
264 } // namespace ui | 272 } // namespace ui |
265 | 273 |
266 #endif // UI_COMPOSITOR_COMPOSITOR_H_ | 274 #endif // UI_COMPOSITOR_COMPOSITOR_H_ |
OLD | NEW |