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