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/gpu/chrome_content_gpu_client.h" | 5 #include "chrome/gpu/chrome_content_gpu_client.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/memory/ptr_util.h" |
| 9 #include "mojo/public/cpp/bindings/strong_binding.h" |
8 #include "services/shell/public/cpp/connector.h" | 10 #include "services/shell/public/cpp/connector.h" |
9 #include "services/shell/public/cpp/interface_registry.h" | 11 #include "services/shell/public/cpp/interface_registry.h" |
10 | 12 |
11 #if defined(OS_CHROMEOS) | 13 #if defined(OS_CHROMEOS) |
12 #include "chrome/gpu/gpu_arc_video_service.h" | 14 #include "chrome/gpu/gpu_arc_video_service.h" |
13 #endif | 15 #endif |
14 | 16 |
15 #if defined(OS_CHROMEOS) | 17 #if defined(OS_CHROMEOS) |
16 namespace { | 18 namespace { |
17 | 19 |
18 void DeprecatedCreateGpuArcVideoService( | 20 void DeprecatedCreateGpuArcVideoService( |
19 const gpu::GpuPreferences& gpu_preferences, | 21 const gpu::GpuPreferences& gpu_preferences, |
20 ::arc::mojom::VideoAcceleratorServiceClientRequest request) { | 22 ::arc::mojom::VideoAcceleratorServiceClientRequest client_request) { |
21 // GpuArcVideoService is strongly bound to the Mojo message pipe it | 23 chromeos::arc::GpuArcVideoService::DeprecatedConnect( |
22 // is connected to. When that message pipe is closed, either explicitly on the | 24 base::MakeUnique<chromeos::arc::GpuArcVideoService>(gpu_preferences), |
23 // other end (in the browser process), or by a connection error, this object | 25 std::move(client_request)); |
24 // will be destroyed. | |
25 auto* service = new chromeos::arc::GpuArcVideoService(gpu_preferences); | |
26 service->Connect(std::move(request)); | |
27 } | 26 } |
28 | 27 |
29 void CreateGpuArcVideoService( | 28 void CreateGpuArcVideoService( |
30 const gpu::GpuPreferences& gpu_preferences, | 29 const gpu::GpuPreferences& gpu_preferences, |
31 ::arc::mojom::VideoAcceleratorServiceRequest request) { | 30 ::arc::mojom::VideoAcceleratorServiceRequest request) { |
32 // GpuArcVideoService is strongly bound to the Mojo message pipe it | 31 mojo::MakeStrongBinding( |
33 // is connected to. When that message pipe is closed, either explicitly on the | 32 base::MakeUnique<chromeos::arc::GpuArcVideoService>(gpu_preferences), |
34 // other end (in the browser process), or by a connection error, this object | 33 std::move(request)); |
35 // will be destroyed. | |
36 new chromeos::arc::GpuArcVideoService(std::move(request), gpu_preferences); | |
37 } | 34 } |
38 | 35 |
39 } // namespace | 36 } // namespace |
40 #endif | 37 #endif |
41 | 38 |
42 ChromeContentGpuClient::ChromeContentGpuClient() {} | 39 ChromeContentGpuClient::ChromeContentGpuClient() {} |
43 | 40 |
44 ChromeContentGpuClient::~ChromeContentGpuClient() {} | 41 ChromeContentGpuClient::~ChromeContentGpuClient() {} |
45 | 42 |
46 void ChromeContentGpuClient::Initialize( | 43 void ChromeContentGpuClient::Initialize( |
(...skipping 13 matching lines...) Expand all Loading... |
60 registry->AddInterface( | 57 registry->AddInterface( |
61 base::Bind(&CreateGpuArcVideoService, gpu_preferences)); | 58 base::Bind(&CreateGpuArcVideoService, gpu_preferences)); |
62 registry->AddInterface( | 59 registry->AddInterface( |
63 base::Bind(&DeprecatedCreateGpuArcVideoService, gpu_preferences)); | 60 base::Bind(&DeprecatedCreateGpuArcVideoService, gpu_preferences)); |
64 #endif | 61 #endif |
65 } | 62 } |
66 | 63 |
67 void ChromeContentGpuClient::ConsumeInterfacesFromBrowser( | 64 void ChromeContentGpuClient::ConsumeInterfacesFromBrowser( |
68 shell::InterfaceProvider* provider) { | 65 shell::InterfaceProvider* provider) { |
69 } | 66 } |
OLD | NEW |