Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 CONTENT_BROWSER_COMPOSITOR_FRAME_SINK_MANAGER_HOST_H_ | 5 #ifndef CONTENT_BROWSER_COMPOSITOR_FRAME_SINK_MANAGER_HOST_H_ |
| 6 #define CONTENT_BROWSER_COMPOSITOR_FRAME_SINK_MANAGER_HOST_H_ | 6 #define CONTENT_BROWSER_COMPOSITOR_FRAME_SINK_MANAGER_HOST_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | |
| 8 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/observer_list.h" | |
| 9 #include "cc/ipc/frame_sink_manager.mojom.h" | 11 #include "cc/ipc/frame_sink_manager.mojom.h" |
| 10 #include "cc/surfaces/frame_sink_id.h" | 12 #include "cc/surfaces/frame_sink_id.h" |
| 13 #include "cc/surfaces/surface_observer.h" | |
| 11 #include "components/viz/frame_sinks/mojo_frame_sink_manager.h" | 14 #include "components/viz/frame_sinks/mojo_frame_sink_manager.h" |
| 15 #include "content/common/content_export.h" | |
| 12 #include "mojo/public/cpp/bindings/binding.h" | 16 #include "mojo/public/cpp/bindings/binding.h" |
| 13 | 17 |
| 14 namespace cc { | 18 namespace cc { |
| 15 class SurfaceInfo; | 19 class SurfaceInfo; |
| 16 class SurfaceManager; | 20 class SurfaceManager; |
| 17 } | 21 } |
| 18 | 22 |
| 19 namespace content { | 23 namespace content { |
| 20 | 24 |
| 21 // Browser side implementation of mojom::FrameSinkManager. Manages frame sinks | 25 // Browser side implementation of mojom::FrameSinkManager. Manages frame sinks |
| 22 // and is inteded to replace SurfaceManager. | 26 // and is intended to replace SurfaceManager. |
| 23 class FrameSinkManagerHost : cc::mojom::FrameSinkManagerClient { | 27 class CONTENT_EXPORT FrameSinkManagerHost |
| 28 : NON_EXPORTED_BASE(cc::mojom::FrameSinkManagerClient) { | |
| 24 public: | 29 public: |
| 25 FrameSinkManagerHost(); | 30 FrameSinkManagerHost(); |
| 26 ~FrameSinkManagerHost() override; | 31 ~FrameSinkManagerHost() override; |
| 27 | 32 |
| 28 cc::SurfaceManager* surface_manager(); | 33 cc::SurfaceManager* surface_manager(); |
| 29 | 34 |
| 35 void AddObserver(cc::SurfaceObserver* observer); | |
|
Fady Samuel
2017/04/11 16:43:53
Maybe I'm being pedantic but SurfaceObserver seems
kylechar
2017/04/11 16:52:39
Ya, I think that's sounds totally reasonable to ha
kylechar
2017/04/11 16:53:30
If so, I should add a TODO saying as much.
Fady Samuel
2017/04/11 17:02:47
It seems like those things are orthogonal.
FrameS
| |
| 36 void RemoveObserver(cc::SurfaceObserver* observer); | |
| 37 | |
| 30 // See frame_sink_manager.mojom for descriptions. | 38 // See frame_sink_manager.mojom for descriptions. |
| 31 void CreateCompositorFrameSink( | 39 void CreateCompositorFrameSink( |
| 32 const cc::FrameSinkId& frame_sink_id, | 40 const cc::FrameSinkId& frame_sink_id, |
| 33 cc::mojom::MojoCompositorFrameSinkRequest request, | 41 cc::mojom::MojoCompositorFrameSinkRequest request, |
| 34 cc::mojom::MojoCompositorFrameSinkPrivateRequest private_request, | 42 cc::mojom::MojoCompositorFrameSinkPrivateRequest private_request, |
| 35 cc::mojom::MojoCompositorFrameSinkClientPtr client); | 43 cc::mojom::MojoCompositorFrameSinkClientPtr client); |
| 36 void RegisterFrameSinkHierarchy(const cc::FrameSinkId& parent_frame_sink_id, | 44 void RegisterFrameSinkHierarchy(const cc::FrameSinkId& parent_frame_sink_id, |
| 37 const cc::FrameSinkId& child_frame_sink_id); | 45 const cc::FrameSinkId& child_frame_sink_id); |
| 38 void UnregisterFrameSinkHierarchy(const cc::FrameSinkId& parent_frame_sink_id, | 46 void UnregisterFrameSinkHierarchy(const cc::FrameSinkId& parent_frame_sink_id, |
| 39 const cc::FrameSinkId& child_frame_sink_id); | 47 const cc::FrameSinkId& child_frame_sink_id); |
| 40 | 48 |
| 41 private: | 49 private: |
| 42 // cc::mojom::FrameSinkManagerClient: | 50 // cc::mojom::FrameSinkManagerClient: |
| 43 void OnSurfaceCreated(const cc::SurfaceInfo& surface_info) override; | 51 void OnSurfaceCreated(const cc::SurfaceInfo& surface_info) override; |
| 44 | 52 |
| 45 // Mojo connection to |frame_sink_manager_|. | 53 // Mojo connection to |frame_sink_manager_|. |
| 46 cc::mojom::FrameSinkManagerPtr frame_sink_manager_ptr_; | 54 cc::mojom::FrameSinkManagerPtr frame_sink_manager_ptr_; |
| 47 | 55 |
| 48 // Mojo connection back from |frame_sink_manager_|. | 56 // Mojo connection back from |frame_sink_manager_|. |
| 49 mojo::Binding<cc::mojom::FrameSinkManagerClient> binding_; | 57 mojo::Binding<cc::mojom::FrameSinkManagerClient> binding_; |
| 50 | 58 |
| 51 // This is owned here so that SurfaceManager will be accessible in process. | 59 // This is owned here so that SurfaceManager will be accessible in process. |
| 52 // Other than using SurfaceManager, access to |frame_sink_manager_| should | 60 // Other than using SurfaceManager, access to |frame_sink_manager_| should |
| 53 // happen using Mojo. See http://crbug.com/657959. | 61 // happen using Mojo. See http://crbug.com/657959. |
| 54 viz::MojoFrameSinkManager frame_sink_manager_; | 62 viz::MojoFrameSinkManager frame_sink_manager_; |
| 55 | 63 |
| 64 base::ObserverList<cc::SurfaceObserver> observers_; | |
| 65 | |
| 56 DISALLOW_COPY_AND_ASSIGN(FrameSinkManagerHost); | 66 DISALLOW_COPY_AND_ASSIGN(FrameSinkManagerHost); |
| 57 }; | 67 }; |
| 58 | 68 |
| 59 } // namespace content | 69 } // namespace content |
| 60 | 70 |
| 61 #endif // CONTENT_BROWSER_COMPOSITOR_FRAME_SINK_MANAGER_HOST_H_ | 71 #endif // CONTENT_BROWSER_COMPOSITOR_FRAME_SINK_MANAGER_HOST_H_ |
| OLD | NEW |