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

Side by Side Diff: services/ui/ws/frame_generator.h

Issue 2481263002: Introduce Display Compositor mojo interface. Use InProcessContextProvider. (Closed)
Patch Set: Make ContextProvider NON_EXPORTED_BASE of InProcessContextProvider Created 4 years 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 SERVICES_UI_WS_FRAME_GENERATOR_H_ 5 #ifndef SERVICES_UI_WS_FRAME_GENERATOR_H_
6 #define SERVICES_UI_WS_FRAME_GENERATOR_H_ 6 #define SERVICES_UI_WS_FRAME_GENERATOR_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <unordered_map> 9 #include <unordered_map>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/timer/timer.h" 12 #include "base/timer/timer.h"
13 #include "cc/ipc/display_compositor.mojom.h"
13 #include "cc/surfaces/frame_sink_id.h" 14 #include "cc/surfaces/frame_sink_id.h"
14 #include "cc/surfaces/local_frame_id.h" 15 #include "cc/surfaces/local_frame_id.h"
15 #include "cc/surfaces/surface_sequence.h" 16 #include "cc/surfaces/surface_sequence.h"
16 #include "cc/surfaces/surface_sequence_generator.h" 17 #include "cc/surfaces/surface_sequence_generator.h"
17 #include "services/ui/public/interfaces/window_tree_constants.mojom.h" 18 #include "services/ui/public/interfaces/window_tree_constants.mojom.h"
18 #include "services/ui/ws/ids.h" 19 #include "services/ui/ws/ids.h"
20 #include "services/ui/ws/server_window_delegate.h"
19 #include "services/ui/ws/server_window_tracker.h" 21 #include "services/ui/ws/server_window_tracker.h"
20 #include "ui/gfx/geometry/rect.h" 22 #include "ui/gfx/geometry/rect.h"
21 #include "ui/gfx/native_widget_types.h" 23 #include "ui/gfx/native_widget_types.h"
22 24
23 namespace cc { 25 namespace cc {
24 class CompositorFrame; 26 class CompositorFrame;
25 class RenderPass; 27 class RenderPass;
26 class SurfaceId; 28 class SurfaceId;
27 } 29 }
28 30
(...skipping 15 matching lines...) Expand all
44 class ServerWindow; 46 class ServerWindow;
45 47
46 // Responsible for redrawing the display in response to the redraw requests by 48 // Responsible for redrawing the display in response to the redraw requests by
47 // submitting CompositorFrames to the owned CompositorFrameSink. 49 // submitting CompositorFrames to the owned CompositorFrameSink.
48 class FrameGenerator : public ServerWindowTracker, 50 class FrameGenerator : public ServerWindowTracker,
49 public cc::mojom::MojoCompositorFrameSinkClient { 51 public cc::mojom::MojoCompositorFrameSinkClient {
50 public: 52 public:
51 FrameGenerator(FrameGeneratorDelegate* delegate, ServerWindow* root_window); 53 FrameGenerator(FrameGeneratorDelegate* delegate, ServerWindow* root_window);
52 ~FrameGenerator() override; 54 ~FrameGenerator() override;
53 55
54 void OnGpuChannelEstablished(scoped_refptr<gpu::GpuChannelHost> gpu_channel);
55
56 // Schedules a redraw for the provided region. 56 // Schedules a redraw for the provided region.
57 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget); 57 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget);
58 58
59 private: 59 private:
60 friend class ui::ws::test::FrameGeneratorTest; 60 friend class ui::ws::test::FrameGeneratorTest;
61 61
62 // cc::mojom::MojoCompositorFrameSinkClient implementation: 62 // cc::mojom::MojoCompositorFrameSinkClient implementation:
63 void DidReceiveCompositorFrameAck() override; 63 void DidReceiveCompositorFrameAck() override;
64 void OnBeginFrame(const cc::BeginFrameArgs& begin_frame_arags) override; 64 void OnBeginFrame(const cc::BeginFrameArgs& begin_frame_arags) override;
65 void ReclaimResources(const cc::ReturnedResourceArray& resources) override; 65 void ReclaimResources(const cc::ReturnedResourceArray& resources) override;
(...skipping 23 matching lines...) Expand all
89 // Releases any retained references for the provided FrameSink. 89 // Releases any retained references for the provided FrameSink.
90 // TODO(fsamuel, kylechar): This will go away once we get surface lifetime 90 // TODO(fsamuel, kylechar): This will go away once we get surface lifetime
91 // management. 91 // management.
92 void ReleaseFrameSinkReference(const cc::FrameSinkId& frame_sink_id); 92 void ReleaseFrameSinkReference(const cc::FrameSinkId& frame_sink_id);
93 93
94 // Releases all retained references to surfaces. 94 // Releases all retained references to surfaces.
95 // TODO(fsamuel, kylechar): This will go away once we get surface lifetime 95 // TODO(fsamuel, kylechar): This will go away once we get surface lifetime
96 // management. 96 // management.
97 void ReleaseAllSurfaceReferences(); 97 void ReleaseAllSurfaceReferences();
98 98
99 ui::DisplayCompositor* GetDisplayCompositor(); 99 cc::mojom::DisplayCompositor* GetDisplayCompositor();
100 100
101 // ServerWindowObserver implementation. 101 // ServerWindowObserver implementation.
102 void OnWindowDestroying(ServerWindow* window) override; 102 void OnWindowDestroying(ServerWindow* window) override;
103 103
104 FrameGeneratorDelegate* delegate_; 104 FrameGeneratorDelegate* delegate_;
105 cc::FrameSinkId frame_sink_id_; 105 cc::FrameSinkId frame_sink_id_;
106 ServerWindow* const root_window_; 106 ServerWindow* const root_window_;
107 cc::SurfaceSequenceGenerator surface_sequence_generator_; 107 cc::SurfaceSequenceGenerator surface_sequence_generator_;
108 scoped_refptr<gpu::GpuChannelHost> gpu_channel_;
109 108
110 cc::mojom::MojoCompositorFrameSinkPtr compositor_frame_sink_; 109 cc::mojom::MojoCompositorFrameSinkPtr compositor_frame_sink_;
111 gfx::AcceleratedWidget widget_ = gfx::kNullAcceleratedWidget;
112 110
113 struct SurfaceDependency { 111 struct SurfaceDependency {
114 cc::LocalFrameId local_frame_id; 112 cc::LocalFrameId local_frame_id;
115 cc::SurfaceSequence sequence; 113 cc::SurfaceSequence sequence;
116 }; 114 };
117 std::unordered_map<cc::FrameSinkId, SurfaceDependency, cc::FrameSinkIdHash> 115 std::unordered_map<cc::FrameSinkId, SurfaceDependency, cc::FrameSinkIdHash>
118 dependencies_; 116 dependencies_;
119 117
120 mojo::Binding<cc::mojom::MojoCompositorFrameSinkClient> binding_; 118 mojo::Binding<cc::mojom::MojoCompositorFrameSinkClient> binding_;
121 119
122 base::WeakPtrFactory<FrameGenerator> weak_factory_; 120 base::WeakPtrFactory<FrameGenerator> weak_factory_;
123 121
124 DISALLOW_COPY_AND_ASSIGN(FrameGenerator); 122 DISALLOW_COPY_AND_ASSIGN(FrameGenerator);
125 }; 123 };
126 124
127 } // namespace ws 125 } // namespace ws
128 126
129 } // namespace ui 127 } // namespace ui
130 128
131 #endif // SERVICES_UI_WS_FRAME_GENERATOR_H_ 129 #endif // SERVICES_UI_WS_FRAME_GENERATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698