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

Side by Side Diff: content/renderer/gpu/render_widget_compositor.h

Issue 2075343003: Use a cc::Display for layout tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mailbox-test
Patch Set: layouttests-display2: rebase Created 4 years, 5 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 (c) 2013 The Chromium Authors. All rights reserved. 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 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 CONTENT_RENDERER_GPU_RENDER_WIDGET_COMPOSITOR_H_ 5 #ifndef CONTENT_RENDERER_GPU_RENDER_WIDGET_COMPOSITOR_H_
6 #define CONTENT_RENDERER_GPU_RENDER_WIDGET_COMPOSITOR_H_ 6 #define CONTENT_RENDERER_GPU_RENDER_WIDGET_COMPOSITOR_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "base/time/time.h" 12 #include "base/time/time.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "cc/input/top_controls_state.h" 14 #include "cc/input/top_controls_state.h"
15 #include "cc/output/managed_memory_policy.h" 15 #include "cc/output/managed_memory_policy.h"
16 #include "cc/output/swap_promise.h" 16 #include "cc/output/swap_promise.h"
17 #include "cc/trees/layer_tree_host_client.h" 17 #include "cc/trees/layer_tree_host_client.h"
18 #include "cc/trees/layer_tree_host_single_thread_client.h" 18 #include "cc/trees/layer_tree_host_single_thread_client.h"
19 #include "cc/trees/layer_tree_settings.h" 19 #include "cc/trees/layer_tree_settings.h"
20 #include "cc/trees/remote_proto_channel.h" 20 #include "cc/trees/remote_proto_channel.h"
21 #include "cc/trees/swap_promise_monitor.h" 21 #include "cc/trees/swap_promise_monitor.h"
22 #include "content/common/content_export.h" 22 #include "content/common/content_export.h"
23 #include "content/renderer/gpu/compositor_dependencies.h" 23 #include "content/renderer/gpu/compositor_dependencies.h"
24 #include "third_party/WebKit/public/platform/WebLayerTreeView.h" 24 #include "third_party/WebKit/public/platform/WebLayerTreeView.h"
25 #include "ui/gfx/geometry/rect.h" 25 #include "ui/gfx/geometry/rect.h"
26 26
27 namespace ui { 27 namespace base {
28 class LatencyInfo; 28 class CommandLine;
29 } 29 }
30 30
31 namespace cc { 31 namespace cc {
32 class CopyOutputRequest; 32 class CopyOutputRequest;
33 class InputHandler; 33 class InputHandler;
34 class Layer; 34 class Layer;
35 class LayerTreeHost; 35 class LayerTreeHost;
36
37 namespace proto { 36 namespace proto {
38 class CompositorMessage; 37 class CompositorMessage;
39 } 38 }
39 }
40 40
41 namespace ui {
42 class LatencyInfo;
41 } 43 }
42 44
43 namespace content { 45 namespace content {
44 46
45 class RenderWidgetCompositorDelegate; 47 class RenderWidgetCompositorDelegate;
46 48
47 class CONTENT_EXPORT RenderWidgetCompositor 49 class CONTENT_EXPORT RenderWidgetCompositor
48 : NON_EXPORTED_BASE(public blink::WebLayerTreeView), 50 : NON_EXPORTED_BASE(public blink::WebLayerTreeView),
49 NON_EXPORTED_BASE(public cc::LayerTreeHostClient), 51 NON_EXPORTED_BASE(public cc::LayerTreeHostClient),
50 NON_EXPORTED_BASE(public cc::LayerTreeHostSingleThreadClient), 52 NON_EXPORTED_BASE(public cc::LayerTreeHostSingleThreadClient),
51 NON_EXPORTED_BASE(public cc::RemoteProtoChannel) { 53 NON_EXPORTED_BASE(public cc::RemoteProtoChannel) {
52 public: 54 public:
53 // Attempt to construct and initialize a compositor instance for the widget 55 // Attempt to construct and initialize a compositor instance for the widget
54 // with the given settings. Returns NULL if initialization fails. 56 // with the given settings. Returns NULL if initialization fails.
55 static std::unique_ptr<RenderWidgetCompositor> Create( 57 static std::unique_ptr<RenderWidgetCompositor> Create(
56 RenderWidgetCompositorDelegate* delegate, 58 RenderWidgetCompositorDelegate* delegate,
57 float device_scale_factor, 59 float device_scale_factor,
58 CompositorDependencies* compositor_deps); 60 CompositorDependencies* compositor_deps);
59 61
60 ~RenderWidgetCompositor() override; 62 ~RenderWidgetCompositor() override;
61 63
64 static cc::LayerTreeSettings GenerateLayerTreeSettings(
65 const base::CommandLine& cmd,
66 CompositorDependencies* compositor_deps,
67 float device_scale_factor);
68 static cc::ManagedMemoryPolicy GetGpuMemoryPolicy(
69 const cc::ManagedMemoryPolicy& policy);
70
62 void SetNeverVisible(); 71 void SetNeverVisible();
63 const base::WeakPtr<cc::InputHandler>& GetInputHandler(); 72 const base::WeakPtr<cc::InputHandler>& GetInputHandler();
64 bool BeginMainFrameRequested() const; 73 bool BeginMainFrameRequested() const;
65 void SetNeedsDisplayOnAllLayers(); 74 void SetNeedsDisplayOnAllLayers();
66 void SetRasterizeOnlyVisibleContent(); 75 void SetRasterizeOnlyVisibleContent();
67 void SetNeedsRedrawRect(gfx::Rect damage_rect); 76 void SetNeedsRedrawRect(gfx::Rect damage_rect);
68 // Like setNeedsRedraw but forces the frame to be drawn, without early-outs. 77 // Like setNeedsRedraw but forces the frame to be drawn, without early-outs.
69 // Redraw will be forced after the next commit 78 // Redraw will be forced after the next commit
70 void SetNeedsForcedRedraw(); 79 void SetNeedsForcedRedraw();
71 // Calling CreateLatencyInfoSwapPromiseMonitor() to get a scoped 80 // Calling CreateLatencyInfoSwapPromiseMonitor() to get a scoped
(...skipping 11 matching lines...) Expand all
83 void SetNeedsCommit(); 92 void SetNeedsCommit();
84 void NotifyInputThrottledUntilCommit(); 93 void NotifyInputThrottledUntilCommit();
85 const cc::Layer* GetRootLayer() const; 94 const cc::Layer* GetRootLayer() const;
86 int ScheduleMicroBenchmark( 95 int ScheduleMicroBenchmark(
87 const std::string& name, 96 const std::string& name,
88 std::unique_ptr<base::Value> value, 97 std::unique_ptr<base::Value> value,
89 const base::Callback<void(std::unique_ptr<base::Value>)>& callback); 98 const base::Callback<void(std::unique_ptr<base::Value>)>& callback);
90 bool SendMessageToMicroBenchmark(int id, std::unique_ptr<base::Value> value); 99 bool SendMessageToMicroBenchmark(int id, std::unique_ptr<base::Value> value);
91 void SetSurfaceIdNamespace(uint32_t surface_id_namespace); 100 void SetSurfaceIdNamespace(uint32_t surface_id_namespace);
92 void OnHandleCompositorProto(const std::vector<uint8_t>& proto); 101 void OnHandleCompositorProto(const std::vector<uint8_t>& proto);
93 cc::ManagedMemoryPolicy GetGpuMemoryPolicy(
94 const cc::ManagedMemoryPolicy& policy);
95 void SetPaintedDeviceScaleFactor(float device_scale); 102 void SetPaintedDeviceScaleFactor(float device_scale);
96 103
97 // WebLayerTreeView implementation. 104 // WebLayerTreeView implementation.
98 void setRootLayer(const blink::WebLayer& layer) override; 105 void setRootLayer(const blink::WebLayer& layer) override;
99 void clearRootLayer() override; 106 void clearRootLayer() override;
100 void attachCompositorAnimationTimeline( 107 void attachCompositorAnimationTimeline(
101 cc::AnimationTimeline* compositor_timeline) override; 108 cc::AnimationTimeline* compositor_timeline) override;
102 void detachCompositorAnimationTimeline( 109 void detachCompositorAnimationTimeline(
103 cc::AnimationTimeline* compositor_timeline) override; 110 cc::AnimationTimeline* compositor_timeline) override;
104 void setViewportSize(const blink::WebSize& device_viewport_size) override; 111 void setViewportSize(const blink::WebSize& device_viewport_size) override;
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 207
201 private: 208 private:
202 void LayoutAndUpdateLayers(); 209 void LayoutAndUpdateLayers();
203 void InvokeLayoutAndPaintCallback(); 210 void InvokeLayoutAndPaintCallback();
204 bool CompositeIsSynchronous() const; 211 bool CompositeIsSynchronous() const;
205 void SynchronouslyComposite(); 212 void SynchronouslyComposite();
206 213
207 int num_failed_recreate_attempts_; 214 int num_failed_recreate_attempts_;
208 RenderWidgetCompositorDelegate* const delegate_; 215 RenderWidgetCompositorDelegate* const delegate_;
209 CompositorDependencies* const compositor_deps_; 216 CompositorDependencies* const compositor_deps_;
217 const bool threaded_;
210 std::unique_ptr<cc::LayerTreeHost> layer_tree_host_; 218 std::unique_ptr<cc::LayerTreeHost> layer_tree_host_;
211 bool never_visible_; 219 bool never_visible_;
212 220
213 blink::WebLayoutAndPaintAsyncCallback* layout_and_paint_async_callback_; 221 blink::WebLayoutAndPaintAsyncCallback* layout_and_paint_async_callback_;
214 std::unique_ptr<cc::CopyOutputRequest> temporary_copy_output_request_; 222 std::unique_ptr<cc::CopyOutputRequest> temporary_copy_output_request_;
215 223
216 cc::RemoteProtoChannel::ProtoReceiver* remote_proto_channel_receiver_; 224 cc::RemoteProtoChannel::ProtoReceiver* remote_proto_channel_receiver_;
217 225
218 base::WeakPtrFactory<RenderWidgetCompositor> weak_factory_; 226 base::WeakPtrFactory<RenderWidgetCompositor> weak_factory_;
219 }; 227 };
220 228
221 } // namespace content 229 } // namespace content
222 230
223 #endif // CONTENT_RENDERER_GPU_RENDER_WIDGET_COMPOSITOR_H_ 231 #endif // CONTENT_RENDERER_GPU_RENDER_WIDGET_COMPOSITOR_H_
OLDNEW
« no previous file with comments | « content/renderer/android/synchronous_compositor_proxy.cc ('k') | content/renderer/gpu/render_widget_compositor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698