| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 static ContextFactory* GetInstance(); | 53 static ContextFactory* GetInstance(); |
| 54 | 54 |
| 55 // Sets the global instance. Caller keeps ownership. | 55 // Sets the global instance. Caller keeps ownership. |
| 56 // If this function isn't called (for tests), a "default" factory will be | 56 // If this function isn't called (for tests), a "default" factory will be |
| 57 // created on the first call of GetInstance. | 57 // created on the first call of GetInstance. |
| 58 static void SetInstance(ContextFactory* instance); | 58 static void SetInstance(ContextFactory* instance); |
| 59 | 59 |
| 60 // Creates an output surface for the given compositor. The factory may keep | 60 // Creates an output surface for the given compositor. The factory may keep |
| 61 // per-compositor data (e.g. a shared context), that needs to be cleaned up | 61 // per-compositor data (e.g. a shared context), that needs to be cleaned up |
| 62 // by calling RemoveCompositor when the compositor gets destroyed. | 62 // by calling RemoveCompositor when the compositor gets destroyed. |
| 63 virtual WebKit::WebCompositorOutputSurface* CreateOutputSurface( | 63 virtual cc::OutputSurface* CreateOutputSurface( |
| 64 Compositor* compositor) = 0; | 64 Compositor* compositor) = 0; |
| 65 | 65 |
| 66 // Creates a context used for offscreen rendering. This context can be shared | 66 // Creates a context used for offscreen rendering. This context can be shared |
| 67 // with all compositors. | 67 // with all compositors. |
| 68 virtual WebKit::WebGraphicsContext3D* CreateOffscreenContext() = 0; | 68 virtual WebKit::WebGraphicsContext3D* CreateOffscreenContext() = 0; |
| 69 | 69 |
| 70 // Destroys per-compositor data. | 70 // Destroys per-compositor data. |
| 71 virtual void RemoveCompositor(Compositor* compositor) = 0; | 71 virtual void RemoveCompositor(Compositor* compositor) = 0; |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 // The default factory that creates in-process contexts. | 74 // The default factory that creates in-process contexts. |
| 75 class COMPOSITOR_EXPORT DefaultContextFactory : public ContextFactory { | 75 class COMPOSITOR_EXPORT DefaultContextFactory : public ContextFactory { |
| 76 public: | 76 public: |
| 77 DefaultContextFactory(); | 77 DefaultContextFactory(); |
| 78 virtual ~DefaultContextFactory(); | 78 virtual ~DefaultContextFactory(); |
| 79 | 79 |
| 80 // ContextFactory implementation | 80 // ContextFactory implementation |
| 81 virtual WebKit::WebCompositorOutputSurface* CreateOutputSurface( | 81 virtual cc::OutputSurface* CreateOutputSurface( |
| 82 Compositor* compositor) OVERRIDE; | 82 Compositor* compositor) OVERRIDE; |
| 83 virtual WebKit::WebGraphicsContext3D* CreateOffscreenContext() OVERRIDE; | 83 virtual WebKit::WebGraphicsContext3D* CreateOffscreenContext() OVERRIDE; |
| 84 virtual void RemoveCompositor(Compositor* compositor) OVERRIDE; | 84 virtual void RemoveCompositor(Compositor* compositor) OVERRIDE; |
| 85 | 85 |
| 86 bool Initialize(); | 86 bool Initialize(); |
| 87 | 87 |
| 88 void set_share_group(gfx::GLShareGroup* share_group) { | 88 void set_share_group(gfx::GLShareGroup* share_group) { |
| 89 share_group_ = share_group; | 89 share_group_ = share_group; |
| 90 } | 90 } |
| 91 | 91 |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 // Signals swap has aborted (e.g. lost context). | 243 // Signals swap has aborted (e.g. lost context). |
| 244 void OnSwapBuffersAborted(); | 244 void OnSwapBuffersAborted(); |
| 245 | 245 |
| 246 // LayerTreeHostClient implementation. | 246 // LayerTreeHostClient implementation. |
| 247 virtual void willBeginFrame() OVERRIDE; | 247 virtual void willBeginFrame() OVERRIDE; |
| 248 virtual void didBeginFrame() OVERRIDE; | 248 virtual void didBeginFrame() OVERRIDE; |
| 249 virtual void animate(double frameBeginTime) OVERRIDE; | 249 virtual void animate(double frameBeginTime) OVERRIDE; |
| 250 virtual void layout() OVERRIDE; | 250 virtual void layout() OVERRIDE; |
| 251 virtual void applyScrollAndScale(gfx::Vector2d scrollDelta, | 251 virtual void applyScrollAndScale(gfx::Vector2d scrollDelta, |
| 252 float pageScale) OVERRIDE; | 252 float pageScale) OVERRIDE; |
| 253 virtual scoped_ptr<WebKit::WebCompositorOutputSurface> | 253 virtual scoped_ptr<cc::OutputSurface> |
| 254 createOutputSurface() OVERRIDE; | 254 createOutputSurface() OVERRIDE; |
| 255 virtual void didRecreateOutputSurface(bool success) OVERRIDE; | 255 virtual void didRecreateOutputSurface(bool success) OVERRIDE; |
| 256 virtual scoped_ptr<cc::InputHandler> createInputHandler() OVERRIDE; | 256 virtual scoped_ptr<cc::InputHandler> createInputHandler() OVERRIDE; |
| 257 virtual void willCommit() OVERRIDE; | 257 virtual void willCommit() OVERRIDE; |
| 258 virtual void didCommit() OVERRIDE; | 258 virtual void didCommit() OVERRIDE; |
| 259 virtual void didCommitAndDrawFrame() OVERRIDE; | 259 virtual void didCommitAndDrawFrame() OVERRIDE; |
| 260 virtual void didCompleteSwapBuffers() OVERRIDE; | 260 virtual void didCompleteSwapBuffers() OVERRIDE; |
| 261 virtual void scheduleComposite() OVERRIDE; | 261 virtual void scheduleComposite() OVERRIDE; |
| 262 virtual scoped_ptr<cc::FontAtlas> createFontAtlas() OVERRIDE; | 262 virtual scoped_ptr<cc::FontAtlas> createFontAtlas() OVERRIDE; |
| 263 | 263 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 bool disable_schedule_composite_; | 305 bool disable_schedule_composite_; |
| 306 | 306 |
| 307 CompositorLock* compositor_lock_; | 307 CompositorLock* compositor_lock_; |
| 308 | 308 |
| 309 DISALLOW_COPY_AND_ASSIGN(Compositor); | 309 DISALLOW_COPY_AND_ASSIGN(Compositor); |
| 310 }; | 310 }; |
| 311 | 311 |
| 312 } // namespace ui | 312 } // namespace ui |
| 313 | 313 |
| 314 #endif // UI_COMPOSITOR_COMPOSITOR_H_ | 314 #endif // UI_COMPOSITOR_COMPOSITOR_H_ |
| OLD | NEW |