| 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 "services/shell/public/cpp/interface_registry.h" | 8 #include "services/shell/public/cpp/interface_registry.h" |
| 9 | 9 |
| 10 #if defined(OS_CHROMEOS) | 10 #if defined(OS_CHROMEOS) |
| 11 #include "chrome/gpu/gpu_arc_video_service.h" | 11 #include "chrome/gpu/gpu_arc_video_service.h" |
| 12 #endif | 12 #endif |
| 13 | 13 |
| 14 #if defined(OS_CHROMEOS) | 14 #if defined(OS_CHROMEOS) |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 void DeprecatedCreateGpuArcVideoService( | 17 void DeprecatedCreateGpuArcVideoService( |
| 18 const gpu::GpuPreferences& gpu_preferences, |
| 18 ::arc::mojom::VideoAcceleratorServiceClientRequest request) { | 19 ::arc::mojom::VideoAcceleratorServiceClientRequest request) { |
| 19 // GpuArcVideoService is strongly bound to the Mojo message pipe it | 20 // GpuArcVideoService is strongly bound to the Mojo message pipe it |
| 20 // is connected to. When that message pipe is closed, either explicitly on the | 21 // is connected to. When that message pipe is closed, either explicitly on the |
| 21 // other end (in the browser process), or by a connection error, this object | 22 // other end (in the browser process), or by a connection error, this object |
| 22 // will be destroyed. | 23 // will be destroyed. |
| 23 auto* service = new chromeos::arc::GpuArcVideoService(); | 24 auto* service = new chromeos::arc::GpuArcVideoService(gpu_preferences); |
| 24 service->Connect(std::move(request)); | 25 service->Connect(std::move(request)); |
| 25 } | 26 } |
| 26 | 27 |
| 27 void CreateGpuArcVideoService( | 28 void CreateGpuArcVideoService( |
| 29 const gpu::GpuPreferences& gpu_preferences, |
| 28 ::arc::mojom::VideoAcceleratorServiceRequest request) { | 30 ::arc::mojom::VideoAcceleratorServiceRequest request) { |
| 29 // GpuArcVideoService is strongly bound to the Mojo message pipe it | 31 // GpuArcVideoService is strongly bound to the Mojo message pipe it |
| 30 // is connected to. When that message pipe is closed, either explicitly on the | 32 // is connected to. When that message pipe is closed, either explicitly on the |
| 31 // other end (in the browser process), or by a connection error, this object | 33 // other end (in the browser process), or by a connection error, this object |
| 32 // will be destroyed. | 34 // will be destroyed. |
| 33 new chromeos::arc::GpuArcVideoService(std::move(request)); | 35 new chromeos::arc::GpuArcVideoService(std::move(request), gpu_preferences); |
| 34 } | 36 } |
| 35 | 37 |
| 36 } // namespace | 38 } // namespace |
| 37 #endif | 39 #endif |
| 38 | 40 |
| 39 ChromeContentGpuClient::ChromeContentGpuClient() {} | 41 ChromeContentGpuClient::ChromeContentGpuClient() {} |
| 40 | 42 |
| 41 ChromeContentGpuClient::~ChromeContentGpuClient() {} | 43 ChromeContentGpuClient::~ChromeContentGpuClient() {} |
| 42 | 44 |
| 43 void ChromeContentGpuClient::ExposeInterfacesToBrowser( | 45 void ChromeContentGpuClient::ExposeInterfacesToBrowser( |
| 44 shell::InterfaceRegistry* registry) { | 46 shell::InterfaceRegistry* registry, |
| 47 const gpu::GpuPreferences& gpu_preferences) { |
| 45 #if defined(OS_CHROMEOS) | 48 #if defined(OS_CHROMEOS) |
| 46 registry->AddInterface(base::Bind(&CreateGpuArcVideoService)); | 49 registry->AddInterface( |
| 47 registry->AddInterface(base::Bind(&DeprecatedCreateGpuArcVideoService)); | 50 base::Bind(&CreateGpuArcVideoService, gpu_preferences)); |
| 51 registry->AddInterface( |
| 52 base::Bind(&DeprecatedCreateGpuArcVideoService, gpu_preferences)); |
| 48 #endif | 53 #endif |
| 49 } | 54 } |
| 50 | 55 |
| 51 void ChromeContentGpuClient::Initialize( | 56 void ChromeContentGpuClient::Initialize( |
| 52 base::FieldTrialList::Observer* observer) { | 57 base::FieldTrialList::Observer* observer) { |
| 53 DCHECK(!field_trial_syncer_); | 58 DCHECK(!field_trial_syncer_); |
| 54 field_trial_syncer_.reset( | 59 field_trial_syncer_.reset( |
| 55 new chrome_variations::ChildProcessFieldTrialSyncer(observer)); | 60 new chrome_variations::ChildProcessFieldTrialSyncer(observer)); |
| 56 const base::CommandLine& command_line = | 61 const base::CommandLine& command_line = |
| 57 *base::CommandLine::ForCurrentProcess(); | 62 *base::CommandLine::ForCurrentProcess(); |
| 58 field_trial_syncer_->InitFieldTrialObserving(command_line); | 63 field_trial_syncer_->InitFieldTrialObserving(command_line); |
| 59 } | 64 } |
| OLD | NEW |