| 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 #include "content/renderer/mus/render_widget_mus_connection.h" | |
| 6 | |
| 7 #include <map> | |
| 8 | |
| 9 #include "base/lazy_instance.h" | |
| 10 #include "base/macros.h" | |
| 11 #include "content/renderer/render_thread_impl.h" | |
| 12 #include "content/renderer/render_view_impl.h" | |
| 13 #include "services/ui/public/cpp/window_compositor_frame_sink.h" | |
| 14 #include "services/ui/public/interfaces/window_tree.mojom.h" | |
| 15 | |
| 16 namespace content { | |
| 17 | |
| 18 namespace { | |
| 19 | |
| 20 typedef std::map<int, RenderWidgetMusConnection*> ConnectionMap; | |
| 21 base::LazyInstance<ConnectionMap>::Leaky g_connections = | |
| 22 LAZY_INSTANCE_INITIALIZER; | |
| 23 } | |
| 24 | |
| 25 void RenderWidgetMusConnection::Bind( | |
| 26 mojo::InterfaceRequest<ui::mojom::WindowTreeClient> request) { | |
| 27 // TODO(sad): crbug.com/672913 | |
| 28 } | |
| 29 | |
| 30 std::unique_ptr<cc::CompositorFrameSink> | |
| 31 RenderWidgetMusConnection::CreateCompositorFrameSink( | |
| 32 const cc::FrameSinkId& frame_sink_id, | |
| 33 scoped_refptr<cc::ContextProvider> context_provider, | |
| 34 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager) { | |
| 35 // TODO(sad): crbug.com/672913 | |
| 36 return nullptr; | |
| 37 } | |
| 38 | |
| 39 // static | |
| 40 RenderWidgetMusConnection* RenderWidgetMusConnection::Get(int routing_id) { | |
| 41 auto it = g_connections.Get().find(routing_id); | |
| 42 if (it != g_connections.Get().end()) | |
| 43 return it->second; | |
| 44 return nullptr; | |
| 45 } | |
| 46 | |
| 47 // static | |
| 48 RenderWidgetMusConnection* RenderWidgetMusConnection::GetOrCreate( | |
| 49 int routing_id) { | |
| 50 RenderWidgetMusConnection* connection = Get(routing_id); | |
| 51 if (!connection) { | |
| 52 connection = new RenderWidgetMusConnection(routing_id); | |
| 53 g_connections.Get().insert(std::make_pair(routing_id, connection)); | |
| 54 } | |
| 55 return connection; | |
| 56 } | |
| 57 | |
| 58 RenderWidgetMusConnection::RenderWidgetMusConnection(int routing_id) | |
| 59 : routing_id_(routing_id) { | |
| 60 DCHECK(routing_id); | |
| 61 } | |
| 62 | |
| 63 RenderWidgetMusConnection::~RenderWidgetMusConnection() {} | |
| 64 | |
| 65 } // namespace content | |
| OLD | NEW |