OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "chrome/browser/chromeos/arc/video/gpu_arc_video_service_host.h" | 5 #include "chrome/browser/chromeos/arc/video/gpu_arc_video_service_host.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 | 69 |
70 void GpuArcVideoServiceHost::OnBootstrapVideoAcceleratorFactory( | 70 void GpuArcVideoServiceHost::OnBootstrapVideoAcceleratorFactory( |
71 const OnBootstrapVideoAcceleratorFactoryCallback& callback) { | 71 const OnBootstrapVideoAcceleratorFactoryCallback& callback) { |
72 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 72 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
73 | 73 |
74 // Hardcode pid 0 since it is unused in mojo. | 74 // Hardcode pid 0 since it is unused in mojo. |
75 const base::ProcessHandle kUnusedChildProcessHandle = | 75 const base::ProcessHandle kUnusedChildProcessHandle = |
76 base::kNullProcessHandle; | 76 base::kNullProcessHandle; |
77 mojo::edk::PendingProcessConnection process; | 77 mojo::edk::PendingProcessConnection process; |
78 mojo::edk::PlatformChannelPair channel_pair; | 78 mojo::edk::PlatformChannelPair channel_pair; |
79 process.Connect(kUnusedChildProcessHandle, channel_pair.PassServerHandle()); | 79 process.Connect(kUnusedChildProcessHandle, |
| 80 mojo::edk::ConnectionParams(channel_pair.PassServerHandle())); |
80 | 81 |
81 MojoHandle wrapped_handle; | 82 MojoHandle wrapped_handle; |
82 MojoResult wrap_result = mojo::edk::CreatePlatformHandleWrapper( | 83 MojoResult wrap_result = mojo::edk::CreatePlatformHandleWrapper( |
83 channel_pair.PassClientHandle(), &wrapped_handle); | 84 channel_pair.PassClientHandle(), &wrapped_handle); |
84 if (wrap_result != MOJO_RESULT_OK) { | 85 if (wrap_result != MOJO_RESULT_OK) { |
85 LOG(ERROR) << "Pipe failed to wrap handles. Closing: " << wrap_result; | 86 LOG(ERROR) << "Pipe failed to wrap handles. Closing: " << wrap_result; |
86 callback.Run(mojo::ScopedHandle(), std::string()); | 87 callback.Run(mojo::ScopedHandle(), std::string()); |
87 return; | 88 return; |
88 } | 89 } |
89 mojo::ScopedHandle child_handle{mojo::Handle(wrapped_handle)}; | 90 mojo::ScopedHandle child_handle{mojo::Handle(wrapped_handle)}; |
90 | 91 |
91 std::string token; | 92 std::string token; |
92 mojo::ScopedMessagePipeHandle server_pipe = process.CreateMessagePipe(&token); | 93 mojo::ScopedMessagePipeHandle server_pipe = process.CreateMessagePipe(&token); |
93 callback.Run(std::move(child_handle), token); | 94 callback.Run(std::move(child_handle), token); |
94 | 95 |
95 mojo::MakeStrongBinding(base::MakeUnique<VideoAcceleratorFactoryService>(), | 96 mojo::MakeStrongBinding(base::MakeUnique<VideoAcceleratorFactoryService>(), |
96 mojo::MakeRequest<mojom::VideoAcceleratorFactory>( | 97 mojo::MakeRequest<mojom::VideoAcceleratorFactory>( |
97 std::move(server_pipe))); | 98 std::move(server_pipe))); |
98 } | 99 } |
99 | 100 |
100 } // namespace arc | 101 } // namespace arc |
OLD | NEW |