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

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

Issue 2632273003: Move ReferencedSurfaceTracker into GpuCompositorFrameSink. (Closed)
Patch Set: Fix iterator invalidation. Created 3 years, 11 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
« no previous file with comments | « services/ui/surfaces/gpu_compositor_frame_sink.cc ('k') | services/ui/ws/frame_generator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/timer/timer.h" 11 #include "base/timer/timer.h"
12 #include "cc/ipc/display_compositor.mojom.h" 12 #include "cc/ipc/display_compositor.mojom.h"
13 #include "cc/surfaces/embedded_surface_tracker.h"
14 #include "cc/surfaces/frame_sink_id.h" 13 #include "cc/surfaces/frame_sink_id.h"
15 #include "cc/surfaces/surface_id.h" 14 #include "cc/surfaces/surface_id.h"
16 #include "cc/surfaces/surface_id_allocator.h" 15 #include "cc/surfaces/surface_id_allocator.h"
17 #include "cc/surfaces/surface_reference.h" 16 #include "cc/surfaces/surface_reference.h"
18 #include "services/ui/public/interfaces/window_tree_constants.mojom.h" 17 #include "services/ui/public/interfaces/window_tree_constants.mojom.h"
19 #include "services/ui/ws/ids.h" 18 #include "services/ui/ws/ids.h"
20 #include "services/ui/ws/server_window_delegate.h" 19 #include "services/ui/ws/server_window_delegate.h"
21 #include "services/ui/ws/server_window_tracker.h" 20 #include "services/ui/ws/server_window_tracker.h"
22 #include "ui/gfx/geometry/rect.h" 21 #include "ui/gfx/geometry/rect.h"
23 #include "ui/gfx/native_widget_types.h" 22 #include "ui/gfx/native_widget_types.h"
(...skipping 21 matching lines...) Expand all
45 FrameGenerator(FrameGeneratorDelegate* delegate, ServerWindow* root_window); 44 FrameGenerator(FrameGeneratorDelegate* delegate, ServerWindow* root_window);
46 ~FrameGenerator() override; 45 ~FrameGenerator() override;
47 46
48 void set_device_scale_factor(float device_scale_factor) { 47 void set_device_scale_factor(float device_scale_factor) {
49 device_scale_factor_ = device_scale_factor; 48 device_scale_factor_ = device_scale_factor;
50 } 49 }
51 50
52 // Schedules a redraw for the provided region. 51 // Schedules a redraw for the provided region.
53 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget); 52 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget);
54 53
55 // Adds a reference to new surface with |surface_id| for |window|. This 54 // If |window| corresponds to the active WM for the display then update
56 // reference is to ensure the surface is not deleted while it's still being 55 // |window_manager_surface_id_|.
57 // displayed. The display root surface has a reference from the top level
58 // root. All child surfaces are embedded by the display root and receive a
59 // reference from it.
60 //
61 // If a new display root Surface is created, then all child surfaces will
62 // receive a reference from the new display root so they are not deleted with
63 // the old display root.
64 //
65 // If there is an existing reference to an old surface with the same
66 // FrameSinkId then that reference will be removed after the next
67 // CompositorFrame is submitted.
68 void OnSurfaceCreated(const cc::SurfaceId& surface_id, ServerWindow* window); 56 void OnSurfaceCreated(const cc::SurfaceId& surface_id, ServerWindow* window);
69 57
70 private: 58 private:
71 friend class ui::ws::test::FrameGeneratorTest; 59 friend class ui::ws::test::FrameGeneratorTest;
72 60
73 // cc::mojom::MojoCompositorFrameSinkClient implementation: 61 // cc::mojom::MojoCompositorFrameSinkClient implementation:
74 void DidReceiveCompositorFrameAck() override; 62 void DidReceiveCompositorFrameAck() override;
75 void OnBeginFrame(const cc::BeginFrameArgs& begin_frame_arags) override; 63 void OnBeginFrame(const cc::BeginFrameArgs& begin_frame_arags) override;
76 void ReclaimResources(const cc::ReturnedResourceArray& resources) override; 64 void ReclaimResources(const cc::ReturnedResourceArray& resources) override;
77 void WillDrawSurface() override; 65 void WillDrawSurface() override;
78 66
79 // Updates the display surface SurfaceId using new value in |local_frame_id_|.
80 void UpdateDisplaySurfaceId();
81
82 // Generates the CompositorFrame. 67 // Generates the CompositorFrame.
83 cc::CompositorFrame GenerateCompositorFrame(const gfx::Rect& output_rect); 68 cc::CompositorFrame GenerateCompositorFrame(const gfx::Rect& output_rect);
84 69
85 // DrawWindow creates SurfaceDrawQuad for the provided ServerWindow and 70 // DrawWindow creates SurfaceDrawQuad for the provided ServerWindow and
86 // appends it to the provided cc::RenderPass. 71 // appends it to the provided cc::RenderPass.
87 void DrawWindow(cc::RenderPass* pass, ServerWindow* window); 72 void DrawWindow(cc::RenderPass* pass, ServerWindow* window);
88 73
89 // ServerWindowObserver implementation. 74 // ServerWindowObserver implementation.
90 void OnWindowDestroying(ServerWindow* window) override; 75 void OnWindowDestroying(ServerWindow* window) override;
91 76
92 FrameGeneratorDelegate* delegate_; 77 FrameGeneratorDelegate* delegate_;
93 ServerWindow* const root_window_; 78 ServerWindow* const root_window_;
94 float device_scale_factor_ = 1.f; 79 float device_scale_factor_ = 1.f;
95 80
96 gfx::Size last_submitted_frame_size_; 81 gfx::Size last_submitted_frame_size_;
97 cc::LocalFrameId local_frame_id_; 82 cc::LocalFrameId local_frame_id_;
98 cc::SurfaceIdAllocator id_allocator_; 83 cc::SurfaceIdAllocator id_allocator_;
99 cc::mojom::MojoCompositorFrameSinkPtr compositor_frame_sink_; 84 cc::mojom::MojoCompositorFrameSinkPtr compositor_frame_sink_;
100 cc::mojom::DisplayPrivatePtr display_private_; 85 cc::mojom::DisplayPrivatePtr display_private_;
101 86
102 // Tracks surface references for embedded surfaces. 87 cc::SurfaceId window_manager_surface_id_;
103 cc::EmbeddedSurfaceTracker surface_tracker_;
104 88
105 mojo::Binding<cc::mojom::MojoCompositorFrameSinkClient> binding_; 89 mojo::Binding<cc::mojom::MojoCompositorFrameSinkClient> binding_;
106 90
107 base::WeakPtrFactory<FrameGenerator> weak_factory_; 91 base::WeakPtrFactory<FrameGenerator> weak_factory_;
108 92
109 DISALLOW_COPY_AND_ASSIGN(FrameGenerator); 93 DISALLOW_COPY_AND_ASSIGN(FrameGenerator);
110 }; 94 };
111 95
112 } // namespace ws 96 } // namespace ws
113 97
114 } // namespace ui 98 } // namespace ui
115 99
116 #endif // SERVICES_UI_WS_FRAME_GENERATOR_H_ 100 #endif // SERVICES_UI_WS_FRAME_GENERATOR_H_
OLDNEW
« no previous file with comments | « services/ui/surfaces/gpu_compositor_frame_sink.cc ('k') | services/ui/ws/frame_generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698