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

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

Issue 2547243002: Set device scale factor in CompositorFrame and scale frame size in WS. (Closed)
Patch Set: dsf 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 #include <vector> 10 #include <vector>
(...skipping 28 matching lines...) Expand all
39 class ServerWindow; 39 class ServerWindow;
40 40
41 // Responsible for redrawing the display in response to the redraw requests by 41 // Responsible for redrawing the display in response to the redraw requests by
42 // submitting CompositorFrames to the owned CompositorFrameSink. 42 // submitting CompositorFrames to the owned CompositorFrameSink.
43 class FrameGenerator : public ServerWindowTracker, 43 class FrameGenerator : public ServerWindowTracker,
44 public cc::mojom::MojoCompositorFrameSinkClient { 44 public cc::mojom::MojoCompositorFrameSinkClient {
45 public: 45 public:
46 FrameGenerator(FrameGeneratorDelegate* delegate, ServerWindow* root_window); 46 FrameGenerator(FrameGeneratorDelegate* delegate, ServerWindow* root_window);
47 ~FrameGenerator() override; 47 ~FrameGenerator() override;
48 48
49 void set_device_scale_factor(float device_scale_factor) {
50 device_scale_factor_ = device_scale_factor;
51 }
52
49 // Schedules a redraw for the provided region. 53 // Schedules a redraw for the provided region.
50 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget); 54 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget);
51 55
52 // Adds a reference to new surface with |surface_id| for |window|. This 56 // Adds a reference to new surface with |surface_id| for |window|. This
53 // reference is to ensure the surface is not deleted while it's still being 57 // reference is to ensure the surface is not deleted while it's still being
54 // displayed. The display root surface has a reference from the top level 58 // displayed. The display root surface has a reference from the top level
55 // root. All child surfaces are embedded by the display root and receive a 59 // root. All child surfaces are embedded by the display root and receive a
56 // reference from it. 60 // reference from it.
57 // 61 //
58 // If a new display root Surface is created, then all child surfaces will 62 // If a new display root Surface is created, then all child surfaces will
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 // Removes all retained references to surfaces. 115 // Removes all retained references to surfaces.
112 void RemoveAllSurfaceReferences(); 116 void RemoveAllSurfaceReferences();
113 117
114 cc::mojom::DisplayCompositor* GetDisplayCompositor(); 118 cc::mojom::DisplayCompositor* GetDisplayCompositor();
115 119
116 // ServerWindowObserver implementation. 120 // ServerWindowObserver implementation.
117 void OnWindowDestroying(ServerWindow* window) override; 121 void OnWindowDestroying(ServerWindow* window) override;
118 122
119 FrameGeneratorDelegate* delegate_; 123 FrameGeneratorDelegate* delegate_;
120 ServerWindow* const root_window_; 124 ServerWindow* const root_window_;
125 float device_scale_factor_;
Fady Samuel 2016/12/15 18:27:51 drive-by: Initialize this maybe to 1.0f?
riajiang 2016/12/15 19:01:43 Done.
121 126
122 gfx::Size last_submitted_frame_size_; 127 gfx::Size last_submitted_frame_size_;
123 cc::LocalFrameId local_frame_id_; 128 cc::LocalFrameId local_frame_id_;
124 cc::SurfaceIdAllocator id_allocator_; 129 cc::SurfaceIdAllocator id_allocator_;
125 cc::mojom::MojoCompositorFrameSinkPtr compositor_frame_sink_; 130 cc::mojom::MojoCompositorFrameSinkPtr compositor_frame_sink_;
126 131
127 // Active references held by this client to surfaces that could be embedded in 132 // Active references held by this client to surfaces that could be embedded in
128 // a CompositorFrame submitted from FrameGenerator. 133 // a CompositorFrame submitted from FrameGenerator.
129 std::unordered_map<cc::FrameSinkId, cc::SurfaceReference, cc::FrameSinkIdHash> 134 std::unordered_map<cc::FrameSinkId, cc::SurfaceReference, cc::FrameSinkIdHash>
130 active_references_; 135 active_references_;
(...skipping 17 matching lines...) Expand all
148 base::WeakPtrFactory<FrameGenerator> weak_factory_; 153 base::WeakPtrFactory<FrameGenerator> weak_factory_;
149 154
150 DISALLOW_COPY_AND_ASSIGN(FrameGenerator); 155 DISALLOW_COPY_AND_ASSIGN(FrameGenerator);
151 }; 156 };
152 157
153 } // namespace ws 158 } // namespace ws
154 159
155 } // namespace ui 160 } // namespace ui
156 161
157 #endif // SERVICES_UI_WS_FRAME_GENERATOR_H_ 162 #endif // SERVICES_UI_WS_FRAME_GENERATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698