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

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

Issue 1442853005: Add IPC messages to transfer compositor protos (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Swapped char to uint8_t, added checked_cast, updated description Created 5 years, 1 month 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 "base/callback.h" 8 #include "base/callback.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
11 #include "base/values.h" 11 #include "base/values.h"
12 #include "cc/input/top_controls_state.h" 12 #include "cc/input/top_controls_state.h"
13 #include "cc/output/managed_memory_policy.h" 13 #include "cc/output/managed_memory_policy.h"
14 #include "cc/output/swap_promise.h" 14 #include "cc/output/swap_promise.h"
15 #include "cc/trees/layer_tree_host_client.h" 15 #include "cc/trees/layer_tree_host_client.h"
16 #include "cc/trees/layer_tree_host_single_thread_client.h" 16 #include "cc/trees/layer_tree_host_single_thread_client.h"
17 #include "cc/trees/layer_tree_settings.h" 17 #include "cc/trees/layer_tree_settings.h"
18 #include "cc/trees/remote_proto_channel.h"
18 #include "cc/trees/swap_promise_monitor.h" 19 #include "cc/trees/swap_promise_monitor.h"
19 #include "content/common/content_export.h" 20 #include "content/common/content_export.h"
20 #include "content/renderer/gpu/compositor_dependencies.h" 21 #include "content/renderer/gpu/compositor_dependencies.h"
21 #include "third_party/WebKit/public/platform/WebLayerTreeView.h" 22 #include "third_party/WebKit/public/platform/WebLayerTreeView.h"
22 #include "third_party/skia/include/core/SkBitmap.h" 23 #include "third_party/skia/include/core/SkBitmap.h"
23 #include "ui/gfx/geometry/rect.h" 24 #include "ui/gfx/geometry/rect.h"
24 25
25 namespace ui { 26 namespace ui {
26 class LatencyInfo; 27 class LatencyInfo;
27 } 28 }
28 29
29 namespace cc { 30 namespace cc {
30 class CopyOutputRequest; 31 class CopyOutputRequest;
31 class InputHandler; 32 class InputHandler;
32 class Layer; 33 class Layer;
33 class LayerTreeHost; 34 class LayerTreeHost;
35
36 namespace proto {
37 class CompositorMessage;
38 }
39
34 } 40 }
35 41
36 namespace content { 42 namespace content {
37 class RenderWidget; 43 class RenderWidget;
38 44
39 class CONTENT_EXPORT RenderWidgetCompositor 45 class CONTENT_EXPORT RenderWidgetCompositor
40 : NON_EXPORTED_BASE(public blink::WebLayerTreeView), 46 : NON_EXPORTED_BASE(public blink::WebLayerTreeView),
41 NON_EXPORTED_BASE(public cc::LayerTreeHostClient), 47 NON_EXPORTED_BASE(public cc::LayerTreeHostClient),
42 NON_EXPORTED_BASE(public cc::LayerTreeHostSingleThreadClient) { 48 NON_EXPORTED_BASE(public cc::LayerTreeHostSingleThreadClient),
49 NON_EXPORTED_BASE(public cc::RemoteProtoChannel) {
43 public: 50 public:
44 // Attempt to construct and initialize a compositor instance for the widget 51 // Attempt to construct and initialize a compositor instance for the widget
45 // with the given settings. Returns NULL if initialization fails. 52 // with the given settings. Returns NULL if initialization fails.
46 static scoped_ptr<RenderWidgetCompositor> Create( 53 static scoped_ptr<RenderWidgetCompositor> Create(
47 RenderWidget* widget, 54 RenderWidget* widget,
48 CompositorDependencies* compositor_deps); 55 CompositorDependencies* compositor_deps);
49 56
50 ~RenderWidgetCompositor() override; 57 ~RenderWidgetCompositor() override;
51 58
52 void SetNeverVisible(); 59 void SetNeverVisible();
(...skipping 19 matching lines...) Expand all
72 void SetNeedsUpdateLayers(); 79 void SetNeedsUpdateLayers();
73 void SetNeedsCommit(); 80 void SetNeedsCommit();
74 void NotifyInputThrottledUntilCommit(); 81 void NotifyInputThrottledUntilCommit();
75 const cc::Layer* GetRootLayer() const; 82 const cc::Layer* GetRootLayer() const;
76 int ScheduleMicroBenchmark( 83 int ScheduleMicroBenchmark(
77 const std::string& name, 84 const std::string& name,
78 scoped_ptr<base::Value> value, 85 scoped_ptr<base::Value> value,
79 const base::Callback<void(scoped_ptr<base::Value>)>& callback); 86 const base::Callback<void(scoped_ptr<base::Value>)>& callback);
80 bool SendMessageToMicroBenchmark(int id, scoped_ptr<base::Value> value); 87 bool SendMessageToMicroBenchmark(int id, scoped_ptr<base::Value> value);
81 void SetSurfaceIdNamespace(uint32_t surface_id_namespace); 88 void SetSurfaceIdNamespace(uint32_t surface_id_namespace);
89 void OnHandleCompositorProto(const std::vector<uint8_t>& proto);
82 cc::ManagedMemoryPolicy GetGpuMemoryPolicy( 90 cc::ManagedMemoryPolicy GetGpuMemoryPolicy(
83 const cc::ManagedMemoryPolicy& policy); 91 const cc::ManagedMemoryPolicy& policy);
84 void SetPaintedDeviceScaleFactor(float device_scale); 92 void SetPaintedDeviceScaleFactor(float device_scale);
85 93
86 // WebLayerTreeView implementation. 94 // WebLayerTreeView implementation.
87 void setRootLayer(const blink::WebLayer& layer) override; 95 void setRootLayer(const blink::WebLayer& layer) override;
88 void clearRootLayer() override; 96 void clearRootLayer() override;
89 void attachCompositorAnimationTimeline( 97 void attachCompositorAnimationTimeline(
90 blink::WebCompositorAnimationTimeline* compositor_timeline) override; 98 blink::WebCompositorAnimationTimeline* compositor_timeline) override;
91 void detachCompositorAnimationTimeline( 99 void detachCompositorAnimationTimeline(
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 void RecordFrameTimingEvents( 165 void RecordFrameTimingEvents(
158 scoped_ptr<cc::FrameTimingTracker::CompositeTimingSet> composite_events, 166 scoped_ptr<cc::FrameTimingTracker::CompositeTimingSet> composite_events,
159 scoped_ptr<cc::FrameTimingTracker::MainFrameTimingSet> main_frame_events) 167 scoped_ptr<cc::FrameTimingTracker::MainFrameTimingSet> main_frame_events)
160 override; 168 override;
161 169
162 // cc::LayerTreeHostSingleThreadClient implementation. 170 // cc::LayerTreeHostSingleThreadClient implementation.
163 void ScheduleAnimation() override; 171 void ScheduleAnimation() override;
164 void DidPostSwapBuffers() override; 172 void DidPostSwapBuffers() override;
165 void DidAbortSwapBuffers() override; 173 void DidAbortSwapBuffers() override;
166 174
175 // cc::RemoteProtoChannel implementation.
176 void SetProtoReceiver(ProtoReceiver* receiver) override;
177 void SendCompositorProto(const cc::proto::CompositorMessage& proto) override;
178
167 enum { 179 enum {
168 OUTPUT_SURFACE_RETRIES_BEFORE_FALLBACK = 4, 180 OUTPUT_SURFACE_RETRIES_BEFORE_FALLBACK = 4,
169 MAX_OUTPUT_SURFACE_RETRIES = 5, 181 MAX_OUTPUT_SURFACE_RETRIES = 5,
170 }; 182 };
171 183
172 protected: 184 protected:
173 RenderWidgetCompositor(RenderWidget* widget, 185 RenderWidgetCompositor(RenderWidget* widget,
174 CompositorDependencies* compositor_deps); 186 CompositorDependencies* compositor_deps);
175 187
176 void Initialize(); 188 void Initialize();
177 cc::LayerTreeHost* layer_tree_host() { return layer_tree_host_.get(); } 189 cc::LayerTreeHost* layer_tree_host() { return layer_tree_host_.get(); }
178 190
179 private: 191 private:
180 void LayoutAndUpdateLayers(); 192 void LayoutAndUpdateLayers();
181 void InvokeLayoutAndPaintCallback(); 193 void InvokeLayoutAndPaintCallback();
182 bool CompositeIsSynchronous() const; 194 bool CompositeIsSynchronous() const;
183 void SynchronouslyComposite(); 195 void SynchronouslyComposite();
184 196
185 int num_failed_recreate_attempts_; 197 int num_failed_recreate_attempts_;
186 RenderWidget* widget_; 198 RenderWidget* widget_;
187 CompositorDependencies* compositor_deps_; 199 CompositorDependencies* compositor_deps_;
188 scoped_ptr<cc::LayerTreeHost> layer_tree_host_; 200 scoped_ptr<cc::LayerTreeHost> layer_tree_host_;
189 bool never_visible_; 201 bool never_visible_;
190 202
191 blink::WebLayoutAndPaintAsyncCallback* layout_and_paint_async_callback_; 203 blink::WebLayoutAndPaintAsyncCallback* layout_and_paint_async_callback_;
192 scoped_ptr<cc::CopyOutputRequest> temporary_copy_output_request_; 204 scoped_ptr<cc::CopyOutputRequest> temporary_copy_output_request_;
193 205
206 cc::RemoteProtoChannel::ProtoReceiver* remote_proto_channel_receiver_;
207
194 base::WeakPtrFactory<RenderWidgetCompositor> weak_factory_; 208 base::WeakPtrFactory<RenderWidgetCompositor> weak_factory_;
195 }; 209 };
196 210
197 } // namespace content 211 } // namespace content
198 212
199 #endif // CONTENT_RENDERER_GPU_RENDER_WIDGET_COMPOSITOR_H_ 213 #endif // CONTENT_RENDERER_GPU_RENDER_WIDGET_COMPOSITOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698