OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CONTENT_RENDERER_MUS_RENDER_WIDGET_MUS_CONNECTION_H_ | |
6 #define CONTENT_RENDERER_MUS_RENDER_WIDGET_MUS_CONNECTION_H_ | |
7 | |
8 #include "base/macros.h" | |
9 #include "base/threading/thread_checker.h" | |
10 #include "cc/output/compositor_frame_sink.h" | |
11 #include "cc/output/context_provider.h" | |
12 #include "content/common/content_export.h" | |
13 #include "services/ui/public/interfaces/window_tree.mojom.h" | |
14 | |
15 namespace gpu { | |
16 class GpuMemoryBufferManager; | |
17 } | |
18 | |
19 namespace ui { | |
20 class WindowCompositorFrameSinkBinding; | |
21 } | |
22 | |
23 namespace content { | |
24 | |
25 // This lives in the main-thread, and manages the connection to the mus window | |
26 // server for a RenderWidget. | |
27 class CONTENT_EXPORT RenderWidgetMusConnection { | |
28 public: | |
29 // Bind to a WindowTreeClient request. | |
30 void Bind(mojo::InterfaceRequest<ui::mojom::WindowTreeClient> request); | |
31 | |
32 // Create a cc output surface. | |
33 std::unique_ptr<cc::CompositorFrameSink> CreateCompositorFrameSink( | |
34 const cc::FrameSinkId& frame_sink_id, | |
35 scoped_refptr<cc::ContextProvider> context_provider, | |
36 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager); | |
37 | |
38 static RenderWidgetMusConnection* Get(int routing_id); | |
39 | |
40 // Get the connection from a routing_id, if the connection doesn't exist, | |
41 // a new connection will be created. | |
42 static RenderWidgetMusConnection* GetOrCreate(int routing_id); | |
43 | |
44 private: | |
45 friend class CompositorMusConnection; | |
46 friend class CompositorMusConnectionTest; | |
47 | |
48 explicit RenderWidgetMusConnection(int routing_id); | |
49 ~RenderWidgetMusConnection(); | |
50 | |
51 const int routing_id_; | |
52 std::unique_ptr<ui::WindowCompositorFrameSinkBinding> | |
53 window_compositor_frame_sink_binding_; | |
54 | |
55 DISALLOW_COPY_AND_ASSIGN(RenderWidgetMusConnection); | |
56 }; | |
57 | |
58 } // namespace content | |
59 | |
60 #endif // CONTENT_RENDERER_MUS_RENDER_WIDGET_MUS_CONNECTION_H_ | |
OLD | NEW |