[email protected] | ba91a79 | 2013-02-06 09:48:28 | [diff] [blame] | 1 | // Copyright (c) 2013 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 CONTENT_RENDERER_GPU_RENDER_WIDGET_COMPOSITOR_H_ |
| 6 | #define CONTENT_RENDERER_GPU_RENDER_WIDGET_COMPOSITOR_H_ |
| 7 | |
avi | 1023d01 | 2015-12-25 02:39:14 | [diff] [blame] | 8 | #include <stdint.h> |
| 9 | |
[email protected] | 666d7cf | 2013-10-12 01:30:29 | [diff] [blame] | 10 | #include "base/callback.h" |
[email protected] | 200a9c06 | 2013-05-20 04:34:37 | [diff] [blame] | 11 | #include "base/memory/weak_ptr.h" |
[email protected] | abb52216 | 2013-06-28 01:54:16 | [diff] [blame] | 12 | #include "base/time/time.h" |
[email protected] | 752e2cf | 2013-10-21 21:41:15 | [diff] [blame] | 13 | #include "base/values.h" |
mdjones | 2ee41afd | 2016-10-27 16:50:20 | [diff] [blame] | 14 | #include "cc/input/browser_controls_state.h" |
CJ DiMeglio | f3ca99e | 2017-11-22 23:12:01 | [diff] [blame] | 15 | #include "cc/trees/layer_tree_host.h" |
[email protected] | 556fd29 | 2013-03-18 08:03:04 | [diff] [blame] | 16 | #include "cc/trees/layer_tree_host_client.h" |
[email protected] | 943528e | 2013-11-07 05:01:32 | [diff] [blame] | 17 | #include "cc/trees/layer_tree_host_single_thread_client.h" |
[email protected] | 556fd29 | 2013-03-18 08:03:04 | [diff] [blame] | 18 | #include "cc/trees/layer_tree_settings.h" |
danakj | ba65a091 | 2017-09-21 16:38:42 | [diff] [blame] | 19 | #include "cc/trees/managed_memory_policy.h" |
| 20 | #include "cc/trees/swap_promise.h" |
jamesr | f313a21 | 2015-03-16 21:27:37 | [diff] [blame] | 21 | #include "cc/trees/swap_promise_monitor.h" |
skyostil | 7759d7a | 2014-09-05 08:22:23 | [diff] [blame] | 22 | #include "content/common/content_export.h" |
jonross | a2ff4f8 | 2018-02-16 17:27:46 | [diff] [blame] | 23 | #include "content/common/render_frame_metadata.mojom.h" |
danakj | 6e3bf801 | 2014-12-16 18:27:53 | [diff] [blame] | 24 | #include "content/renderer/gpu/compositor_dependencies.h" |
Khushal | 3e96e66 | 2017-10-30 23:16:50 | [diff] [blame] | 25 | #include "services/metrics/public/cpp/ukm_recorder.h" |
Blink Reformat | a30d423 | 2018-04-07 15:31:06 | [diff] [blame^] | 26 | #include "third_party/blink/public/platform/web_layer_tree_view.h" |
tfarina | 3b0452d | 2014-12-31 15:20:09 | [diff] [blame] | 27 | #include "ui/gfx/geometry/rect.h" |
[email protected] | ba91a79 | 2013-02-06 09:48:28 | [diff] [blame] | 28 | |
danakj | a40dd448 | 2016-06-28 01:14:10 | [diff] [blame] | 29 | namespace base { |
| 30 | class CommandLine; |
[email protected] | 4b15766 | 2013-05-29 04:05:05 | [diff] [blame] | 31 | } |
| 32 | |
[email protected] | ba91a79 | 2013-02-06 09:48:28 | [diff] [blame] | 33 | namespace cc { |
loyso | 2cb3f32f | 2016-11-08 07:08:34 | [diff] [blame] | 34 | |
| 35 | class AnimationHost; |
[email protected] | 200a9c06 | 2013-05-20 04:34:37 | [diff] [blame] | 36 | class InputHandler; |
[email protected] | f7837a9 | 2013-08-21 03:00:05 | [diff] [blame] | 37 | class Layer; |
danakj | c7afae5 | 2017-06-20 21:12:41 | [diff] [blame] | 38 | class LayerTreeFrameSink; |
khushalsagar | 6156779 | 2016-09-17 00:13:58 | [diff] [blame] | 39 | class LayerTreeHost; |
loyso | 6e6efc4 | 2017-01-21 02:23:03 | [diff] [blame] | 40 | class MutatorHost; |
danakj | a40dd448 | 2016-06-28 01:14:10 | [diff] [blame] | 41 | } |
dtrainor | 5ef644e | 2015-11-19 00:12:47 | [diff] [blame] | 42 | |
ccameron | f408cab | 2016-09-14 16:54:42 | [diff] [blame] | 43 | namespace gfx { |
| 44 | class ColorSpace; |
| 45 | } |
| 46 | |
danakj | a40dd448 | 2016-06-28 01:14:10 | [diff] [blame] | 47 | namespace ui { |
| 48 | class LatencyInfo; |
[email protected] | ba91a79 | 2013-02-06 09:48:28 | [diff] [blame] | 49 | } |
| 50 | |
| 51 | namespace content { |
fsamuel | 78f86e4 | 2016-01-20 04:10:23 | [diff] [blame] | 52 | class RenderWidgetCompositorDelegate; |
boliu | 6f8ab17 | 2017-01-10 05:06:36 | [diff] [blame] | 53 | struct ScreenInfo; |
[email protected] | ba91a79 | 2013-02-06 09:48:28 | [diff] [blame] | 54 | |
skyostil | 7759d7a | 2014-09-05 08:22:23 | [diff] [blame] | 55 | class CONTENT_EXPORT RenderWidgetCompositor |
Nico Weber | 43ddd7a3 | 2017-08-15 19:19:27 | [diff] [blame] | 56 | : public blink::WebLayerTreeView, |
| 57 | public cc::LayerTreeHostClient, |
| 58 | public cc::LayerTreeHostSingleThreadClient { |
Scott Haseley | c3f876b | 2017-08-10 00:40:36 | [diff] [blame] | 59 | using ReportTimeCallback = |
| 60 | base::Callback<void(blink::WebLayerTreeView::SwapResult, double)>; |
panicker | 34797fd | 2017-05-05 04:09:26 | [diff] [blame] | 61 | |
[email protected] | ba91a79 | 2013-02-06 09:48:28 | [diff] [blame] | 62 | public: |
| 63 | // Attempt to construct and initialize a compositor instance for the widget |
| 64 | // with the given settings. Returns NULL if initialization fails. |
dcheng | cedca561 | 2016-04-09 01:40:15 | [diff] [blame] | 65 | static std::unique_ptr<RenderWidgetCompositor> Create( |
fsamuel | 78f86e4 | 2016-01-20 04:10:23 | [diff] [blame] | 66 | RenderWidgetCompositorDelegate* delegate, |
danakj | 6e3bf801 | 2014-12-16 18:27:53 | [diff] [blame] | 67 | CompositorDependencies* compositor_deps); |
[email protected] | ba91a79 | 2013-02-06 09:48:28 | [diff] [blame] | 68 | |
avi | 5c77d21 | 2015-09-25 20:08:25 | [diff] [blame] | 69 | ~RenderWidgetCompositor() override; |
[email protected] | ba91a79 | 2013-02-06 09:48:28 | [diff] [blame] | 70 | |
danakj | a40dd448 | 2016-06-28 01:14:10 | [diff] [blame] | 71 | static cc::LayerTreeSettings GenerateLayerTreeSettings( |
| 72 | const base::CommandLine& cmd, |
| 73 | CompositorDependencies* compositor_deps, |
wjmaclean | a755e30 | 2017-04-20 00:43:16 | [diff] [blame] | 74 | bool is_for_subframe, |
Walter Korman | dc3eca65 | 2017-08-15 21:00:45 | [diff] [blame] | 75 | const ScreenInfo& screen_info, |
| 76 | bool is_threaded); |
loyso | 6e6efc4 | 2017-01-21 02:23:03 | [diff] [blame] | 77 | static std::unique_ptr<cc::LayerTreeHost> CreateLayerTreeHost( |
| 78 | cc::LayerTreeHostClient* client, |
| 79 | cc::LayerTreeHostSingleThreadClient* single_thread_client, |
| 80 | cc::MutatorHost* mutator_host, |
| 81 | CompositorDependencies* deps, |
loyso | 6e6efc4 | 2017-01-21 02:23:03 | [diff] [blame] | 82 | const ScreenInfo& screen_info); |
| 83 | |
| 84 | void Initialize(std::unique_ptr<cc::LayerTreeHost> layer_tree_host, |
| 85 | std::unique_ptr<cc::AnimationHost> animation_host); |
| 86 | |
danakj | a40dd448 | 2016-06-28 01:14:10 | [diff] [blame] | 87 | static cc::ManagedMemoryPolicy GetGpuMemoryPolicy( |
Vladimir Levin | 0375ae8 | 2017-07-18 03:06:40 | [diff] [blame] | 88 | const cc::ManagedMemoryPolicy& policy, |
| 89 | const ScreenInfo& screen_info); |
danakj | a40dd448 | 2016-06-28 01:14:10 | [diff] [blame] | 90 | |
sievers | 71c62dd5 | 2015-10-07 01:44:39 | [diff] [blame] | 91 | void SetNeverVisible(); |
[email protected] | 200a9c06 | 2013-05-20 04:34:37 | [diff] [blame] | 92 | const base::WeakPtr<cc::InputHandler>& GetInputHandler(); |
[email protected] | 24ed043 | 2013-04-24 07:50:31 | [diff] [blame] | 93 | void SetNeedsDisplayOnAllLayers(); |
[email protected] | 206a392 | 2013-05-17 06:34:12 | [diff] [blame] | 94 | void SetRasterizeOnlyVisibleContent(); |
[email protected] | 0bc1f57 | 2013-04-17 01:46:31 | [diff] [blame] | 95 | void SetNeedsRedrawRect(gfx::Rect damage_rect); |
Fady Samuel | 319e429c | 2017-10-02 18:31:55 | [diff] [blame] | 96 | |
| 97 | bool IsSurfaceSynchronizationEnabled() const; |
| 98 | |
[email protected] | 7d08a935 | 2013-10-15 08:24:56 | [diff] [blame] | 99 | // Like setNeedsRedraw but forces the frame to be drawn, without early-outs. |
| 100 | // Redraw will be forced after the next commit |
| 101 | void SetNeedsForcedRedraw(); |
[email protected] | 6be422b | 2013-12-08 06:47:31 | [diff] [blame] | 102 | // Calling CreateLatencyInfoSwapPromiseMonitor() to get a scoped |
| 103 | // LatencyInfoSwapPromiseMonitor. During the life time of the |
igsolla | eab34cc | 2015-02-20 11:33:35 | [diff] [blame] | 104 | // LatencyInfoSwapPromiseMonitor, if SetNeedsCommit() or |
| 105 | // SetNeedsUpdateLayers() is called on LayerTreeHost, the original latency |
| 106 | // info will be turned into a LatencyInfoSwapPromise. |
dcheng | cedca561 | 2016-04-09 01:40:15 | [diff] [blame] | 107 | std::unique_ptr<cc::SwapPromiseMonitor> CreateLatencyInfoSwapPromiseMonitor( |
[email protected] | 6be422b | 2013-12-08 06:47:31 | [diff] [blame] | 108 | ui::LatencyInfo* latency); |
[email protected] | 8062ab26 | 2014-05-27 16:56:43 | [diff] [blame] | 109 | // Calling QueueSwapPromise() to directly queue a SwapPromise into |
| 110 | // LayerTreeHost. |
dcheng | cedca561 | 2016-04-09 01:40:15 | [diff] [blame] | 111 | void QueueSwapPromise(std::unique_ptr<cc::SwapPromise> swap_promise); |
[email protected] | 586871b | 2014-07-22 17:05:11 | [diff] [blame] | 112 | int GetSourceFrameNumber() const; |
[email protected] | df09e05 | 2013-07-31 18:59:50 | [diff] [blame] | 113 | void NotifyInputThrottledUntilCommit(); |
[email protected] | f7837a9 | 2013-08-21 03:00:05 | [diff] [blame] | 114 | const cc::Layer* GetRootLayer() const; |
[email protected] | 67e703e1 | 2014-05-30 05:31:51 | [diff] [blame] | 115 | int ScheduleMicroBenchmark( |
[email protected] | 666d7cf | 2013-10-12 01:30:29 | [diff] [blame] | 116 | const std::string& name, |
dcheng | cedca561 | 2016-04-09 01:40:15 | [diff] [blame] | 117 | std::unique_ptr<base::Value> value, |
| 118 | const base::Callback<void(std::unique_ptr<base::Value>)>& callback); |
| 119 | bool SendMessageToMicroBenchmark(int id, std::unique_ptr<base::Value> value); |
Fady Samuel | d5c2618 | 2017-07-12 02:43:33 | [diff] [blame] | 120 | void SetFrameSinkId(const viz::FrameSinkId& frame_sink_id); |
ccameron | 2c6d270 | 2017-03-08 19:42:42 | [diff] [blame] | 121 | void SetRasterColorSpace(const gfx::ColorSpace& color_space); |
wjmaclean | 1d97062 | 2017-01-21 22:28:24 | [diff] [blame] | 122 | void SetIsForOopif(bool is_for_oopif); |
fsamuel | 4c5c8714 | 2017-03-14 03:14:26 | [diff] [blame] | 123 | void SetContentSourceId(uint32_t source_id); |
Christopher Cameron | be7ecea | 2018-02-27 00:47:19 | [diff] [blame] | 124 | void SetViewportSizeAndScale(const gfx::Size& device_viewport_size, |
| 125 | float device_scale_factor, |
| 126 | const viz::LocalSurfaceId& local_surface_id); |
Ken Buchanan | b2c9e26 | 2018-03-10 16:53:31 | [diff] [blame] | 127 | void SetViewportVisibleRect(const gfx::Rect& visible_rect); |
Khushal | 3e96e66 | 2017-10-30 23:16:50 | [diff] [blame] | 128 | void SetURLForUkm(const GURL& url); |
[email protected] | 9ed83fe | 2013-02-27 01:52:28 | [diff] [blame] | 129 | |
[email protected] | ba91a79 | 2013-02-06 09:48:28 | [diff] [blame] | 130 | // WebLayerTreeView implementation. |
Fady Samuel | d5c2618 | 2017-07-12 02:43:33 | [diff] [blame] | 131 | viz::FrameSinkId GetFrameSinkId() override; |
Blink Reformat | 1c4d759e | 2017-04-09 16:34:54 | [diff] [blame] | 132 | void SetRootLayer(const blink::WebLayer& layer) override; |
| 133 | void ClearRootLayer() override; |
| 134 | cc::AnimationHost* CompositorAnimationHost() override; |
Blink Reformat | 1c4d759e | 2017-04-09 16:34:54 | [diff] [blame] | 135 | blink::WebSize GetViewportSize() const override; |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 136 | virtual blink::WebFloatPoint adjustEventPointForPinchZoom( |
| 137 | const blink::WebFloatPoint& point) const; |
Blink Reformat | 1c4d759e | 2017-04-09 16:34:54 | [diff] [blame] | 138 | void SetBackgroundColor(blink::WebColor color) override; |
| 139 | void SetVisible(bool visible) override; |
| 140 | void SetPageScaleFactorAndLimits(float page_scale_factor, |
avi | 5c77d21 | 2015-09-25 20:08:25 | [diff] [blame] | 141 | float minimum, |
| 142 | float maximum) override; |
Blink Reformat | 1c4d759e | 2017-04-09 16:34:54 | [diff] [blame] | 143 | void StartPageScaleAnimation(const blink::WebPoint& destination, |
avi | 5c77d21 | 2015-09-25 20:08:25 | [diff] [blame] | 144 | bool use_anchor, |
| 145 | float new_page_scale, |
| 146 | double duration_sec) override; |
Blink Reformat | 1c4d759e | 2017-04-09 16:34:54 | [diff] [blame] | 147 | bool HasPendingPageScaleAnimation() const override; |
| 148 | void HeuristicsForGpuRasterizationUpdated(bool matches_heuristics) override; |
| 149 | void SetNeedsBeginFrame() override; |
| 150 | void DidStopFlinging() override; |
| 151 | void LayoutAndPaintAsync( |
avi | 5c77d21 | 2015-09-25 20:08:25 | [diff] [blame] | 152 | blink::WebLayoutAndPaintAsyncCallback* callback) override; |
Blink Reformat | 1c4d759e | 2017-04-09 16:34:54 | [diff] [blame] | 153 | void CompositeAndReadbackAsync( |
avi | 5c77d21 | 2015-09-25 20:08:25 | [diff] [blame] | 154 | blink::WebCompositeAndReadbackAsyncCallback* callback) override; |
Khushal | 4b6c4188 | 2018-02-16 09:02:10 | [diff] [blame] | 155 | void SynchronouslyCompositeNoRasterForTesting() override; |
Blink Reformat | 1c4d759e | 2017-04-09 16:34:54 | [diff] [blame] | 156 | void SetDeferCommits(bool defer_commits) override; |
| 157 | void RegisterViewportLayers( |
Chandan Padhi | 198800bd1 | 2017-07-07 08:15:07 | [diff] [blame] | 158 | const blink::WebLayerTreeView::ViewportLayers& viewport_layers) override; |
Blink Reformat | 1c4d759e | 2017-04-09 16:34:54 | [diff] [blame] | 159 | void ClearViewportLayers() override; |
| 160 | void RegisterSelection(const blink::WebSelection& selection) override; |
| 161 | void ClearSelection() override; |
Jeremy Roman | ebb2683 | 2018-02-08 15:20:07 | [diff] [blame] | 162 | void SetMutatorClient(std::unique_ptr<cc::LayerTreeMutator>) override; |
Blink Reformat | 1c4d759e | 2017-04-09 16:34:54 | [diff] [blame] | 163 | void ForceRecalculateRasterScales() override; |
| 164 | void SetEventListenerProperties( |
dtapuska | f206a40d | 2016-02-05 21:36:02 | [diff] [blame] | 165 | blink::WebEventListenerClass eventClass, |
| 166 | blink::WebEventListenerProperties properties) override; |
Blink Reformat | 1c4d759e | 2017-04-09 16:34:54 | [diff] [blame] | 167 | blink::WebEventListenerProperties EventListenerProperties( |
dtapuska | f206a40d | 2016-02-05 21:36:02 | [diff] [blame] | 168 | blink::WebEventListenerClass eventClass) const override; |
Blink Reformat | 1c4d759e | 2017-04-09 16:34:54 | [diff] [blame] | 169 | void SetHaveScrollEventHandlers(bool) override; |
| 170 | bool HaveScrollEventHandlers() const override; |
| 171 | int LayerTreeId() const override; |
| 172 | void SetShowFPSCounter(bool show) override; |
| 173 | void SetShowPaintRects(bool show) override; |
| 174 | void SetShowDebugBorders(bool show) override; |
| 175 | void SetShowScrollBottleneckRects(bool show) override; |
panicker | 34797fd | 2017-05-05 04:09:26 | [diff] [blame] | 176 | void NotifySwapTime(ReportTimeCallback callback) override; |
aelias | 6004fe0 | 2015-02-07 21:43:01 | [diff] [blame] | 177 | |
Blink Reformat | 1c4d759e | 2017-04-09 16:34:54 | [diff] [blame] | 178 | void UpdateBrowserControlsState(blink::WebBrowserControlsState constraints, |
mdjones | 2ee41afd | 2016-10-27 16:50:20 | [diff] [blame] | 179 | blink::WebBrowserControlsState current, |
| 180 | bool animate) override; |
Matthew Jones | 7e15618 | 2017-07-21 22:21:33 | [diff] [blame] | 181 | void SetBrowserControlsHeight(float top_height, |
| 182 | float bottom_height, |
| 183 | bool shrink) override; |
Blink Reformat | 1c4d759e | 2017-04-09 16:34:54 | [diff] [blame] | 184 | void SetBrowserControlsShownRatio(float) override; |
vmpstr | bf56d56 | 2017-06-06 20:16:38 | [diff] [blame] | 185 | void RequestDecode(const PaintImage& image, |
Yuta Kitamura | 0ee25a86e | 2017-11-21 08:35:47 | [diff] [blame] | 186 | base::OnceCallback<void(bool)> callback) override; |
[email protected] | ba91a79 | 2013-02-06 09:48:28 | [diff] [blame] | 187 | |
Sandra Sun | 2288e853 | 2017-11-30 22:50:16 | [diff] [blame] | 188 | void SetOverscrollBehavior(const blink::WebOverscrollBehavior&) override; |
sunyunjia | bbea8a9 | 2017-08-31 11:18:54 | [diff] [blame] | 189 | |
[email protected] | ba91a79 | 2013-02-06 09:48:28 | [diff] [blame] | 190 | // cc::LayerTreeHostClient implementation. |
caseq | 7d2f4c9 | 2015-02-04 16:43:27 | [diff] [blame] | 191 | void WillBeginMainFrame() override; |
dcheng | 6d18e40 | 2014-10-21 12:32:52 | [diff] [blame] | 192 | void DidBeginMainFrame() override; |
Fady Samuel | c296f5fb | 2017-07-21 04:02:19 | [diff] [blame] | 193 | void BeginMainFrame(const viz::BeginFrameArgs& args) override; |
rmcilroy | 0a19362a | 2015-02-18 12:34:25 | [diff] [blame] | 194 | void BeginMainFrameNotExpectedSoon() override; |
delphick | 9db74aa | 2017-05-05 10:20:49 | [diff] [blame] | 195 | void BeginMainFrameNotExpectedUntil(base::TimeTicks time) override; |
Eric Seckler | 8af8c0e5 | 2018-01-17 23:45:53 | [diff] [blame] | 196 | void UpdateLayerTreeHost(VisualStateUpdate requested_update) override; |
miletus | 7a22175 | 2015-02-04 20:44:49 | [diff] [blame] | 197 | void ApplyViewportDeltas(const gfx::Vector2dF& inner_delta, |
| 198 | const gfx::Vector2dF& outer_delta, |
ccameron | 98be9ac | 2014-12-09 19:56:32 | [diff] [blame] | 199 | const gfx::Vector2dF& elastic_overscroll_delta, |
dcheng | 6d18e40 | 2014-10-21 12:32:52 | [diff] [blame] | 200 | float page_scale, |
| 201 | float top_controls_delta) override; |
sahel | 1b47fda7 | 2017-03-28 17:03:07 | [diff] [blame] | 202 | void RecordWheelAndTouchScrollingCount(bool has_scrolled_by_wheel, |
| 203 | bool has_scrolled_by_touch) override; |
danakj | c7afae5 | 2017-06-20 21:12:41 | [diff] [blame] | 204 | void RequestNewLayerTreeFrameSink() override; |
| 205 | void DidInitializeLayerTreeFrameSink() override; |
| 206 | void DidFailToInitializeLayerTreeFrameSink() override; |
dcheng | 6d18e40 | 2014-10-21 12:32:52 | [diff] [blame] | 207 | void WillCommit() override; |
| 208 | void DidCommit() override; |
| 209 | void DidCommitAndDrawFrame() override; |
danakj | 9d12442 | 2016-10-14 03:15:08 | [diff] [blame] | 210 | void DidReceiveCompositorFrameAck() override; |
rouslan | f7ebd883 | 2015-01-22 01:54:14 | [diff] [blame] | 211 | void DidCompletePageScaleAnimation() override; |
wjmaclean | a755e30 | 2017-04-20 00:43:16 | [diff] [blame] | 212 | bool IsForSubframe() override; |
[email protected] | ba91a79 | 2013-02-06 09:48:28 | [diff] [blame] | 213 | |
[email protected] | 943528e | 2013-11-07 05:01:32 | [diff] [blame] | 214 | // cc::LayerTreeHostSingleThreadClient implementation. |
danakj | 53eccbc | 2016-03-02 22:51:07 | [diff] [blame] | 215 | void RequestScheduleAnimation() override; |
danakj | 6c872fc0 | 2016-10-22 04:29:49 | [diff] [blame] | 216 | void DidSubmitCompositorFrame() override; |
danakj | c7afae5 | 2017-06-20 21:12:41 | [diff] [blame] | 217 | void DidLoseLayerTreeFrameSink() override; |
Dan Elphick | 95929fd5 | 2017-06-13 09:15:07 | [diff] [blame] | 218 | void RequestBeginMainFrameNotExpected(bool new_state) override; |
[email protected] | 943528e | 2013-11-07 05:01:32 | [diff] [blame] | 219 | |
CJ DiMeglio | f3ca99e | 2017-11-22 23:12:01 | [diff] [blame] | 220 | const cc::LayerTreeSettings& GetLayerTreeSettings() const { |
| 221 | return layer_tree_host_->GetSettings(); |
| 222 | } |
| 223 | |
jonross | a2ff4f8 | 2018-02-16 17:27:46 | [diff] [blame] | 224 | // Creates a cc::RenderFrameMetadataObserver, which is sent to the compositor |
| 225 | // thread for binding. |
| 226 | void CreateRenderFrameObserver( |
| 227 | mojom::RenderFrameMetadataObserverRequest request, |
| 228 | mojom::RenderFrameMetadataObserverClientPtrInfo client_info); |
| 229 | |
enne | 7f8fdde | 2014-12-10 21:32:09 | [diff] [blame] | 230 | protected: |
oshima | 50872a7 | 2016-03-04 13:26:18 | [diff] [blame] | 231 | friend class RenderViewImplScaleFactorTest; |
| 232 | |
fsamuel | 78f86e4 | 2016-01-20 04:10:23 | [diff] [blame] | 233 | RenderWidgetCompositor(RenderWidgetCompositorDelegate* delegate, |
danakj | 6e3bf801 | 2014-12-16 18:27:53 | [diff] [blame] | 234 | CompositorDependencies* compositor_deps); |
[email protected] | ba91a79 | 2013-02-06 09:48:28 | [diff] [blame] | 235 | |
khushalsagar | 6156779 | 2016-09-17 00:13:58 | [diff] [blame] | 236 | cc::LayerTreeHost* layer_tree_host() { return layer_tree_host_.get(); } |
enne | 7f8fdde | 2014-12-10 21:32:09 | [diff] [blame] | 237 | |
| 238 | private: |
danakj | c7afae5 | 2017-06-20 21:12:41 | [diff] [blame] | 239 | void SetLayerTreeFrameSink( |
| 240 | std::unique_ptr<cc::LayerTreeFrameSink> layer_tree_frame_sink); |
wangxianzhu | 67d1fae | 2015-06-30 22:15:53 | [diff] [blame] | 241 | void InvokeLayoutAndPaintCallback(); |
| 242 | bool CompositeIsSynchronous() const; |
Khushal | 4b6c4188 | 2018-02-16 09:02:10 | [diff] [blame] | 243 | void SynchronouslyComposite(bool raster, |
| 244 | std::unique_ptr<cc::SwapPromise> swap_promise); |
wangxianzhu | 372112e | 2015-05-06 23:01:57 | [diff] [blame] | 245 | |
fsamuel | 78f86e4 | 2016-01-20 04:10:23 | [diff] [blame] | 246 | RenderWidgetCompositorDelegate* const delegate_; |
| 247 | CompositorDependencies* const compositor_deps_; |
danakj | a40dd448 | 2016-06-28 01:14:10 | [diff] [blame] | 248 | const bool threaded_; |
loyso | 2cb3f32f | 2016-11-08 07:08:34 | [diff] [blame] | 249 | std::unique_ptr<cc::AnimationHost> animation_host_; |
khushalsagar | 6156779 | 2016-09-17 00:13:58 | [diff] [blame] | 250 | std::unique_ptr<cc::LayerTreeHost> layer_tree_host_; |
sievers | 71c62dd5 | 2015-10-07 01:44:39 | [diff] [blame] | 251 | bool never_visible_; |
wjmaclean | 1d97062 | 2017-01-21 22:28:24 | [diff] [blame] | 252 | bool is_for_oopif_; |
ernstm | 50aec92 | 2014-08-26 22:16:11 | [diff] [blame] | 253 | |
Bo Liu | d5d38582 | 2017-11-10 18:30:47 | [diff] [blame] | 254 | bool layer_tree_frame_sink_request_failed_while_invisible_ = false; |
| 255 | |
Khushal | 4b6c4188 | 2018-02-16 09:02:10 | [diff] [blame] | 256 | bool in_synchronous_compositor_update_ = false; |
wangxianzhu | 372112e | 2015-05-06 23:01:57 | [diff] [blame] | 257 | blink::WebLayoutAndPaintAsyncCallback* layout_and_paint_async_callback_; |
enne | 89e6c3aa | 2014-10-01 15:07:59 | [diff] [blame] | 258 | |
Fady Samuel | d5c2618 | 2017-07-12 02:43:33 | [diff] [blame] | 259 | viz::FrameSinkId frame_sink_id_; |
samans | d5db250 | 2017-01-13 23:18:27 | [diff] [blame] | 260 | |
enne | 7f8fdde | 2014-12-10 21:32:09 | [diff] [blame] | 261 | base::WeakPtrFactory<RenderWidgetCompositor> weak_factory_; |
panicker | 34797fd | 2017-05-05 04:09:26 | [diff] [blame] | 262 | |
| 263 | DISALLOW_COPY_AND_ASSIGN(RenderWidgetCompositor); |
[email protected] | ba91a79 | 2013-02-06 09:48:28 | [diff] [blame] | 264 | }; |
| 265 | |
| 266 | } // namespace content |
| 267 | |
| 268 | #endif // CONTENT_RENDERER_GPU_RENDER_WIDGET_COMPOSITOR_H_ |