OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CC_TREES_LAYER_TREE_HOST_CLIENT_H_ | |
6 #define CC_TREES_LAYER_TREE_HOST_CLIENT_H_ | |
7 | |
8 #include "base/memory/ref_counted.h" | |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "base/time/time.h" | |
11 | |
12 namespace gfx { | |
13 class Vector2d; | |
14 class Vector2dF; | |
15 } | |
16 | |
17 namespace cc { | |
18 class ContextProvider; | |
19 class InputHandlerClient; | |
20 class OutputSurface; | |
21 struct BeginFrameArgs; | |
22 | |
23 class LayerTreeHostClient { | |
24 public: | |
25 virtual void WillBeginMainFrame() = 0; | |
26 // Marks finishing compositing-related tasks on the main thread. In threaded | |
27 // mode, this corresponds to DidCommit(). | |
28 virtual void BeginMainFrame(const BeginFrameArgs& args) = 0; | |
29 virtual void BeginMainFrameNotExpectedSoon() = 0; | |
30 virtual void DidBeginMainFrame() = 0; | |
31 virtual void Layout() = 0; | |
32 virtual void ApplyViewportDeltas( | |
33 const gfx::Vector2dF& inner_delta, | |
34 const gfx::Vector2dF& outer_delta, | |
35 const gfx::Vector2dF& elastic_overscroll_delta, | |
36 float page_scale, | |
37 float top_controls_delta) = 0; | |
38 virtual void ApplyViewportDeltas(const gfx::Vector2d& scroll_delta, | |
39 float page_scale, | |
40 float top_controls_delta) = 0; | |
41 // Request an OutputSurface from the client. When the client has one it should | |
42 // call LayerTreeHost::SetOutputSurface. This will result in either | |
43 // DidFailToInitializeOutputSurface or DidInitializeOutputSurface being | |
44 // called. | |
45 virtual void RequestNewOutputSurface() = 0; | |
46 virtual void DidInitializeOutputSurface() = 0; | |
47 virtual void DidFailToInitializeOutputSurface() = 0; | |
48 virtual void WillCommit() = 0; | |
49 virtual void DidCommit() = 0; | |
50 virtual void DidCommitAndDrawFrame() = 0; | |
51 virtual void DidCompleteSwapBuffers() = 0; | |
52 | |
53 // Called when page scale animation has completed. | |
54 virtual void DidCompletePageScaleAnimation() = 0; | |
55 | |
56 // TODO(simonhong): Makes this to pure virtual function when client | |
57 // implementation is ready. | |
58 virtual void SendBeginFramesToChildren(const BeginFrameArgs& args) {} | |
59 | |
60 // Requests that the client insert a rate limiting token in the shared main | |
61 // thread context's command stream that will block if the context gets too far | |
62 // ahead of the compositor's command stream. Only needed if the tree contains | |
63 // a TextureLayer that calls SetRateLimitContext(true). | |
64 virtual void RateLimitSharedMainThreadContext() {} | |
65 | |
66 protected: | |
67 virtual ~LayerTreeHostClient() {} | |
68 }; | |
69 | |
70 } // namespace cc | |
71 | |
72 #endif // CC_TREES_LAYER_TREE_HOST_CLIENT_H_ | |
OLD | NEW |