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

Side by Side Diff: services/ui/surfaces/mojo_frame_sink_manager.h

Issue 2797453002: Rename DisplayCompositor to MojoFrameSinkManager. (Closed)
Patch Set: Rebase. Created 3 years, 8 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
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_SURFACES_DISPLAY_COMPOSITOR_H_ 5 #ifndef SERVICES_UI_SURFACES_MOJO_FRAME_SINK_MANAGER_H_
6 #define SERVICES_UI_SURFACES_DISPLAY_COMPOSITOR_H_ 6 #define SERVICES_UI_SURFACES_MOJO_FRAME_SINK_MANAGER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <unordered_map> 11 #include <unordered_map>
12 12
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/threading/thread_checker.h" 14 #include "base/threading/thread_checker.h"
15 #include "cc/ipc/display_compositor.mojom.h" 15 #include "cc/ipc/frame_sink_manager.mojom.h"
16 #include "cc/surfaces/frame_sink_id.h" 16 #include "cc/surfaces/frame_sink_id.h"
17 #include "cc/surfaces/surface_manager.h" 17 #include "cc/surfaces/surface_manager.h"
18 #include "cc/surfaces/surface_observer.h" 18 #include "cc/surfaces/surface_observer.h"
19 #include "components/display_compositor/gpu_compositor_frame_sink_delegate.h" 19 #include "components/display_compositor/gpu_compositor_frame_sink_delegate.h"
20 #include "gpu/ipc/common/surface_handle.h" 20 #include "gpu/ipc/common/surface_handle.h"
21 #include "mojo/public/cpp/bindings/binding.h" 21 #include "mojo/public/cpp/bindings/binding.h"
22 22
23 namespace ui { 23 namespace ui {
24 24
25 class DisplayProvider; 25 class DisplayProvider;
26 26
27 // The DisplayCompositor object is an object global to the Window Server app 27 // MojoFrameSinkManager manages state associated with CompositorFrameSinks. It
28 // that holds the SurfaceServer and allocates new Surfaces namespaces. 28 // provides a Mojo interface to create CompositorFrameSinks, manages BeginFrame
29 // This object lives on the main thread of the Window Server. 29 // hierarchy and manages surface lifetime.
30 // TODO(rjkroege, fsamuel): This object will need to change to support multiple 30 //
31 // displays. 31 // This is intended to be created in the viz or GPU process. For mus+ash this
32 class DisplayCompositor 32 // will be true after the mus process split. For non-mus Chrome this will be
33 // created in the browser process, at least until GPU implementations can be
34 // unified.
35 class MojoFrameSinkManager
33 : public cc::SurfaceObserver, 36 : public cc::SurfaceObserver,
34 public display_compositor::GpuCompositorFrameSinkDelegate, 37 public display_compositor::GpuCompositorFrameSinkDelegate,
35 public cc::mojom::DisplayCompositor { 38 public cc::mojom::FrameSinkManager {
36 public: 39 public:
37 DisplayCompositor(DisplayProvider* display_provider, 40 MojoFrameSinkManager(DisplayProvider* display_provider,
38 cc::mojom::DisplayCompositorRequest request, 41 cc::mojom::FrameSinkManagerRequest request,
39 cc::mojom::DisplayCompositorClientPtr client); 42 cc::mojom::FrameSinkManagerClientPtr client);
40 ~DisplayCompositor() override; 43 ~MojoFrameSinkManager() override;
41 44
42 cc::SurfaceManager* manager() { return &manager_; } 45 cc::SurfaceManager* manager() { return &manager_; }
43 46
44 // cc::mojom::DisplayCompositor implementation: 47 // cc::mojom::MojoFrameSinkManager implementation:
45 void CreateRootCompositorFrameSink( 48 void CreateRootCompositorFrameSink(
46 const cc::FrameSinkId& frame_sink_id, 49 const cc::FrameSinkId& frame_sink_id,
47 gpu::SurfaceHandle surface_handle, 50 gpu::SurfaceHandle surface_handle,
48 cc::mojom::MojoCompositorFrameSinkAssociatedRequest request, 51 cc::mojom::MojoCompositorFrameSinkAssociatedRequest request,
49 cc::mojom::MojoCompositorFrameSinkPrivateRequest private_request, 52 cc::mojom::MojoCompositorFrameSinkPrivateRequest private_request,
50 cc::mojom::MojoCompositorFrameSinkClientPtr client, 53 cc::mojom::MojoCompositorFrameSinkClientPtr client,
51 cc::mojom::DisplayPrivateAssociatedRequest display_private_request) 54 cc::mojom::DisplayPrivateAssociatedRequest display_private_request)
52 override; 55 override;
53 void CreateCompositorFrameSink( 56 void CreateCompositorFrameSink(
54 const cc::FrameSinkId& frame_sink_id, 57 const cc::FrameSinkId& frame_sink_id,
(...skipping 22 matching lines...) Expand all
77 bool* changed) override; 80 bool* changed) override;
78 81
79 // display_compositor::GpuCompositorFrameSinkDelegate implementation. 82 // display_compositor::GpuCompositorFrameSinkDelegate implementation.
80 void OnClientConnectionLost(const cc::FrameSinkId& frame_sink_id, 83 void OnClientConnectionLost(const cc::FrameSinkId& frame_sink_id,
81 bool destroy_compositor_frame_sink) override; 84 bool destroy_compositor_frame_sink) override;
82 void OnPrivateConnectionLost(const cc::FrameSinkId& frame_sink_id, 85 void OnPrivateConnectionLost(const cc::FrameSinkId& frame_sink_id,
83 bool destroy_compositor_frame_sink) override; 86 bool destroy_compositor_frame_sink) override;
84 87
85 // SurfaceManager should be the first object constructed and the last object 88 // SurfaceManager should be the first object constructed and the last object
86 // destroyed in order to ensure that all other objects that depend on it have 89 // destroyed in order to ensure that all other objects that depend on it have
87 // access to a valid pointer for the entirety of their liftimes. 90 // access to a valid pointer for the entirety of their lifetimes.
88 cc::SurfaceManager manager_; 91 cc::SurfaceManager manager_;
89 92
90 // Provides a cc::Display for CreateRootCompositorFrameSink(). 93 // Provides a cc::Display for CreateRootCompositorFrameSink().
91 DisplayProvider* const display_provider_; 94 DisplayProvider* const display_provider_;
92 95
93 std::unordered_map<cc::FrameSinkId, 96 std::unordered_map<cc::FrameSinkId,
94 std::unique_ptr<cc::mojom::MojoCompositorFrameSink>, 97 std::unique_ptr<cc::mojom::MojoCompositorFrameSink>,
95 cc::FrameSinkIdHash> 98 cc::FrameSinkIdHash>
96 compositor_frame_sinks_; 99 compositor_frame_sinks_;
97 100
98 base::ThreadChecker thread_checker_; 101 base::ThreadChecker thread_checker_;
99 102
100 cc::mojom::DisplayCompositorClientPtr client_; 103 cc::mojom::FrameSinkManagerClientPtr client_;
101 mojo::Binding<cc::mojom::DisplayCompositor> binding_; 104 mojo::Binding<cc::mojom::FrameSinkManager> binding_;
102 105
103 DISALLOW_COPY_AND_ASSIGN(DisplayCompositor); 106 DISALLOW_COPY_AND_ASSIGN(MojoFrameSinkManager);
104 }; 107 };
105 108
106 } // namespace ui 109 } // namespace ui
107 110
108 #endif // SERVICES_UI_SURFACES_DISPLAY_COMPOSITOR_H_ 111 #endif // SERVICES_UI_SURFACES_MOJO_FRAME_SINK_MANAGER_H_
OLDNEW
« no previous file with comments | « services/ui/surfaces/display_provider.h ('k') | services/ui/surfaces/mojo_frame_sink_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698