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

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

Issue 2481263002: Introduce Display Compositor mojo interface. Use InProcessContextProvider. (Closed)
Patch Set: Speculative fix for android build issue Created 4 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 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/surface_id.h" 15 #include "cc/surfaces/surface_id.h"
15 #include "services/ui/public/interfaces/window_tree_constants.mojom.h" 16 #include "services/ui/public/interfaces/window_tree_constants.mojom.h"
16 #include "services/ui/ws/ids.h" 17 #include "services/ui/ws/ids.h"
18 #include "services/ui/ws/server_window_delegate.h"
17 #include "services/ui/ws/server_window_tracker.h" 19 #include "services/ui/ws/server_window_tracker.h"
18 #include "ui/gfx/geometry/rect.h" 20 #include "ui/gfx/geometry/rect.h"
19 #include "ui/gfx/native_widget_types.h" 21 #include "ui/gfx/native_widget_types.h"
20 22
21 namespace cc { 23 namespace cc {
22 class CompositorFrame; 24 class CompositorFrame;
23 class RenderPass; 25 class RenderPass;
24 class SurfaceId; 26 class SurfaceId;
25 } 27 }
26 28
(...skipping 15 matching lines...) Expand all
42 class ServerWindow; 44 class ServerWindow;
43 45
44 // Responsible for redrawing the display in response to the redraw requests by 46 // Responsible for redrawing the display in response to the redraw requests by
45 // submitting CompositorFrames to the owned CompositorFrameSink. 47 // submitting CompositorFrames to the owned CompositorFrameSink.
46 class FrameGenerator : public ServerWindowTracker, 48 class FrameGenerator : public ServerWindowTracker,
47 public cc::mojom::MojoCompositorFrameSinkClient { 49 public cc::mojom::MojoCompositorFrameSinkClient {
48 public: 50 public:
49 FrameGenerator(FrameGeneratorDelegate* delegate, ServerWindow* root_window); 51 FrameGenerator(FrameGeneratorDelegate* delegate, ServerWindow* root_window);
50 ~FrameGenerator() override; 52 ~FrameGenerator() override;
51 53
52 void OnGpuChannelEstablished(scoped_refptr<gpu::GpuChannelHost> gpu_channel);
53
54 // Schedules a redraw for the provided region. 54 // Schedules a redraw for the provided region.
55 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget); 55 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget);
56 56
57 // Adds a reference to new surface with |surface_id| for |window|. This 57 // Adds a reference to new surface with |surface_id| for |window|. This
58 // reference is to ensure the surface is not deleted while it's still being 58 // reference is to ensure the surface is not deleted while it's still being
59 // displayed. The display root surface has a reference from the top level 59 // displayed. The display root surface has a reference from the top level
60 // root. All child surfaces are embedded by the display root and receive a 60 // root. All child surfaces are embedded by the display root and receive a
61 // reference from it. 61 // reference from it.
62 // 62 //
63 // If a new display root Surface is created, then all child surfaces will 63 // If a new display root Surface is created, then all child surfaces will
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 105
106 // Removes all references to surfaces in |dead_references_|. 106 // Removes all references to surfaces in |dead_references_|.
107 void RemoveDeadSurfaceReferences(); 107 void RemoveDeadSurfaceReferences();
108 108
109 // Removes any retained references for the provided FrameSink. 109 // Removes any retained references for the provided FrameSink.
110 void RemoveFrameSinkReference(const cc::FrameSinkId& frame_sink_id); 110 void RemoveFrameSinkReference(const cc::FrameSinkId& frame_sink_id);
111 111
112 // Removes all retained references to surfaces. 112 // Removes all retained references to surfaces.
113 void RemoveAllSurfaceReferences(); 113 void RemoveAllSurfaceReferences();
114 114
115 ui::DisplayCompositor* GetDisplayCompositor(); 115 cc::mojom::DisplayCompositor* GetDisplayCompositor();
116 116
117 // ServerWindowObserver implementation. 117 // ServerWindowObserver implementation.
118 void OnWindowDestroying(ServerWindow* window) override; 118 void OnWindowDestroying(ServerWindow* window) override;
119 119
120 FrameGeneratorDelegate* delegate_; 120 FrameGeneratorDelegate* delegate_;
121 ServerWindow* const root_window_; 121 ServerWindow* const root_window_;
122 scoped_refptr<gpu::GpuChannelHost> gpu_channel_;
123 122
124 cc::mojom::MojoCompositorFrameSinkPtr compositor_frame_sink_; 123 cc::mojom::MojoCompositorFrameSinkPtr compositor_frame_sink_;
125 gfx::AcceleratedWidget widget_ = gfx::kNullAcceleratedWidget;
126 124
127 // Represents the top level root surface id that should reference the display 125 // Represents the top level root surface id that should reference the display
128 // root surface. We don't know the actual value, because it's generated in 126 // root surface. We don't know the actual value, because it's generated in
129 // another process, this is used internally as a placeholder. 127 // another process, this is used internally as a placeholder.
130 const cc::SurfaceId top_level_root_surface_id_; 128 const cc::SurfaceId top_level_root_surface_id_;
131 129
132 struct SurfaceReference { 130 struct SurfaceReference {
133 cc::SurfaceId parent_id; 131 cc::SurfaceId parent_id;
134 cc::SurfaceId child_id; 132 cc::SurfaceId child_id;
135 }; 133 };
(...skipping 18 matching lines...) Expand all
154 base::WeakPtrFactory<FrameGenerator> weak_factory_; 152 base::WeakPtrFactory<FrameGenerator> weak_factory_;
155 153
156 DISALLOW_COPY_AND_ASSIGN(FrameGenerator); 154 DISALLOW_COPY_AND_ASSIGN(FrameGenerator);
157 }; 155 };
158 156
159 } // namespace ws 157 } // namespace ws
160 158
161 } // namespace ui 159 } // namespace ui
162 160
163 #endif // SERVICES_UI_WS_FRAME_GENERATOR_H_ 161 #endif // SERVICES_UI_WS_FRAME_GENERATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698