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