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

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

Issue 2340143002: cc: Rename LayerTreeHost to LayerTreeHostInProcess. (Closed)
Patch Set: comment fix 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CC_TREES_LAYER_TREE_HOST_INTERFACE_H_
6 #define CC_TREES_LAYER_TREE_HOST_INTERFACE_H_
7
8 #include "base/macros.h"
9 #include "cc/base/cc_export.h"
10 #include "cc/debug/micro_benchmark.h"
11 #include "cc/input/top_controls_state.h"
12
13 namespace base {
14 class TimeTicks;
15 } // namespace base
16
17 namespace gfx {
18 class Rect;
19 } // namespace gfx
20
21 namespace cc {
22 class InputHandler;
23 class LayerTree;
24 class LayerTreeDebugState;
25 class LayerTreeMutator;
26 class LayerTreeSettings;
27 class CompositorFrameSink;
28 class SwapPromiseMonitor;
29 class TaskRunnerProvider;
30 class UIResourceManager;
31
32 // TODO(khushalsagar): Will be renamed to LayerTreeHost.
33 class CC_EXPORT LayerTreeHostInterface {
34 public:
35 virtual ~LayerTreeHostInterface() {}
36
37 // Returns the process global unique identifier for this LayerTreeHost.
38 virtual int GetId() const = 0;
39
40 // The current source frame number. This is incremented for each main frame
41 // update(commit) pushed to the compositor thread.
42 virtual int SourceFrameNumber() const = 0;
43
44 // Returns the LayerTree that holds the main frame state pushed to the
45 // LayerTreeImpl on commit.
46 virtual LayerTree* GetLayerTree() = 0;
47 virtual const LayerTree* GetLayerTree() const = 0;
48
49 // Returns the UIResourceManager used to create UIResources for
50 // UIResourceLayers pushed to the LayerTree.
51 virtual UIResourceManager* GetUIResourceManager() const = 0;
52
53 // Returns the TaskRunnerProvider used to access the main and compositor
54 // thread task runners.
55 virtual TaskRunnerProvider* GetTaskRunnerProvider() const = 0;
56
57 // Returns the settings used by this host.
58 virtual const LayerTreeSettings& GetSettings() const = 0;
59
60 // Sets the client id used to generate the SurfaceId that uniquely identifies
61 // the Surfaces produced by this compositor.
62 virtual void SetSurfaceClientId(uint32_t client_id) = 0;
63
64 // Sets the LayerTreeMutator interface used to directly mutate the compositor
65 // state on the compositor thread. (Compositor-Worker)
66 virtual void SetLayerTreeMutator(
67 std::unique_ptr<LayerTreeMutator> mutator) = 0;
68
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 // Returns the SwapPromiseManager used to create SwapPromiseMonitors for this
74 // host.
75 virtual SwapPromiseManager* GetSwapPromiseManager() = 0;
76
77 // Sets whether the content is suitable to use Gpu Rasterization.
78 virtual void SetHasGpuRasterizationTrigger(bool has_trigger) = 0;
79
80 // Visibility and CompositorFrameSink -------------------------------
81
82 virtual void SetVisible(bool visible) = 0;
83 virtual bool IsVisible() const = 0;
84
85 // Called in response to an CompositorFrameSink request made to the client
86 // using LayerTreeHostClient::RequestNewCompositorFrameSink. The client will
87 // be informed of the CompositorFrameSink initialization status using
88 // DidInitializaCompositorFrameSink or DidFailToInitializeCompositorFrameSink.
89 // The request is completed when the host successfully initializes an
90 // CompositorFrameSink.
91 virtual void SetCompositorFrameSink(
92 std::unique_ptr<CompositorFrameSink> compositor_frame_sink) = 0;
93
94 // Forces the host to immediately release all references to the
95 // CompositorFrameSink, if any. Can be safely called any time.
96 virtual std::unique_ptr<CompositorFrameSink> ReleaseCompositorFrameSink() = 0;
97
98 // Frame Scheduling (main and compositor frames) requests -------
99
100 // Requests a main frame update even if no content has changed. This is used,
101 // for instance in the case of RequestAnimationFrame from blink to ensure the
102 // main frame update is run on the next tick without pre-emptively forcing a
103 // full commit synchronization or layer updates.
104 virtual void SetNeedsAnimate() = 0;
105
106 // Requests a main frame update and also ensure that the host pulls layer
107 // updates from the client, even if no content might have changed, without
108 // forcing a full commit synchronization.
109 virtual void SetNeedsUpdateLayers() = 0;
110
111 // Requests that the next main frame update performs a full commit
112 // synchronization.
113 virtual void SetNeedsCommit() = 0;
114
115 // Returns true if a main frame (for any pipeline stage above) has been
116 // requested.
117 virtual bool BeginMainFrameRequested() const = 0;
118
119 // Returns true if a main frame with commit synchronization has been
120 // requested.
121 virtual bool CommitRequested() const = 0;
122
123 // Enables/disables the compositor from requesting main frame updates from the
124 // client.
125 virtual void SetDeferCommits(bool defer_commits) = 0;
126
127 // Synchronously performs a main frame update and layer updates. Used only in
128 // single threaded mode when the compositor's internal scheduling is disabled.
129 virtual void LayoutAndUpdateLayers() = 0;
130
131 // Synchronously performs a complete main frame update, commit and compositor
132 // frame. Used only in single threaded mode when the compositor's internal
133 // scheduling is disabled.
134 virtual void Composite(base::TimeTicks frame_begin_time) = 0;
135
136 // Requests a redraw (compositor frame) for the complete viewport.
137 virtual void SetNeedsRedraw() = 0;
138
139 // Requests a redraw (compositor frame) for the given rect.
140 virtual void SetNeedsRedrawRect(const gfx::Rect& damage_rect) = 0;
141
142 // Requests a main frame (including layer updates) and ensures that this main
143 // frame results in a redraw for the complete viewport when producing the
144 // CompositorFrame.
145 virtual void SetNextCommitForcesRedraw() = 0;
146
147 // Input Handling ---------------------------------------------
148
149 // Notifies the compositor that input from the browser is being throttled till
150 // the next commit. The compositor will prioritize activation of the pending
151 // tree so a commit can be performed.
152 virtual void NotifyInputThrottledUntilCommit() = 0;
153
154 // Sets the state of the top controls. (Used for URL bar animations on
155 // android).
156 virtual void UpdateTopControlsState(TopControlsState constraints,
157 TopControlsState current,
158 bool animate) = 0;
159
160 // Returns a reference to the InputHandler used to respond to input events on
161 // the compositor thread.
162 virtual const base::WeakPtr<InputHandler>& GetInputHandler() const = 0;
163
164 // Informs the compositor that an active fling gesture being processed on the
165 // main thread has been finished.
166 virtual void DidStopFlinging() = 0;
167
168 // Debugging and benchmarks ---------------------------------
169 virtual void SetDebugState(const LayerTreeDebugState& debug_state) = 0;
170 virtual const LayerTreeDebugState& GetDebugState() const = 0;
171
172 // Returns the id of the benchmark on success, 0 otherwise.
173 virtual int ScheduleMicroBenchmark(
174 const std::string& benchmark_name,
175 std::unique_ptr<base::Value> value,
176 const MicroBenchmark::DoneCallback& callback) = 0;
177
178 // Returns true if the message was successfully delivered and handled.
179 virtual bool SendMessageToMicroBenchmark(
180 int id,
181 std::unique_ptr<base::Value> value) = 0;
182
183 // Methods used internally in cc. These are not intended to be a part of the
184 // public API for use by the embedder ----------------------
185 virtual SurfaceSequenceGenerator* GetSurfaceSequenceGenerator() = 0;
186 };
187
188 } // namespace cc
189
190 #endif // CC_TREES_LAYER_TREE_HOST_INTERFACE_H_
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_in_process.cc ('k') | cc/trees/layer_tree_host_unittest_remote_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698