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

Side by Side Diff: content/browser/device_monitor_linux.cc

Issue 14335017: content: Use base::MessageLoop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // libudev is used for monitoring device changes. 5 // libudev is used for monitoring device changes.
6 6
7 #include "content/browser/device_monitor_linux.h" 7 #include "content/browser/device_monitor_linux.h"
8 8
9 #include <libudev.h> 9 #include <libudev.h>
10 10
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 base::Bind(&DeviceMonitorLinux::Initialize, base::Unretained(this))); 42 base::Bind(&DeviceMonitorLinux::Initialize, base::Unretained(this)));
43 } 43 }
44 44
45 DeviceMonitorLinux::~DeviceMonitorLinux() { 45 DeviceMonitorLinux::~DeviceMonitorLinux() {
46 } 46 }
47 47
48 void DeviceMonitorLinux::Initialize() { 48 void DeviceMonitorLinux::Initialize() {
49 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 49 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
50 50
51 // We want to be notified of IO message loop destruction to delete |udev_|. 51 // We want to be notified of IO message loop destruction to delete |udev_|.
52 MessageLoop::current()->AddDestructionObserver(this); 52 base::MessageLoop::current()->AddDestructionObserver(this);
53 53
54 std::vector<UdevLinux::UdevMonitorFilter> filters; 54 std::vector<UdevLinux::UdevMonitorFilter> filters;
55 for (size_t i = 0; i < arraysize(kSubsystemMap); ++i) { 55 for (size_t i = 0; i < arraysize(kSubsystemMap); ++i) {
56 filters.push_back(UdevLinux::UdevMonitorFilter( 56 filters.push_back(UdevLinux::UdevMonitorFilter(
57 kSubsystemMap[i].subsystem, kSubsystemMap[i].devtype)); 57 kSubsystemMap[i].subsystem, kSubsystemMap[i].devtype));
58 } 58 }
59 udev_.reset(new UdevLinux(filters, 59 udev_.reset(new UdevLinux(filters,
60 base::Bind(&DeviceMonitorLinux::OnDevicesChanged, 60 base::Bind(&DeviceMonitorLinux::OnDevicesChanged,
61 base::Unretained(this)))); 61 base::Unretained(this))));
62 } 62 }
(...skipping 15 matching lines...) Expand all
78 device_type = kSubsystemMap[i].device_type; 78 device_type = kSubsystemMap[i].device_type;
79 break; 79 break;
80 } 80 }
81 } 81 }
82 DCHECK_NE(device_type, base::SystemMonitor::DEVTYPE_UNKNOWN); 82 DCHECK_NE(device_type, base::SystemMonitor::DEVTYPE_UNKNOWN);
83 83
84 base::SystemMonitor::Get()->ProcessDevicesChanged(device_type); 84 base::SystemMonitor::Get()->ProcessDevicesChanged(device_type);
85 } 85 }
86 86
87 } // namespace content 87 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/device_monitor_linux.h ('k') | content/browser/device_orientation/provider_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698