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 struct BeginFrameArgs; | 23 struct BeginFrameArgs; |
21 | 24 |
22 class LayerTreeHostClient { | 25 class LayerTreeHostClient { |
23 public: | 26 public: |
24 virtual void WillBeginMainFrame(int frame_id) = 0; | 27 virtual void WillBeginMainFrame(int frame_id) = 0; |
25 // Marks finishing compositing-related tasks on the main thread. In threaded | 28 // Marks finishing compositing-related tasks on the main thread. In threaded |
26 // mode, this corresponds to DidCommit(). | 29 // mode, this corresponds to DidCommit(). |
27 virtual void BeginMainFrame(const BeginFrameArgs& args) = 0; | 30 virtual void BeginMainFrame(const BeginFrameArgs& args) = 0; |
28 virtual void DidBeginMainFrame() = 0; | 31 virtual void DidBeginMainFrame() = 0; |
29 virtual void Layout() = 0; | 32 virtual void Layout() = 0; |
30 virtual void ApplyViewportDeltas(const gfx::Vector2d& scroll_delta, | 33 virtual void ApplyViewportDeltas(const gfx::Vector2d& scroll_delta, |
31 float page_scale, | 34 float page_scale, |
32 float top_controls_delta) = 0; | 35 float top_controls_delta) = 0; |
| 36 virtual void RecordCommitTiming( |
| 37 int64_t rect_id, |
| 38 const std::pair<int, base::TimeTicks>& commit) = 0; |
| 39 virtual void RecordCompositeTiming( |
| 40 int64_t rect_id, |
| 41 const std::vector<std::pair<int, base::TimeTicks> >& composites) = 0; |
33 // Creates an OutputSurface. If fallback is true, it should attempt to | 42 // Creates an OutputSurface. If fallback is true, it should attempt to |
34 // create an OutputSurface that is guaranteed to initialize correctly. | 43 // create an OutputSurface that is guaranteed to initialize correctly. |
35 virtual scoped_ptr<OutputSurface> CreateOutputSurface(bool fallback) = 0; | 44 virtual scoped_ptr<OutputSurface> CreateOutputSurface(bool fallback) = 0; |
36 virtual void DidInitializeOutputSurface() = 0; | 45 virtual void DidInitializeOutputSurface() = 0; |
37 virtual void WillCommit() = 0; | 46 virtual void WillCommit() = 0; |
38 virtual void DidCommit() = 0; | 47 virtual void DidCommit() = 0; |
39 virtual void DidCommitAndDrawFrame() = 0; | 48 virtual void DidCommitAndDrawFrame() = 0; |
40 virtual void DidCompleteSwapBuffers() = 0; | 49 virtual void DidCompleteSwapBuffers() = 0; |
41 | 50 |
42 // Requests that the client insert a rate limiting token in the shared main | 51 // Requests that the client insert a rate limiting token in the shared main |
43 // thread context's command stream that will block if the context gets too far | 52 // thread context's command stream that will block if the context gets too far |
44 // ahead of the compositor's command stream. Only needed if the tree contains | 53 // ahead of the compositor's command stream. Only needed if the tree contains |
45 // a TextureLayer that calls SetRateLimitContext(true). | 54 // a TextureLayer that calls SetRateLimitContext(true). |
46 virtual void RateLimitSharedMainThreadContext() {} | 55 virtual void RateLimitSharedMainThreadContext() {} |
47 | 56 |
48 // This hook is for testing. | 57 // This hook is for testing. |
49 virtual void DidFailToInitializeOutputSurface() {} | 58 virtual void DidFailToInitializeOutputSurface() {} |
50 | 59 |
51 protected: | 60 protected: |
52 virtual ~LayerTreeHostClient() {} | 61 virtual ~LayerTreeHostClient() {} |
53 }; | 62 }; |
54 | 63 |
55 } // namespace cc | 64 } // namespace cc |
56 | 65 |
57 #endif // CC_TREES_LAYER_TREE_HOST_CLIENT_H_ | 66 #endif // CC_TREES_LAYER_TREE_HOST_CLIENT_H_ |
OLD | NEW |