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_TREES_LAYER_TREE_HOST_CLIENT_H_ | 5 #ifndef CC_TREES_LAYER_TREE_HOST_CLIENT_H_ |
6 #define CC_TREES_LAYER_TREE_HOST_CLIENT_H_ | 6 #define CC_TREES_LAYER_TREE_HOST_CLIENT_H_ |
7 | 7 |
| 8 #include <utility> |
| 9 #include <vector> |
| 10 |
8 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
10 #include "base/time/time.h" | 13 #include "base/time/time.h" |
11 | 14 |
12 namespace gfx { | 15 namespace gfx { |
13 class Vector2d; | 16 class Vector2d; |
14 } | 17 } |
15 | 18 |
16 namespace cc { | 19 namespace cc { |
17 class ContextProvider; | 20 class ContextProvider; |
18 class InputHandlerClient; | 21 class InputHandlerClient; |
19 class OutputSurface; | 22 class OutputSurface; |
20 | 23 |
21 class LayerTreeHostClient { | 24 class LayerTreeHostClient { |
22 public: | 25 public: |
23 virtual void WillBeginMainFrame(int frame_id) = 0; | 26 virtual void WillBeginMainFrame(int frame_id) = 0; |
24 // Marks finishing compositing-related tasks on the main thread. In threaded | 27 // Marks finishing compositing-related tasks on the main thread. In threaded |
25 // mode, this corresponds to DidCommit(). | 28 // mode, this corresponds to DidCommit(). |
26 virtual void DidBeginMainFrame() = 0; | 29 virtual void DidBeginMainFrame() = 0; |
27 virtual void Animate(base::TimeTicks frame_begin_time) = 0; | 30 virtual void Animate(base::TimeTicks frame_begin_time) = 0; |
28 virtual void Layout() = 0; | 31 virtual void Layout() = 0; |
29 virtual void ApplyScrollAndScale(const gfx::Vector2d& scroll_delta, | 32 virtual void ApplyScrollAndScale(const gfx::Vector2d& scroll_delta, |
30 float page_scale) = 0; | 33 float page_scale) = 0; |
| 34 virtual void RecordDrawTiming(int64_t rect_id, |
| 35 const std::vector<std::pair<int, base::TimeTicks> >& draws) = 0; |
31 // Creates an OutputSurface. If fallback is true, it should attempt to | 36 // Creates an OutputSurface. If fallback is true, it should attempt to |
32 // create an OutputSurface that is guaranteed to initialize correctly. | 37 // create an OutputSurface that is guaranteed to initialize correctly. |
33 virtual scoped_ptr<OutputSurface> CreateOutputSurface(bool fallback) = 0; | 38 virtual scoped_ptr<OutputSurface> CreateOutputSurface(bool fallback) = 0; |
34 virtual void DidInitializeOutputSurface() = 0; | 39 virtual void DidInitializeOutputSurface() = 0; |
35 virtual void WillCommit() = 0; | 40 virtual void WillCommit() = 0; |
36 virtual void DidCommit() = 0; | 41 virtual void DidCommit() = 0; |
37 virtual void DidCommitAndDrawFrame() = 0; | 42 virtual void DidCommitAndDrawFrame() = 0; |
38 virtual void DidCompleteSwapBuffers() = 0; | 43 virtual void DidCompleteSwapBuffers() = 0; |
39 | 44 |
40 // Requests that the client insert a rate limiting token in the shared main | 45 // Requests that the client insert a rate limiting token in the shared main |
41 // thread context's command stream that will block if the context gets too far | 46 // thread context's command stream that will block if the context gets too far |
42 // ahead of the compositor's command stream. Only needed if the tree contains | 47 // ahead of the compositor's command stream. Only needed if the tree contains |
43 // a TextureLayer that calls SetRateLimitContext(true). | 48 // a TextureLayer that calls SetRateLimitContext(true). |
44 virtual void RateLimitSharedMainThreadContext() {} | 49 virtual void RateLimitSharedMainThreadContext() {} |
45 | 50 |
46 // This hook is for testing. | 51 // This hook is for testing. |
47 virtual void DidFailToInitializeOutputSurface() {} | 52 virtual void DidFailToInitializeOutputSurface() {} |
48 | 53 |
49 protected: | 54 protected: |
50 virtual ~LayerTreeHostClient() {} | 55 virtual ~LayerTreeHostClient() {} |
51 }; | 56 }; |
52 | 57 |
53 } // namespace cc | 58 } // namespace cc |
54 | 59 |
55 #endif // CC_TREES_LAYER_TREE_HOST_CLIENT_H_ | 60 #endif // CC_TREES_LAYER_TREE_HOST_CLIENT_H_ |
OLD | NEW |