OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 CC_LAYER_TREE_HOST_CLIENT_H_ | 5 #ifndef CC_LAYER_TREE_HOST_CLIENT_H_ |
6 #define CC_LAYER_TREE_HOST_CLIENT_H_ | 6 #define CC_LAYER_TREE_HOST_CLIENT_H_ |
7 | 7 |
| 8 #include <utility> |
| 9 |
8 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
9 | 11 |
| 12 class GrContext; |
| 13 |
10 namespace gfx { | 14 namespace gfx { |
11 class Vector2d; | 15 class Vector2d; |
12 } | 16 } |
13 | 17 |
| 18 namespace WebKit { |
| 19 class WebGraphicsContext3D; |
| 20 } |
| 21 |
14 namespace cc { | 22 namespace cc { |
15 class FontAtlas; | 23 class FontAtlas; |
16 class InputHandler; | 24 class InputHandler; |
17 class OutputSurface; | 25 class OutputSurface; |
18 | 26 |
19 class LayerTreeHostClient { | 27 class LayerTreeHostClient { |
20 public: | 28 public: |
21 virtual void willBeginFrame() = 0; | 29 virtual void willBeginFrame() = 0; |
22 // Marks finishing compositing-related tasks on the main thread. In threaded
mode, this corresponds to didCommit(). | 30 // Marks finishing compositing-related tasks on the main thread. In threaded
mode, this corresponds to didCommit(). |
23 virtual void didBeginFrame() = 0; | 31 virtual void didBeginFrame() = 0; |
24 virtual void animate(double frameBeginTime) = 0; | 32 virtual void animate(double frameBeginTime) = 0; |
25 virtual void layout() = 0; | 33 virtual void layout() = 0; |
26 virtual void applyScrollAndScale(gfx::Vector2d scrollDelta, float pageScale)
= 0; | 34 virtual void applyScrollAndScale(gfx::Vector2d scrollDelta, float pageScale)
= 0; |
27 virtual scoped_ptr<OutputSurface> createOutputSurface() = 0; | 35 virtual scoped_ptr<OutputSurface> createOutputSurface() = 0; |
28 virtual void didRecreateOutputSurface(bool success) = 0; | 36 virtual void didRecreateOutputSurface(bool success) = 0; |
| 37 // This method should create a context if needed, but only one context shoul
d |
| 38 // ever be created by the client to return from this method. |
| 39 virtual WebKit::WebGraphicsContext3D* offscreenContext3dForMainThread() = 0; |
| 40 // This method should create a context if needed, but only one context shoul
d |
| 41 // ever be created by the client to return from this method. |
| 42 virtual WebKit::WebGraphicsContext3D* offscreenContext3dForCompositorThread(
) = 0; |
| 43 // This method should create a context if needed, but only one context shoul
d |
| 44 // ever be created by the client to return from this method. |
| 45 virtual GrContext* offscreenGrContextForMainThread() = 0; |
| 46 // This method should create a context if needed, but only one context shoul
d |
| 47 // ever be created by the client to return from this method. |
| 48 virtual GrContext* offscreenGrContextForCompositorThread() = 0; |
29 virtual scoped_ptr<InputHandler> createInputHandler() = 0; | 49 virtual scoped_ptr<InputHandler> createInputHandler() = 0; |
30 virtual void willCommit() = 0; | 50 virtual void willCommit() = 0; |
31 virtual void didCommit() = 0; | 51 virtual void didCommit() = 0; |
32 virtual void didCommitAndDrawFrame() = 0; | 52 virtual void didCommitAndDrawFrame() = 0; |
33 virtual void didCompleteSwapBuffers() = 0; | 53 virtual void didCompleteSwapBuffers() = 0; |
34 | 54 |
35 // Used only in the single-threaded path. | 55 // Used only in the single-threaded path. |
36 virtual void scheduleComposite() = 0; | 56 virtual void scheduleComposite() = 0; |
37 | 57 |
38 // Creates a font atlas to use for debug visualizations. | 58 // Creates a font atlas to use for debug visualizations. |
39 virtual scoped_ptr<FontAtlas> createFontAtlas() = 0; | 59 virtual scoped_ptr<FontAtlas> createFontAtlas() = 0; |
40 | 60 |
| 61 // This hook is for testing. |
| 62 virtual void willRetryRecreateOutputSurface() {} |
| 63 |
41 protected: | 64 protected: |
42 virtual ~LayerTreeHostClient() { } | 65 virtual ~LayerTreeHostClient() { } |
43 }; | 66 }; |
44 | 67 |
45 } | 68 } |
46 | 69 |
47 #endif // CC_LAYER_TREE_HOST_CLIENT_H_ | 70 #endif // CC_LAYER_TREE_HOST_CLIENT_H_ |
OLD | NEW |