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 30 matching lines...) Expand all Loading... |
41 virtual ~ContextFactory() {} | 41 virtual ~ContextFactory() {} |
42 | 42 |
43 // Gets the global instance. | 43 // Gets the global instance. |
44 static ContextFactory* GetInstance(); | 44 static ContextFactory* GetInstance(); |
45 | 45 |
46 // Sets the global instance. Caller keeps ownership. | 46 // Sets the global instance. Caller keeps ownership. |
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 an output surface for the given compositor. The factory may keep |
52 // data (e.g. a shared context), that needs to be cleaned up by calling | 52 // per-compositor data (e.g. a shared context), that needs to be cleaned up |
53 // RemoveCompositor when the compositor gets destroyed. | 53 // by calling RemoveCompositor when the compositor gets destroyed. |
54 virtual WebKit::WebGraphicsContext3D* CreateContext( | 54 virtual WebKit::WebCompositorOutputSurface* CreateOutputSurface( |
55 Compositor* compositor) = 0; | 55 Compositor* compositor) = 0; |
56 | 56 |
57 // Creates a context used for offscreen rendering. This context can be shared | 57 // Creates a context used for offscreen rendering. This context can be shared |
58 // with all compositors. | 58 // with all compositors. |
59 virtual WebKit::WebGraphicsContext3D* CreateOffscreenContext() = 0; | 59 virtual WebKit::WebGraphicsContext3D* CreateOffscreenContext() = 0; |
60 | 60 |
61 // Destroys per-compositor data. | 61 // Destroys per-compositor data. |
62 virtual void RemoveCompositor(Compositor* compositor) = 0; | 62 virtual void RemoveCompositor(Compositor* compositor) = 0; |
63 }; | 63 }; |
64 | 64 |
65 // The default factory that creates in-process contexts. | 65 // The default factory that creates in-process contexts. |
66 class COMPOSITOR_EXPORT DefaultContextFactory : public ContextFactory { | 66 class COMPOSITOR_EXPORT DefaultContextFactory : public ContextFactory { |
67 public: | 67 public: |
68 DefaultContextFactory(); | 68 DefaultContextFactory(); |
69 virtual ~DefaultContextFactory(); | 69 virtual ~DefaultContextFactory(); |
70 | 70 |
71 // ContextFactory implementation | 71 // ContextFactory implementation |
72 virtual WebKit::WebGraphicsContext3D* CreateContext( | 72 virtual WebKit::WebCompositorOutputSurface* CreateOutputSurface( |
73 Compositor* compositor) OVERRIDE; | 73 Compositor* compositor) OVERRIDE; |
74 virtual WebKit::WebGraphicsContext3D* CreateOffscreenContext() OVERRIDE; | 74 virtual WebKit::WebGraphicsContext3D* CreateOffscreenContext() OVERRIDE; |
75 virtual void RemoveCompositor(Compositor* compositor) OVERRIDE; | 75 virtual void RemoveCompositor(Compositor* compositor) OVERRIDE; |
76 | 76 |
77 bool Initialize(); | 77 bool Initialize(); |
78 | 78 |
79 void set_share_group(gfx::GLShareGroup* share_group) { | 79 void set_share_group(gfx::GLShareGroup* share_group) { |
80 share_group_ = share_group; | 80 share_group_ = share_group; |
81 } | 81 } |
82 | 82 |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 bool disable_schedule_composite_; | 294 bool disable_schedule_composite_; |
295 | 295 |
296 CompositorLock* compositor_lock_; | 296 CompositorLock* compositor_lock_; |
297 | 297 |
298 DISALLOW_COPY_AND_ASSIGN(Compositor); | 298 DISALLOW_COPY_AND_ASSIGN(Compositor); |
299 }; | 299 }; |
300 | 300 |
301 } // namespace ui | 301 } // namespace ui |
302 | 302 |
303 #endif // UI_COMPOSITOR_COMPOSITOR_H_ | 303 #endif // UI_COMPOSITOR_COMPOSITOR_H_ |
OLD | NEW |