Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1023)

Unified Diff: media/capture/device_monitor_udev.cc

Issue 2224643002: Move device monitors out of //media/capture into //media/device_monitors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/capture/device_monitor_udev.h ('k') | media/capture/system_message_window_win.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/capture/device_monitor_udev.cc
diff --git a/media/capture/device_monitor_udev.cc b/media/capture/device_monitor_udev.cc
deleted file mode 100644
index a010427d0be260694d7c90ecc106d3dac960e91a..0000000000000000000000000000000000000000
--- a/media/capture/device_monitor_udev.cc
+++ /dev/null
@@ -1,88 +0,0 @@
-// Copyright 2013 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.
-
-// libudev is used for monitoring device changes.
-
-#include "media/capture/device_monitor_udev.h"
-
-#include <stddef.h>
-
-#include <string>
-
-#include "base/macros.h"
-#include "base/system_monitor/system_monitor.h"
-#include "device/udev_linux/udev.h"
-#include "device/udev_linux/udev_linux.h"
-
-namespace {
-
-struct SubsystemMap {
- base::SystemMonitor::DeviceType device_type;
- const char* subsystem;
- const char* devtype;
-};
-
-const char kAudioSubsystem[] = "sound";
-const char kVideoSubsystem[] = "video4linux";
-
-// Add more subsystems here for monitoring.
-const SubsystemMap kSubsystemMap[] = {
- {base::SystemMonitor::DEVTYPE_AUDIO_CAPTURE, kAudioSubsystem, NULL},
- {base::SystemMonitor::DEVTYPE_VIDEO_CAPTURE, kVideoSubsystem, NULL},
-};
-
-} // namespace
-
-namespace media {
-
-DeviceMonitorLinux::DeviceMonitorLinux(
- const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner)
- : io_task_runner_(io_task_runner) {
- io_task_runner_->PostTask(
- FROM_HERE,
- base::Bind(&DeviceMonitorLinux::Initialize, base::Unretained(this)));
-}
-
-DeviceMonitorLinux::~DeviceMonitorLinux() {}
-
-void DeviceMonitorLinux::Initialize() {
- DCHECK(io_task_runner_->BelongsToCurrentThread());
-
- // We want to be notified of IO message loop destruction to delete |udev_|.
- base::MessageLoop::current()->AddDestructionObserver(this);
-
- std::vector<device::UdevLinux::UdevMonitorFilter> filters;
- for (const SubsystemMap& entry : kSubsystemMap) {
- filters.push_back(
- device::UdevLinux::UdevMonitorFilter(entry.subsystem, entry.devtype));
- }
- udev_.reset(new device::UdevLinux(
- filters, base::Bind(&DeviceMonitorLinux::OnDevicesChanged,
- base::Unretained(this))));
-}
-
-void DeviceMonitorLinux::WillDestroyCurrentMessageLoop() {
- DCHECK(io_task_runner_->BelongsToCurrentThread());
- udev_.reset();
-}
-
-void DeviceMonitorLinux::OnDevicesChanged(udev_device* device) {
- DCHECK(io_task_runner_->BelongsToCurrentThread());
- DCHECK(device);
-
- base::SystemMonitor::DeviceType device_type =
- base::SystemMonitor::DEVTYPE_UNKNOWN;
- const std::string subsystem(device::udev_device_get_subsystem(device));
- for (const SubsystemMap& entry : kSubsystemMap) {
- if (subsystem == entry.subsystem) {
- device_type = entry.device_type;
- break;
- }
- }
- DCHECK_NE(device_type, base::SystemMonitor::DEVTYPE_UNKNOWN);
-
- base::SystemMonitor::Get()->ProcessDevicesChanged(device_type);
-}
-
-} // namespace media
« no previous file with comments | « media/capture/device_monitor_udev.h ('k') | media/capture/system_message_window_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698