0

More POSIX support for Chromium, consisting mostly of broadening ifdefs. This

patch cuts across modules, as there's only a handful necessary for each,
with the most in chrome/test/. ALSA is enabled on FreeBSD and Solaris, as
libasound has been ported to those two platforms, and I moved resolv.h in
host_resolver_proc.cc, because it depends on headers from sys_addrinfo.h on
FreeBSD.

Patch by ruben (chromium@hybridsource.org)

Review URL: http://codereview.chromium.org/6976055

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@87641 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
tony@chromium.org
2011-06-02 18:37:51 +00:00
parent ef42e30fbf
commit 23f77116ca
28 changed files with 62 additions and 60 deletions

@ -8,7 +8,7 @@
#include "build/build_config.h"
#if defined(OS_LINUX) && defined(USE_HEAPCHECKER)
#if defined(OS_POSIX) && !defined(OS_MACOSX) && defined(USE_HEAPCHECKER)
#include "third_party/tcmalloc/chromium/src/google/heap-checker.h"

@ -151,7 +151,7 @@ TabContentsWrapper::TabContentsWrapper(TabContents* contents)
NotificationService::AllSources());
registrar_.Add(this, NotificationType::USER_STYLE_SHEET_UPDATED,
NotificationService::AllSources());
#if defined(OS_LINUX)
#if defined(OS_POSIX) && !defined(OS_MACOSX)
registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED,
NotificationService::AllSources());
#endif
@ -413,7 +413,7 @@ void TabContentsWrapper::Observe(NotificationType type,
case NotificationType::USER_STYLE_SHEET_UPDATED:
UpdateWebPreferences();
break;
#if defined(OS_LINUX)
#if defined(OS_POSIX) && !defined(OS_MACOSX)
case NotificationType::BROWSER_THEME_CHANGED: {
UpdateRendererPreferences();
break;

@ -2973,7 +2973,7 @@
'../third_party/WebKit/Source/WebCore/WebCore.gyp/WebCore.gyp:webcore',
],
}],
['OS=="linux"', {
['toolkit_uses_gtk == 1', {
'dependencies': [
'../build/linux/system.gyp:gtk',
'../tools/xdisplaycheck/xdisplaycheck.gyp:xdisplaycheck',

@ -27,27 +27,27 @@ const char kChromeVersionEnvVar[] = "CHROME_VERSION";
#if defined(OS_WIN)
const FilePath::CharType kBrowserProcessExecutableName[] = FPL("chrome.exe");
const FilePath::CharType kHelperProcessExecutableName[] = FPL("chrome.exe");
#elif defined(OS_LINUX)
const FilePath::CharType kBrowserProcessExecutableName[] = FPL("chrome");
// Helper processes end up with a name of "exe" due to execing via
// /proc/self/exe. See bug 22703.
const FilePath::CharType kHelperProcessExecutableName[] = FPL("exe");
#elif defined(OS_MACOSX)
const FilePath::CharType kBrowserProcessExecutableName[] = FPL(PRODUCT_STRING);
const FilePath::CharType kHelperProcessExecutableName[] =
FPL(PRODUCT_STRING " Helper");
#elif defined(OS_POSIX)
const FilePath::CharType kBrowserProcessExecutableName[] = FPL("chrome");
// Helper processes end up with a name of "exe" due to execing via
// /proc/self/exe. See bug 22703.
const FilePath::CharType kHelperProcessExecutableName[] = FPL("exe");
#endif // OS_*
#if defined(OS_WIN)
const FilePath::CharType kBrowserProcessExecutablePath[] = FPL("chrome.exe");
const FilePath::CharType kHelperProcessExecutablePath[] = FPL("chrome.exe");
#elif defined(OS_LINUX)
const FilePath::CharType kBrowserProcessExecutablePath[] = FPL("chrome");
const FilePath::CharType kHelperProcessExecutablePath[] = FPL("chrome");
#elif defined(OS_MACOSX)
const FilePath::CharType kBrowserProcessExecutablePath[] =
FPL(PRODUCT_STRING ".app/Contents/MacOS/" PRODUCT_STRING);
const FilePath::CharType kHelperProcessExecutablePath[] =
FPL(PRODUCT_STRING " Helper.app/Contents/MacOS/" PRODUCT_STRING " Helper");
#elif defined(OS_POSIX)
const FilePath::CharType kBrowserProcessExecutablePath[] = FPL("chrome");
const FilePath::CharType kHelperProcessExecutablePath[] = FPL("chrome");
#endif // OS_*
#if defined(OS_MACOSX)
const FilePath::CharType kFrameworkName[] =

@ -113,7 +113,7 @@ std::string GetChromeRevision() {
file_info.reset(
FileVersionInfo::CreateFileVersionInfo(FilePath(kChromeDll)));
last_change = WideToASCII(file_info->last_change());
#elif defined(OS_LINUX) || defined(OS_MACOSX)
#elif defined(OS_POSIX)
chrome::VersionInfo version_info;
last_change = version_info.LastChange();
#endif // !defined(OS_WIN)

@ -1382,7 +1382,7 @@ TEST_F(ExternalTabUITestPopupEnabled, MAYBE_UserGestureTargetBlank) {
#endif // defined(OS_WIN)
// TODO(port): Need to port autocomplete_edit_proxy.* first.
#if defined(OS_WIN) || defined(OS_LINUX)
#if !defined(OS_MACOSX)
TEST_F(AutomationProxyTest, AutocompleteGetSetText) {
scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
ASSERT_TRUE(browser.get());
@ -1426,7 +1426,7 @@ TEST_F(AutomationProxyTest, AutocompleteParallelProxy) {
EXPECT_EQ(text_to_set2, actual_text2);
}
#endif // defined(OS_WIN) || defined(OS_LINUX)
#endif // !defined(OS_MACOSX)
#if defined(OS_MACOSX)
// Disabled, http://crbug.com/48601.

@ -61,8 +61,8 @@ ChromeProcessList GetRunningChromeProcesses(base::ProcessId browser_pid) {
result.push_back(process_entry->pid());
}
#if defined(OS_LINUX)
// On Linux we might be running with a zygote process for the renderers.
#if defined(OS_POSIX) && !defined(OS_MACOSX)
// On Unix we might be running with a zygote process for the renderers.
// Because of that we sweep the list of processes again and pick those which
// are children of one of the processes that we've already seen.
{
@ -72,9 +72,9 @@ ChromeProcessList GetRunningChromeProcesses(base::ProcessId browser_pid) {
while (const base::ProcessEntry* process_entry = it.NextProcessEntry())
result.push_back(process_entry->pid());
}
#endif // defined(OS_LINUX)
#endif // defined(OS_POSIX) && !defined(OS_MACOSX)
#if defined(OS_LINUX) || defined(OS_MACOSX)
#if defined(OS_POSIX)
// On Mac OS X we run the subprocesses with a different bundle, and
// on Linux via /proc/self/exe, so they end up with a different
// name. We must collect them in a second pass.

@ -291,7 +291,7 @@ IN_PROC_BROWSER_TEST_F(PDFBrowserTest, FLAKY_SLOW_Loading) {
std::string filename = file_path.BaseName().MaybeAsASCII();
ASSERT_FALSE(filename.empty());
#if defined(OS_MACOSX) || defined(OS_LINUX)
#if defined(OS_POSIX)
if (filename == "sample.pdf")
continue; // Crashes on Mac and Linux. http://crbug.com/63549
#endif

@ -193,7 +193,7 @@ class PageLoadTest : public UITest {
file_info.reset(
FileVersionInfo::CreateFileVersionInfo(FilePath(kChromeDll)));
last_change = WideToASCII(file_info->last_change());
#elif defined(OS_LINUX) || defined(OS_MACOSX)
#elif defined(OS_POSIX)
// TODO(fmeawad): On Mac, the version retrieved here belongs to the test
// module and not the chrome binary, need to be changed to chrome binary
// instead.

@ -198,7 +198,7 @@ TEST_F(NewTabUIStartupTest, FLAKY_NewTabTimingTestsCold) {
RunNewTabTimingTest();
}
#if defined(OS_LINUX)
#if defined(TOOLKIT_USES_GTK)
TEST_F(NewTabUIStartupTest, GtkThemeCold) {
RunStartupTest("tab_gtk_theme_cold", false /* cold */,
false /* not important */,

@ -366,7 +366,7 @@ TEST_F(StartupTest, PerfComplexTheme) {
ProxyLauncher::COMPLEX_THEME, 0, 0);
}
#if defined(OS_LINUX)
#if defined(TOOLKIT_USES_GTK)
TEST_F(StartupTest, PerfGtkTheme) {
RunStartupTest("warm", "gtk-theme", WARM, NOT_IMPORTANT,
ProxyLauncher::NATIVE_THEME, 0, 0);

@ -67,7 +67,7 @@ bool OverrideUserDataDir(const FilePath& user_data_dir) {
// This matches what is done in ChromeMain().
success = PathService::Override(chrome::DIR_USER_DATA, user_data_dir);
#if defined(OS_LINUX)
#if defined(OS_POSIX) && !defined(OS_MACOSX)
// Make sure the cache directory is inside our clear profile. Otherwise
// the cache may contain data from earlier tests that could break the
// current test.

@ -84,7 +84,7 @@ TEST_F(HistoryTester, VerifyHistoryLength3) {
kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms());
}
#if defined(OS_WIN) || defined(OS_LINUX)
#if !defined(OS_MACOSX)
TEST_F(HistoryTester, ConsiderRedirectAfterGestureAsUserInitiated) {
// Test the history length for the following page transition.
//
@ -116,7 +116,7 @@ TEST_F(HistoryTester, ConsiderRedirectAfterGestureAsUserInitiated) {
WaitForFinish("History_Length_Test_12", "1", url, kTestCompleteCookie,
kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms());
}
#endif // defined(OS_WIN) || defined(OS_LINUX)
#endif // !defined(OS_MACOSX)
TEST_F(HistoryTester, ConsiderSlowRedirectAsUserInitiated) {
// Test the history length for the following page transition.

@ -289,7 +289,7 @@ void RunMessageLoop() {
#if defined(TOOLKIT_VIEWS)
views::AcceleratorHandler handler;
loop->Run(&handler);
#elif defined(OS_LINUX)
#elif defined(OS_POSIX) && !defined(OS_MACOSX)
loop->Run(NULL);
#else
loop->Run();

@ -2629,7 +2629,7 @@ void GLES2DecoderImpl::DoCopyTextureToParentTextureCHROMIUM(
}
void GLES2DecoderImpl::DoResizeCHROMIUM(GLuint width, GLuint height) {
#if defined(OS_LINUX)
#if defined(OS_POSIX) && !defined(OS_MACOSX)
// Make sure that we are done drawing to the back buffer before resizing.
glFinish();
#endif

@ -14,7 +14,7 @@
# also be compiled with -fPIC flag. Setting GYP_DEFINES="linux_fpic=1"
# compiles everything with -fPIC. Disable pepper demos on linux/x64
# unless linux_fpic is 1.
['OS=="linux" and (target_arch=="x64" or target_arch=="arm") and linux_fpic!=1', {
['os_posix == 1 and OS != "mac" and (target_arch=="x64" or target_arch=="arm") and linux_fpic!=1', {
'enable_pepper_demos%': 0,
}, {
'enable_pepper_demos%': 1,
@ -107,7 +107,7 @@
],
},
'conditions': [
['OS=="linux"', {
['os_posix == 1 and OS != "mac"', {
# -gstabs, used in the official builds, causes an ICE. Remove it.
'cflags!': ['-gstabs'],
}],

@ -8,9 +8,9 @@
#include "gpu/demos/framework/window.h"
#include "ui/gfx/gl/gl_surface.h"
#if defined(OS_LINUX)
#if defined(TOOLKIT_USES_GTK)
#include <gtk/gtk.h>
#endif // OS_LINUX
#endif // TOOLKIT_USES_GTK
namespace {
static const int kWindowWidth = 512;
@ -18,9 +18,9 @@ static const int kWindowHeight = 512;
} // namespace.
int main(int argc, char** argv) {
#if defined(OS_LINUX)
#if defined(TOOLKIT_USES_GTK)
gtk_init(&argc, &argv);
#endif // OS_LINUX
#endif // TOOLKIT_USES_GTK
// AtExitManager is used by singleton classes to delete themselves when
// the program terminates.

@ -54,7 +54,7 @@
'egl_native',
],
'conditions': [
['OS=="linux"', {
['toolkit_uses_gtk == 1', {
'dependencies': ['../../build/linux/system.gyp:gtk'],
}],
],
@ -76,7 +76,7 @@
'<(DEPTH)/third_party/expat/expat.gyp:expat',
],
'conditions': [
['OS=="linux"', {
['toolkit_uses_gtk == 1', {
'dependencies': ['../../build/linux/system.gyp:gtk'],
}],
],

@ -5,9 +5,9 @@
#include "base/at_exit.h"
#include "base/message_loop.h"
#if defined(OS_LINUX)
#if defined(TOOLKIT_USES_GTK)
#include <gtk/gtk.h>
#endif // OS_LINUX
#endif
extern "C" {
#if defined(GLES2_CONFORM_SUPPORT_ONLY)
@ -18,9 +18,9 @@ extern "C" {
}
int main(int argc, char *argv[]) {
#if defined(OS_LINUX)
#if defined(TOOLKIT_USES_GTK)
gtk_init(&argc, &argv);
#endif // OS_LINUX
#endif
base::AtExitManager at_exit;
MessageLoopForUI message_loop;

@ -20,9 +20,9 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/multiprocess_func_list.h"
#if defined(OS_LINUX) || defined(OS_MACOSX)
#if defined(OS_POSIX)
#include "base/file_descriptor_posix.h"
#endif // defined(OS_LINUX) || defined(OS_MACOSX)
#endif
enum IPCMessageIds {
UNUSED_IPC_TYPE,

@ -6,7 +6,7 @@
namespace switches {
#if defined(OS_LINUX)
#if defined(OS_LINUX) || defined(OS_FREEBSD) || defined(OS_SOLARIS)
// The Alsa device to use when opening an audio stream.
const char kAlsaOutputDevice[] = "alsa-output-device";
// The Alsa device to use when opening an audio input stream.

@ -11,7 +11,7 @@
namespace switches {
#if defined(OS_LINUX)
#if defined(OS_LINUX) || defined(OS_FREEBSD) || defined(OS_SOLARIS)
extern const char kAlsaOutputDevice[];
extern const char kAlsaInputDevice[];
#endif

@ -25,7 +25,7 @@
#include "ui/gfx/gl/gl_surface.h"
#include "ui/gfx/native_widget_types.h"
#if defined(OS_LINUX)
#if defined(TOOLKIT_USES_GTK)
#include <gtk/gtk.h>
#endif
@ -98,7 +98,7 @@ int main(int argc, char** argv) {
}
// Read command line.
#if defined(OS_LINUX)
#if defined(TOOLKIT_USES_GTK)
gtk_init(&argc, &argv);
#endif
CommandLine::Init(argc, argv);

@ -99,13 +99,15 @@ HostCache* CreateDefaultCache() {
std::vector<int> GetAllGetAddrinfoOSErrors() {
int os_errors[] = {
#if defined(OS_POSIX)
#if !defined(OS_FREEBSD)
EAI_ADDRFAMILY,
EAI_NODATA,
#endif
EAI_AGAIN,
EAI_BADFLAGS,
EAI_FAIL,
EAI_FAMILY,
EAI_MEMORY,
EAI_NODATA,
EAI_NONAME,
EAI_SERVICE,
EAI_SOCKTYPE,
@ -1058,7 +1060,7 @@ HostResolverImpl::HostResolverImpl(
#if defined(OS_WIN)
EnsureWinsockInit();
#endif
#if defined(OS_LINUX)
#if defined(OS_POSIX) && !defined(OS_MACOSX)
if (HaveOnlyLoopbackAddresses())
additional_resolver_flags_ |= HOST_RESOLVER_LOOPBACK_ONLY;
#endif
@ -1598,7 +1600,7 @@ void HostResolverImpl::OnIPAddressChanged() {
ipv6_probe_job_ = new IPv6ProbeJob(this);
ipv6_probe_job_->Start();
}
#if defined(OS_LINUX)
#if defined(OS_POSIX) && !defined(OS_MACOSX)
if (HaveOnlyLoopbackAddresses()) {
additional_resolver_flags_ |= HOST_RESOLVER_LOOPBACK_ONLY;
} else {

@ -6,16 +6,16 @@
#include "build/build_config.h"
#if defined(OS_POSIX) && !defined(OS_MACOSX)
#include <resolv.h>
#endif
#include "base/logging.h"
#include "net/base/address_list.h"
#include "net/base/dns_reload_timer.h"
#include "net/base/net_errors.h"
#include "net/base/sys_addrinfo.h"
#if defined(OS_POSIX) && !defined(OS_MACOSX)
#include <resolv.h>
#endif
namespace net {
namespace {
@ -248,7 +248,7 @@ int SystemHostResolverProc(const std::string& host,
#if defined(OS_WIN)
if (err != WSAHOST_NOT_FOUND && err != WSANO_DATA)
return ERR_NAME_RESOLUTION_FAILED;
#elif defined(OS_POSIX)
#elif defined(OS_POSIX) && !defined(OS_FREEBSD)
if (err != EAI_NONAME && err != EAI_NODATA)
return ERR_NAME_RESOLUTION_FAILED;
#endif

@ -919,9 +919,9 @@ OSCALL NPError NP_GetEntryPoints(NPPluginFuncs* nppfuncs) {
}
OSCALL NPError NP_Initialize(NPNetscapeFuncs* npnetscape_funcs
#if defined(OS_LINUX)
#if defined(OS_POSIX) && !defined(OS_MACOSX)
, NPPluginFuncs* nppfuncs
#endif // OS_LINUX
#endif
) {
LOG(INFO) << "NP_Initialize";
if (g_at_exit_manager)
@ -935,9 +935,9 @@ OSCALL NPError NP_Initialize(NPNetscapeFuncs* npnetscape_funcs
g_at_exit_manager = new base::AtExitManager;
g_npnetscape_funcs = npnetscape_funcs;
#if defined(OS_LINUX)
#if defined(OS_POSIX) && !defined(OS_MACOSX)
NP_GetEntryPoints(nppfuncs);
#endif // OS_LINUX
#endif
return NPERR_NO_ERROR;
}

@ -506,7 +506,7 @@ TEST(ImageOperations, ResizeShouldAverageColors) {
{ skia::ImageOperations::RESIZE_HAMMING1, "HAMMING1", 0.0f },
{ skia::ImageOperations::RESIZE_LANCZOS2, "LANCZOS2", 0.0f },
{ skia::ImageOperations::RESIZE_LANCZOS3, "LANCZOS3", 0.0f },
#if defined(OS_LINUX) && !defined(GTV)
#if defined(OS_POSIX) && !defined(GTV)
// SUBPIXEL has slightly worse performance than the other filters:
// 6.324 Bottom left/right corners
// 5.099 Top left/right corners

@ -56,7 +56,7 @@ PlatformDevice::PlatformSurface VectorPlatformDeviceSkia::BeginPlatformPaint() {
pdf_device_->height(),
false, /* not opaque */
NULL);
#elif defined(OS_LINUX)
#elif defined(OS_POSIX)
raster_surface_ = BitmapPlatformDevice::Create(pdf_device_->width(),
pdf_device_->height(),
false /* not opaque */);