| OLD | NEW |
| 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 #include "content/renderer/mus/render_widget_mus_connection.h" | 5 #include "content/renderer/mus/render_widget_mus_connection.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "components/mus/public/cpp/context_provider.h" | 11 #include "components/mus/public/cpp/context_provider.h" |
| 12 #include "components/mus/public/cpp/output_surface.h" | 12 #include "components/mus/public/cpp/output_surface.h" |
| 13 #include "components/mus/public/cpp/surfaces/surfaces_utils.h" | 13 #include "components/mus/public/cpp/surfaces/surfaces_utils.h" |
| 14 #include "components/mus/public/interfaces/command_buffer.mojom.h" | 14 #include "components/mus/public/interfaces/command_buffer.mojom.h" |
| 15 #include "components/mus/public/interfaces/compositor_frame.mojom.h" | 15 #include "components/mus/public/interfaces/compositor_frame.mojom.h" |
| 16 #include "components/mus/public/interfaces/gpu.mojom.h" | |
| 17 #include "components/mus/public/interfaces/window_tree.mojom.h" | 16 #include "components/mus/public/interfaces/window_tree.mojom.h" |
| 18 #include "content/public/common/mojo_shell_connection.h" | 17 #include "content/public/common/mojo_shell_connection.h" |
| 19 #include "content/renderer/mus/compositor_mus_connection.h" | 18 #include "content/renderer/mus/compositor_mus_connection.h" |
| 20 #include "content/renderer/render_thread_impl.h" | 19 #include "content/renderer/render_thread_impl.h" |
| 21 #include "content/renderer/render_view_impl.h" | 20 #include "content/renderer/render_view_impl.h" |
| 22 #include "services/shell/public/cpp/connector.h" | 21 #include "services/shell/public/cpp/connector.h" |
| 23 | 22 |
| 24 namespace content { | 23 namespace content { |
| 25 | 24 |
| 26 namespace { | 25 namespace { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 41 if (window_surface_binding_) { | 40 if (window_surface_binding_) { |
| 42 compositor_mus_connection_->AttachSurfaceOnMainThread( | 41 compositor_mus_connection_->AttachSurfaceOnMainThread( |
| 43 std::move(window_surface_binding_)); | 42 std::move(window_surface_binding_)); |
| 44 } | 43 } |
| 45 } | 44 } |
| 46 | 45 |
| 47 std::unique_ptr<cc::OutputSurface> | 46 std::unique_ptr<cc::OutputSurface> |
| 48 RenderWidgetMusConnection::CreateOutputSurface() { | 47 RenderWidgetMusConnection::CreateOutputSurface() { |
| 49 DCHECK(thread_checker_.CalledOnValidThread()); | 48 DCHECK(thread_checker_.CalledOnValidThread()); |
| 50 DCHECK(!window_surface_binding_); | 49 DCHECK(!window_surface_binding_); |
| 51 mus::mojom::GpuPtr gpu_service; | |
| 52 MojoShellConnection::Get()->GetConnector()->ConnectToInterface("mojo:mus", | |
| 53 &gpu_service); | |
| 54 mus::mojom::CommandBufferPtr cb; | |
| 55 gpu_service->CreateOffscreenGLES2Context(GetProxy(&cb)); | |
| 56 scoped_refptr<cc::ContextProvider> context_provider( | 50 scoped_refptr<cc::ContextProvider> context_provider( |
| 57 new mus::ContextProvider(cb.PassInterface().PassHandle())); | 51 new mus::ContextProvider(MojoShellConnection::Get()->GetConnector())); |
| 52 |
| 58 std::unique_ptr<cc::OutputSurface> surface(new mus::OutputSurface( | 53 std::unique_ptr<cc::OutputSurface> surface(new mus::OutputSurface( |
| 59 context_provider, mus::WindowSurface::Create(&window_surface_binding_))); | 54 context_provider, mus::WindowSurface::Create(&window_surface_binding_))); |
| 60 if (compositor_mus_connection_) { | 55 if (compositor_mus_connection_) { |
| 61 compositor_mus_connection_->AttachSurfaceOnMainThread( | 56 compositor_mus_connection_->AttachSurfaceOnMainThread( |
| 62 std::move(window_surface_binding_)); | 57 std::move(window_surface_binding_)); |
| 63 } | 58 } |
| 64 return surface; | 59 return surface; |
| 65 } | 60 } |
| 66 | 61 |
| 67 // static | 62 // static |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 // previous event. | 178 // previous event. |
| 184 // DCHECK(pending_ack_.is_null()); | 179 // DCHECK(pending_ack_.is_null()); |
| 185 pending_ack_ = ack; | 180 pending_ack_ = ack; |
| 186 // TODO(fsamuel, sadrul): Track real latency info. | 181 // TODO(fsamuel, sadrul): Track real latency info. |
| 187 ui::LatencyInfo latency_info; | 182 ui::LatencyInfo latency_info; |
| 188 input_handler_->HandleInputEvent(*input_event, latency_info, | 183 input_handler_->HandleInputEvent(*input_event, latency_info, |
| 189 DISPATCH_TYPE_BLOCKING); | 184 DISPATCH_TYPE_BLOCKING); |
| 190 } | 185 } |
| 191 | 186 |
| 192 } // namespace content | 187 } // namespace content |
| OLD | NEW |