blob: 06b777c73788ad5c9efc338a8f5e36ec2f2bad89 [file] [log] [blame]
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/gpu/gpu_service_factory.h"
#include <memory>
#include "base/threading/thread_task_runner_handle.h"
#include "services/shape_detection/public/interfaces/constants.mojom.h"
#include "services/shape_detection/shape_detection_service.h"
#if defined(ENABLE_MOJO_MEDIA_IN_GPU_PROCESS)
#include "base/bind.h"
#include "media/mojo/services/media_service_factory.h" // nogncheck
#endif
namespace content {
GpuServiceFactory::GpuServiceFactory(
base::WeakPtr<media::MediaGpuChannelManager> media_gpu_channel_manager) {
#if defined(ENABLE_MOJO_MEDIA_IN_GPU_PROCESS)
task_runner_ = base::ThreadTaskRunnerHandle::Get();
media_gpu_channel_manager_ = std::move(media_gpu_channel_manager);
#endif
}
GpuServiceFactory::~GpuServiceFactory() {}
void GpuServiceFactory::RegisterServices(ServiceMap* services) {
#if defined(ENABLE_MOJO_MEDIA_IN_GPU_PROCESS)
ServiceInfo info;
info.factory = base::Bind(&media::CreateGpuMediaService, task_runner_,
media_gpu_channel_manager_);
info.use_own_thread = true;
services->insert(std::make_pair("media", info));
#endif
ServiceInfo shape_detection_info;
shape_detection_info.factory =
base::Bind(&shape_detection::ShapeDetectionService::Create);
services->insert(std::make_pair(shape_detection::mojom::kServiceName,
shape_detection_info));
}
} // namespace content