Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(142)

Side by Side Diff: cc/trees/layer_tree_host_interface.h

Issue 2323423002: cc: Add SwapPromiseManager and SurfaceSequenceGenerator. (Closed)
Patch Set: rebase Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 class UIResourceManager; 30 class UIResourceManager;
31 31
32 // TODO(khushalsagar): Will be renamed to LayerTreeHost. 32 // TODO(khushalsagar): Will be renamed to LayerTreeHost.
33 class CC_EXPORT LayerTreeHostInterface { 33 class CC_EXPORT LayerTreeHostInterface {
34 public: 34 public:
35 virtual ~LayerTreeHostInterface() {} 35 virtual ~LayerTreeHostInterface() {}
36 36
37 // Returns the process global unique identifier for this LayerTreeHost. 37 // Returns the process global unique identifier for this LayerTreeHost.
38 virtual int GetId() const = 0; 38 virtual int GetId() const = 0;
39 39
40 // The current source frame number. This is incremented for each main frame 40 // The current source frame number. This is incremented for each main frame
41 // update(commit) pushed to the compositor thread. 41 // update(commit) pushed to the compositor thread.
42 virtual int SourceFrameNumber() const = 0; 42 virtual int SourceFrameNumber() const = 0;
43 43
44 // Returns the LayerTree that holds the main frame state pushed to the 44 // Returns the LayerTree that holds the main frame state pushed to the
45 // LayerTreeImpl on commit. 45 // LayerTreeImpl on commit.
46 virtual LayerTree* GetLayerTree() = 0; 46 virtual LayerTree* GetLayerTree() = 0;
47 virtual const LayerTree* GetLayerTree() const = 0; 47 virtual const LayerTree* GetLayerTree() const = 0;
48 48
49 // Returns the UIResourceManager used to create UIResources for 49 // Returns the UIResourceManager used to create UIResources for
50 // UIResourceLayers pushed to the LayerTree. 50 // UIResourceLayers pushed to the LayerTree.
51 virtual UIResourceManager* GetUIResourceManager() const = 0; 51 virtual UIResourceManager* GetUIResourceManager() const = 0;
52 52
53 // Returns the TaskRunnerProvider used to access the main and compositor 53 // Returns the TaskRunnerProvider used to access the main and compositor
54 // thread task runners. 54 // thread task runners.
55 virtual TaskRunnerProvider* GetTaskRunnerProvider() const = 0; 55 virtual TaskRunnerProvider* GetTaskRunnerProvider() const = 0;
56 56
57 // Returns the SwapPromiseManager used to queue SwapPromises to track the
58 // frame stages (commit, activation, SwapBuffers) performed by this
59 // LayerTreeHost. For a detailed explaination on how to use SwapPromises, see
60 // cc/output/swap_promise.h
61 virtual SwapPromiseManager* GetSwapPromiseManager() const = 0;
62
57 // Returns the settings used by this host. 63 // Returns the settings used by this host.
58 virtual const LayerTreeSettings& GetSettings() const = 0; 64 virtual const LayerTreeSettings& GetSettings() const = 0;
59 65
60 // Sets the client id used to generate the SurfaceId that uniquely identifies 66 // Returns the SurfaceSequenceGenerator used to generate SurfaceSequences for
61 // the Surfaces produced by this compositor. 67 // Surfaces using CompositorFrames produced by this LayerTreeHost.
62 virtual void SetSurfaceClientId(uint32_t client_id) = 0; 68 virtual SurfaceSequenceGenerator* GetSurfaceSequenceGenerator() = 0;
63 69
64 // Sets the LayerTreeMutator interface used to directly mutate the compositor 70 // Sets the LayerTreeMutator interface used to directly mutate the compositor
65 // state on the compositor thread. (Compositor-Worker) 71 // state on the compositor thread. (Compositor-Worker)
66 virtual void SetLayerTreeMutator( 72 virtual void SetLayerTreeMutator(
67 std::unique_ptr<LayerTreeMutator> mutator) = 0; 73 std::unique_ptr<LayerTreeMutator> mutator) = 0;
68 74
69 // Call this function when you expect there to be a swap buffer.
70 // See swap_promise.h for how to use SwapPromise.
71 virtual void QueueSwapPromise(std::unique_ptr<SwapPromise> swap_promise) = 0;
72
73 // Sets whether the content is suitable to use Gpu Rasterization. 75 // Sets whether the content is suitable to use Gpu Rasterization.
74 virtual void SetHasGpuRasterizationTrigger(bool has_trigger) = 0; 76 virtual void SetHasGpuRasterizationTrigger(bool has_trigger) = 0;
75 77
76 // Visibility and OutputSurface ------------------------------- 78 // Visibility and OutputSurface -------------------------------
77 79
78 virtual void SetVisible(bool visible) = 0; 80 virtual void SetVisible(bool visible) = 0;
79 virtual bool IsVisible() const = 0; 81 virtual bool IsVisible() const = 0;
80 82
81 // Called in response to an OutputSurface request made to the client using 83 // Called in response to an OutputSurface request made to the client using
82 // LayerTreeHostClient::RequestNewOutputSurface. The client will be informed 84 // LayerTreeHostClient::RequestNewOutputSurface. The client will be informed
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 // Returns the id of the benchmark on success, 0 otherwise. 169 // Returns the id of the benchmark on success, 0 otherwise.
168 virtual int ScheduleMicroBenchmark( 170 virtual int ScheduleMicroBenchmark(
169 const std::string& benchmark_name, 171 const std::string& benchmark_name,
170 std::unique_ptr<base::Value> value, 172 std::unique_ptr<base::Value> value,
171 const MicroBenchmark::DoneCallback& callback) = 0; 173 const MicroBenchmark::DoneCallback& callback) = 0;
172 174
173 // Returns true if the message was successfully delivered and handled. 175 // Returns true if the message was successfully delivered and handled.
174 virtual bool SendMessageToMicroBenchmark( 176 virtual bool SendMessageToMicroBenchmark(
175 int id, 177 int id,
176 std::unique_ptr<base::Value> value) = 0; 178 std::unique_ptr<base::Value> value) = 0;
177
178 // Methods used internally in cc. These are not intended to be a part of the
179 // public API for use by the embedder ----------------------
180
181 // When a SwapPromiseMonitor is created on the main thread, it calls
182 // InsertSwapPromiseMonitor() to register itself with LayerTreeHost.
183 // When the monitor is destroyed, it calls RemoveSwapPromiseMonitor()
184 // to unregister itself.
185 virtual void InsertSwapPromiseMonitor(SwapPromiseMonitor* monitor) = 0;
186 virtual void RemoveSwapPromiseMonitor(SwapPromiseMonitor* monitor) = 0;
187 }; 179 };
188 180
189 } // namespace cc 181 } // namespace cc
190 182
191 #endif // CC_TREES_LAYER_TREE_HOST_INTERFACE_H_ 183 #endif // CC_TREES_LAYER_TREE_HOST_INTERFACE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698