summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormostynb@opera.com <mostynb@opera.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-20 08:36:40 +0000
committermostynb@opera.com <mostynb@opera.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-20 08:36:40 +0000
commit49513e078c82d7cc8a7805297254a04d647759e6 (patch)
treea4b0c4cd0fd3b440c7f036279a29d5c88da615a8
parentcda7aa124d919f0ef28da4fd96b78283f83212f9 (diff)
downloadchromium_src-49513e078c82d7cc8a7805297254a04d647759e6.zip
chromium_src-49513e078c82d7cc8a7805297254a04d647759e6.tar.gz
chromium_src-49513e078c82d7cc8a7805297254a04d647759e6.tar.bz2
Make it possible to disable udev in the content API on linux
This is useful for embedded linux setups, which often don't include udev support. TEST=Build content_shell on linux with use_udev=0 then run ldd on output binaries to verify libudev is not listed (and is listed if built with use_udev=1 or unspecified) BUG=318315,318413 Review URL: https://codereview.chromium.org/12374068 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@236204 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--build/common.gypi11
-rw-r--r--content/browser/browser_main_loop.cc6
-rw-r--r--content/browser/browser_main_loop.h2
-rw-r--r--content/browser/device_monitor_udev.cc (renamed from content/browser/device_monitor_linux.cc)4
-rw-r--r--content/browser/device_monitor_udev.h (renamed from content/browser/device_monitor_linux.h)8
-rw-r--r--content/browser/gamepad/gamepad_platform_data_fetcher.h2
-rw-r--r--content/content_browser.gypi20
7 files changed, 38 insertions, 15 deletions
diff --git a/build/common.gypi b/build/common.gypi
index 4b56eb3..3c7a3b28 100644
--- a/build/common.gypi
+++ b/build/common.gypi
@@ -506,6 +506,13 @@
'use_nss%': 0,
}],
+ # libudev usage. This currently only affects the content layer.
+ ['OS=="linux"', {
+ 'use_udev%': 1,
+ }, {
+ 'use_udev%': 0,
+ }],
+
# Flags to use X11 on non-Mac POSIX platforms.
['OS=="win" or OS=="mac" or OS=="ios" or OS=="android" or use_ozone==1', {
'use_x11%': 0,
@@ -850,6 +857,7 @@
'use_cras%': '<(use_cras)',
'use_openssl%': '<(use_openssl)',
'use_nss%': '<(use_nss)',
+ 'use_udev%': '<(use_udev)',
'os_bsd%': '<(os_bsd)',
'os_posix%': '<(os_posix)',
'use_dbus%': '<(use_dbus)',
@@ -2146,6 +2154,9 @@
['native_memory_pressure_signals==1', {
'defines': ['SYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE'],
}],
+ ['use_udev==1', {
+ 'defines': ['USE_UDEV'],
+ }],
['fastbuild!=0', {
'xcode_settings': {
'GCC_GENERATE_DEBUGGING_SYMBOLS': 'NO',
diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc
index 7b7a529..89f30216 100644
--- a/content/browser/browser_main_loop.cc
+++ b/content/browser/browser_main_loop.cc
@@ -91,8 +91,8 @@
#include <glib-object.h>
#endif
-#if defined(OS_LINUX)
-#include "content/browser/device_monitor_linux.h"
+#if defined(OS_LINUX) && defined(USE_UDEV)
+#include "content/browser/device_monitor_udev.h"
#elif defined(OS_MACOSX) && !defined(OS_IOS)
#include "content/browser/device_monitor_mac.h"
#endif
@@ -959,7 +959,7 @@ int BrowserMainLoop::BrowserThreadsStarted() {
#endif
#endif
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) && defined(USE_UDEV)
device_monitor_linux_.reset(new DeviceMonitorLinux());
#elif defined(OS_MACOSX)
device_monitor_mac_.reset(new DeviceMonitorMac());
diff --git a/content/browser/browser_main_loop.h b/content/browser/browser_main_loop.h
index 821da87..84b31b4 100644
--- a/content/browser/browser_main_loop.h
+++ b/content/browser/browser_main_loop.h
@@ -141,7 +141,7 @@ class CONTENT_EXPORT BrowserMainLoop {
scoped_ptr<BrowserOnlineStateObserver> online_state_observer_;
#if defined(OS_WIN)
scoped_ptr<SystemMessageWindowWin> system_message_window_;
-#elif defined(OS_LINUX)
+#elif defined(USE_UDEV)
scoped_ptr<DeviceMonitorLinux> device_monitor_linux_;
#elif defined(OS_MACOSX) && !defined(OS_IOS)
scoped_ptr<DeviceMonitorMac> device_monitor_mac_;
diff --git a/content/browser/device_monitor_linux.cc b/content/browser/device_monitor_udev.cc
index 61aad7c..ddfe053 100644
--- a/content/browser/device_monitor_linux.cc
+++ b/content/browser/device_monitor_udev.cc
@@ -1,10 +1,10 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// 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 "content/browser/device_monitor_linux.h"
+#include "content/browser/device_monitor_udev.h"
#include <libudev.h>
diff --git a/content/browser/device_monitor_linux.h b/content/browser/device_monitor_udev.h
index b56de1e..b65cfc5 100644
--- a/content/browser/device_monitor_linux.h
+++ b/content/browser/device_monitor_udev.h
@@ -1,12 +1,12 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// 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.
// This class is used to detect device change and notify base::SystemMonitor
// on Linux.
-#ifndef CONTENT_BROWSER_DEVICE_MONITOR_LINUX_H_
-#define CONTENT_BROWSER_DEVICE_MONITOR_LINUX_H_
+#ifndef CONTENT_BROWSER_DEVICE_MONITOR_UDEV_H_
+#define CONTENT_BROWSER_DEVICE_MONITOR_UDEV_H_
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
@@ -41,4 +41,4 @@ class DeviceMonitorLinux : public base::MessageLoop::DestructionObserver {
} // namespace content
-#endif // CONTENT_BROWSER_DEVICE_MONITOR_LINUX_H_
+#endif // CONTENT_BROWSER_DEVICE_MONITOR_UDEV_H_
diff --git a/content/browser/gamepad/gamepad_platform_data_fetcher.h b/content/browser/gamepad/gamepad_platform_data_fetcher.h
index 625e72c..24730629 100644
--- a/content/browser/gamepad/gamepad_platform_data_fetcher.h
+++ b/content/browser/gamepad/gamepad_platform_data_fetcher.h
@@ -30,7 +30,7 @@ typedef GamepadPlatformDataFetcherWin GamepadPlatformDataFetcher;
typedef GamepadPlatformDataFetcherMac GamepadPlatformDataFetcher;
-#elif defined(OS_LINUX)
+#elif defined(OS_LINUX) && defined(USE_UDEV)
typedef GamepadPlatformDataFetcherLinux GamepadPlatformDataFetcher;
diff --git a/content/content_browser.gypi b/content/content_browser.gypi
index e303df1..66eb8ff 100644
--- a/content/content_browser.gypi
+++ b/content/content_browser.gypi
@@ -393,10 +393,10 @@
'browser/devtools/worker_devtools_manager.h',
'browser/devtools/worker_devtools_message_filter.cc',
'browser/devtools/worker_devtools_message_filter.h',
- 'browser/device_monitor_linux.cc',
- 'browser/device_monitor_linux.h',
'browser/device_monitor_mac.h',
'browser/device_monitor_mac.mm',
+ 'browser/device_monitor_udev.cc',
+ 'browser/device_monitor_udev.h',
'browser/device_orientation/data_fetcher_impl_android.cc',
'browser/device_orientation/data_fetcher_impl_android.h',
'browser/device_orientation/data_fetcher_shared_memory.h',
@@ -1265,7 +1265,7 @@
'../ui/events/events.gyp:events',
],
}],
- ['OS!="win" and OS!="mac" and OS!="linux"', {
+ ['OS!="win" and OS!="mac" and (OS!="linux" or use_udev==0)', {
'sources': [
'browser/gamepad/gamepad_platform_data_fetcher.cc',
]
@@ -1418,10 +1418,22 @@
}],
['OS=="linux"', {
'dependencies': [
- '../build/linux/system.gyp:udev',
'../sandbox/sandbox.gyp:libc_urandom_override',
],
}],
+ ['use_udev == 1', {
+ 'dependencies': [
+ '../build/linux/system.gyp:udev',
+ ],
+ }, {
+ 'sources!': [
+ 'browser/device_monitor_udev.cc',
+ 'browser/device_monitor_udev.h',
+ 'browser/gamepad/gamepad_platform_data_fetcher_linux.cc',
+ 'browser/udev_linux.cc',
+ 'browser/udev_linux.h',
+ ],
+ }],
['OS=="linux" and use_aura==1', {
'dependencies': [
'../build/linux/system.gyp:fontconfig',