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

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

Issue 2471503002: Mus+Ash: Unify CompositorFrameSinks (Closed)
Patch Set: Remove unnecessary FrameGenerator::DidDraw 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_SERVER_WINDOW_COMPOSITOR_FRAME_SINK_H_ 5 #ifndef SERVICES_UI_WS_SERVER_WINDOW_COMPOSITOR_FRAME_SINK_H_
6 #define SERVICES_UI_WS_SERVER_WINDOW_COMPOSITOR_FRAME_SINK_H_ 6 #define SERVICES_UI_WS_SERVER_WINDOW_COMPOSITOR_FRAME_SINK_H_
7 7
8 #include <set> 8 #include <set>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "cc/ipc/compositor_frame.mojom.h" 11 #include "cc/ipc/compositor_frame.mojom.h"
12 #include "cc/ipc/mojo_compositor_frame_sink.mojom.h" 12 #include "cc/ipc/mojo_compositor_frame_sink.mojom.h"
13 #include "cc/output/context_provider.h"
14 #include "cc/surfaces/display.h"
15 #include "cc/surfaces/display_client.h"
13 #include "cc/surfaces/frame_sink_id.h" 16 #include "cc/surfaces/frame_sink_id.h"
14 #include "cc/surfaces/surface_factory.h" 17 #include "cc/surfaces/surface_factory.h"
15 #include "cc/surfaces/surface_factory_client.h" 18 #include "cc/surfaces/surface_factory_client.h"
16 #include "cc/surfaces/surface_id.h" 19 #include "cc/surfaces/surface_id.h"
17 #include "cc/surfaces/surface_id_allocator.h" 20 #include "cc/surfaces/surface_id_allocator.h"
18 #include "mojo/public/cpp/bindings/binding.h" 21 #include "mojo/public/cpp/bindings/binding.h"
19 #include "services/ui/public/interfaces/window_tree.mojom.h" 22 #include "services/ui/public/interfaces/window_tree.mojom.h"
23 #include "services/ui/surfaces/surfaces_context_provider.h"
20 #include "services/ui/ws/ids.h" 24 #include "services/ui/ws/ids.h"
21 25
26 namespace gpu {
27 class GpuMemoryBufferManager;
28 }
29
22 namespace ui { 30 namespace ui {
23 31
24 class DisplayCompositor; 32 class DisplayCompositor;
25 33
26 namespace ws { 34 namespace ws {
27 35
28 class ServerWindow; 36 class ServerWindow;
29 class ServerWindowCompositorFrameSinkManager; 37 class ServerWindowCompositorFrameSinkManager;
30 38
31 // Server side representation of a WindowSurface. 39 // Server side representation of a WindowSurface.
32 class ServerWindowCompositorFrameSink 40 class ServerWindowCompositorFrameSink
33 : public cc::mojom::MojoCompositorFrameSink, 41 : public cc::mojom::MojoCompositorFrameSink,
42 public cc::DisplayClient,
34 public cc::SurfaceFactoryClient { 43 public cc::SurfaceFactoryClient {
35 public: 44 public:
36 ServerWindowCompositorFrameSink( 45 ServerWindowCompositorFrameSink(
37 ServerWindowCompositorFrameSinkManager* manager, 46 ServerWindowCompositorFrameSinkManager* manager,
38 const cc::FrameSinkId& frame_sink_id, 47 const cc::FrameSinkId& frame_sink_id,
48 gfx::AcceleratedWidget widget,
49 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
50 scoped_refptr<SurfacesContextProvider> context_provider,
39 cc::mojom::MojoCompositorFrameSinkRequest request, 51 cc::mojom::MojoCompositorFrameSinkRequest request,
40 cc::mojom::MojoCompositorFrameSinkClientPtr client); 52 cc::mojom::MojoCompositorFrameSinkClientPtr client);
41 53
42 ~ServerWindowCompositorFrameSink() override; 54 ~ServerWindowCompositorFrameSink() override;
43 55
44 // cc::mojom::MojoCompositorFrameSink: 56 // cc::mojom::MojoCompositorFrameSink:
45 void SetNeedsBeginFrame(bool needs_begin_frame) override; 57 void SetNeedsBeginFrame(bool needs_begin_frame) override;
46 void SubmitCompositorFrame(cc::CompositorFrame frame) override; 58 void SubmitCompositorFrame(cc::CompositorFrame frame) override;
47 59
48 private: 60 private:
61 void InitDisplay(gfx::AcceleratedWidget widget,
62 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
63 scoped_refptr<SurfacesContextProvider> context_provider);
64
49 void DidReceiveCompositorFrameAck(); 65 void DidReceiveCompositorFrameAck();
50 66
67 // DisplayClient implementation.
68 void DisplayOutputSurfaceLost() override;
69 void DisplayWillDrawAndSwap(bool will_draw_and_swap,
70 const cc::RenderPassList& render_passes) override;
71 void DisplayDidDrawAndSwap() override;
72
51 // SurfaceFactoryClient implementation. 73 // SurfaceFactoryClient implementation.
52 void ReturnResources(const cc::ReturnedResourceArray& resources) override; 74 void ReturnResources(const cc::ReturnedResourceArray& resources) override;
53 void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override; 75 void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override;
54 76
55 const cc::FrameSinkId frame_sink_id_; 77 const cc::FrameSinkId frame_sink_id_;
78 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
56 79
57 ServerWindowCompositorFrameSinkManager* manager_; // Owns this. 80 ServerWindowCompositorFrameSinkManager* manager_; // Owns this.
58 81
59 gfx::Size last_submitted_frame_size_; 82 gfx::Size last_submitted_frame_size_;
83 std::unique_ptr<cc::Display> display_;
kylechar 2016/11/02 13:22:36 Can you add a comment for when SWCFS owns a cc::Di
Fady Samuel 2016/11/02 13:48:18 Done.
60 84
61 cc::LocalFrameId local_frame_id_; 85 cc::LocalFrameId local_frame_id_;
62 cc::SurfaceIdAllocator surface_id_allocator_; 86 cc::SurfaceIdAllocator surface_id_allocator_;
63 cc::SurfaceFactory surface_factory_; 87 cc::SurfaceFactory surface_factory_;
64 // Counts the number of CompositorFrames that have been submitted and have not 88 // Counts the number of CompositorFrames that have been submitted and have not
65 // yet received an ACK. 89 // yet received an ACK.
66 int ack_pending_count_ = 0; 90 int ack_pending_count_ = 0;
67 cc::ReturnedResourceArray surface_returned_resources_; 91 cc::ReturnedResourceArray surface_returned_resources_;
68 92
69 cc::mojom::MojoCompositorFrameSinkClientPtr client_; 93 cc::mojom::MojoCompositorFrameSinkClientPtr client_;
70 mojo::Binding<MojoCompositorFrameSink> binding_; 94 mojo::Binding<MojoCompositorFrameSink> binding_;
71 95
72 DISALLOW_COPY_AND_ASSIGN(ServerWindowCompositorFrameSink); 96 DISALLOW_COPY_AND_ASSIGN(ServerWindowCompositorFrameSink);
73 }; 97 };
74 98
75 } // namespace ws 99 } // namespace ws
76 100
77 } // namespace ui 101 } // namespace ui
78 102
79 #endif // SERVICES_UI_WS_SERVER_WINDOW_COMPOSITOR_FRAME_SINK_H_ 103 #endif // SERVICES_UI_WS_SERVER_WINDOW_COMPOSITOR_FRAME_SINK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698