OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_INTERFACE_H_ | 5 #ifndef CC_TREES_LAYER_TREE_HOST_INTERFACE_H_ |
6 #define CC_TREES_LAYER_TREE_HOST_INTERFACE_H_ | 6 #define CC_TREES_LAYER_TREE_HOST_INTERFACE_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "cc/base/cc_export.h" | 9 #include "cc/base/cc_export.h" |
10 #include "cc/debug/micro_benchmark.h" | 10 #include "cc/debug/micro_benchmark.h" |
11 #include "cc/input/top_controls_state.h" | 11 #include "cc/input/top_controls_state.h" |
12 | 12 |
13 namespace base { | 13 namespace base { |
14 class TimeTicks; | 14 class TimeTicks; |
15 } // namespace base | 15 } // namespace base |
16 | 16 |
17 namespace gfx { | 17 namespace gfx { |
18 class Rect; | 18 class Rect; |
19 } // namespace gfx | 19 } // namespace gfx |
20 | 20 |
21 namespace cc { | 21 namespace cc { |
22 class InputHandler; | 22 class InputHandler; |
23 class LayerTree; | 23 class LayerTree; |
24 class LayerTreeDebugState; | 24 class LayerTreeDebugState; |
25 class LayerTreeMutator; | 25 class LayerTreeMutator; |
26 class LayerTreeSettings; | 26 class LayerTreeSettings; |
27 class OutputSurface; | 27 class OutputSurface; |
28 class SwapPromiseMonitor; | 28 class SwapPromiseManager; |
29 class TaskRunnerProvider; | 29 class TaskRunnerProvider; |
30 | 30 |
31 // TODO(khushalsagar): Will be renamed to LayerTreeHost. | 31 // TODO(khushalsagar): Will be renamed to LayerTreeHost. |
32 class CC_EXPORT LayerTreeHostInterface { | 32 class CC_EXPORT LayerTreeHostInterface { |
33 public: | 33 public: |
34 virtual ~LayerTreeHostInterface() {} | 34 virtual ~LayerTreeHostInterface() {} |
35 | 35 |
36 // Returns the process global unique identifier for this LayerTreeHost. | 36 // Returns the process global unique identifier for this LayerTreeHost. |
37 virtual int GetId() const = 0; | 37 virtual int GetId() const = 0; |
38 | 38 |
39 // The current source frame number. This is incremented for each main frame | 39 // The current source frame number. This is incremented for each main frame |
40 // update(commit) pushed to the compositor thread. | 40 // update(commit) pushed to the compositor thread. |
41 virtual int SourceFrameNumber() const = 0; | 41 virtual int SourceFrameNumber() const = 0; |
42 | 42 |
43 // Returns the LayerTree that holds the main frame state pushed to the | 43 // Returns the LayerTree that holds the main frame state pushed to the |
44 // LayerTreeImpl on commit. | 44 // LayerTreeImpl on commit. |
45 virtual LayerTree* GetLayerTree() = 0; | 45 virtual LayerTree* GetLayerTree() = 0; |
46 virtual const LayerTree* GetLayerTree() const = 0; | 46 virtual const LayerTree* GetLayerTree() const = 0; |
47 | 47 |
48 // Returns the TaskRunnerProvider used to access the main and compositor | 48 // Returns the TaskRunnerProvider used to access the main and compositor |
49 // thread task runners. | 49 // thread task runners. |
50 virtual TaskRunnerProvider* GetTaskRunnerProvider() const = 0; | 50 virtual TaskRunnerProvider* GetTaskRunnerProvider() const = 0; |
51 | 51 |
| 52 // Returns the SwapPromiseManager used to queue SwapPromises to track the |
| 53 // frame stages (commit, activation, SwapBuffers) performed by this |
| 54 // LayerTreeHost. For a detailed explaination on how to use SwapPromises, see |
| 55 // cc/output/swap_promise.h |
| 56 virtual SwapPromiseManager* GetSwapPromiseManager() const = 0; |
| 57 |
52 // Returns the settings used by this host. | 58 // Returns the settings used by this host. |
53 virtual const LayerTreeSettings& GetSettings() const = 0; | 59 virtual const LayerTreeSettings& GetSettings() const = 0; |
54 | 60 |
55 // Sets the client id used to generate the SurfaceId that uniquely identifies | 61 // Returns the SurfaceSequenceGenerator used to generate SurfaceSequences for |
56 // the Surfaces produced by this compositor. | 62 // Surfaces using CompositorFrames produced by this LayerTreeHost. |
57 virtual void SetSurfaceClientId(uint32_t client_id) = 0; | 63 virtual SurfaceSequenceGenerator* GetSurfaceSequenceGenerator() = 0; |
58 | 64 |
59 // Sets the LayerTreeMutator interface used to directly mutate the compositor | 65 // Sets the LayerTreeMutator interface used to directly mutate the compositor |
60 // state on the compositor thread. (Compositor-Worker) | 66 // state on the compositor thread. (Compositor-Worker) |
61 virtual void SetLayerTreeMutator( | 67 virtual void SetLayerTreeMutator( |
62 std::unique_ptr<LayerTreeMutator> mutator) = 0; | 68 std::unique_ptr<LayerTreeMutator> mutator) = 0; |
63 | 69 |
64 // Call this function when you expect there to be a swap buffer. | |
65 // See swap_promise.h for how to use SwapPromise. | |
66 virtual void QueueSwapPromise(std::unique_ptr<SwapPromise> swap_promise) = 0; | |
67 | |
68 // Sets whether the content is suitable to use Gpu Rasterization. | 70 // Sets whether the content is suitable to use Gpu Rasterization. |
69 virtual void SetHasGpuRasterizationTrigger(bool has_trigger) = 0; | 71 virtual void SetHasGpuRasterizationTrigger(bool has_trigger) = 0; |
70 | 72 |
71 // Visibility and OutputSurface ------------------------------- | 73 // Visibility and OutputSurface ------------------------------- |
72 | 74 |
73 virtual void SetVisible(bool visible) = 0; | 75 virtual void SetVisible(bool visible) = 0; |
74 virtual bool IsVisible() const = 0; | 76 virtual bool IsVisible() const = 0; |
75 | 77 |
76 // Called in response to an OutputSurface request made to the client using | 78 // Called in response to an OutputSurface request made to the client using |
77 // LayerTreeHostClient::RequestNewOutputSurface. The client will be informed | 79 // LayerTreeHostClient::RequestNewOutputSurface. The client will be informed |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 // Returns the id of the benchmark on success, 0 otherwise. | 164 // Returns the id of the benchmark on success, 0 otherwise. |
163 virtual int ScheduleMicroBenchmark( | 165 virtual int ScheduleMicroBenchmark( |
164 const std::string& benchmark_name, | 166 const std::string& benchmark_name, |
165 std::unique_ptr<base::Value> value, | 167 std::unique_ptr<base::Value> value, |
166 const MicroBenchmark::DoneCallback& callback) = 0; | 168 const MicroBenchmark::DoneCallback& callback) = 0; |
167 | 169 |
168 // Returns true if the message was successfully delivered and handled. | 170 // Returns true if the message was successfully delivered and handled. |
169 virtual bool SendMessageToMicroBenchmark( | 171 virtual bool SendMessageToMicroBenchmark( |
170 int id, | 172 int id, |
171 std::unique_ptr<base::Value> value) = 0; | 173 std::unique_ptr<base::Value> value) = 0; |
172 | |
173 // Methods used internally in cc. These are not intended to be a part of the | |
174 // public API for use by the embedder ---------------------- | |
175 | |
176 // When a SwapPromiseMonitor is created on the main thread, it calls | |
177 // InsertSwapPromiseMonitor() to register itself with LayerTreeHost. | |
178 // When the monitor is destroyed, it calls RemoveSwapPromiseMonitor() | |
179 // to unregister itself. | |
180 virtual void InsertSwapPromiseMonitor(SwapPromiseMonitor* monitor) = 0; | |
181 virtual void RemoveSwapPromiseMonitor(SwapPromiseMonitor* monitor) = 0; | |
182 }; | 174 }; |
183 | 175 |
184 } // namespace cc | 176 } // namespace cc |
185 | 177 |
186 #endif // CC_TREES_LAYER_TREE_HOST_INTERFACE_H_ | 178 #endif // CC_TREES_LAYER_TREE_HOST_INTERFACE_H_ |
OLD | NEW |