diff options
author | chromium@hybridsource.org <chromium@hybridsource.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-28 04:06:43 +0000 |
---|---|---|
committer | chromium@hybridsource.org <chromium@hybridsource.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-28 04:06:43 +0000 |
commit | 1fd5302cf7083ff593667703d144aa84d3cf7e5d (patch) | |
tree | d64d5a1e377638aa696b57d4ba2bb928779752b5 | |
parent | 8b02f7de252dba372f6f393a2f0130f893af3cb9 (diff) | |
download | chromium_src-1fd5302cf7083ff593667703d144aa84d3cf7e5d.zip chromium_src-1fd5302cf7083ff593667703d144aa84d3cf7e5d.tar.gz chromium_src-1fd5302cf7083ff593667703d144aa84d3cf7e5d.tar.bz2 |
Replace many OS_LINUX ifdefs with OS_POSIX & !OS_MACOSX, since most of them apply to non-linux Unix also. Non-linux Unices tested are the BSDs and Solaris.
Review URL: http://codereview.chromium.org/3556009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@87156 0039d316-1c4b-4281-b951-d872f2087c98
25 files changed, 52 insertions, 53 deletions
diff --git a/chrome/app/chrome_exe_main_gtk.cc b/chrome/app/chrome_exe_main_gtk.cc index d240fad..0b5f8b9 100644 --- a/chrome/app/chrome_exe_main_gtk.cc +++ b/chrome/app/chrome_exe_main_gtk.cc @@ -18,7 +18,7 @@ extern "C" { int ChromeMain(int argc, const char** argv); -#if defined(OS_LINUX) && defined(USE_TCMALLOC) +#if defined(OS_POSIX) && !defined(OS_MACOSX) && defined(USE_TCMALLOC) int tc_set_new_mode(int mode); #endif } @@ -33,7 +33,7 @@ int main(int argc, const char** argv) { // dependency on TCMalloc. Really, we ought to have our allocator shim code // implement this EnableTerminationOnOutOfMemory() function. Whateverz. This // works for now. -#if defined(OS_LINUX) && defined(USE_TCMALLOC) +#if defined(OS_POSIX) && !defined(OS_MACOSX) && defined(USE_TCMALLOC) // For tcmalloc, we need to tell it to behave like new. tc_set_new_mode(1); #endif diff --git a/chrome/browser/accessibility/browser_accessibility.cc b/chrome/browser/accessibility/browser_accessibility.cc index a54eb1e..7e092b7 100644 --- a/chrome/browser/accessibility/browser_accessibility.cc +++ b/chrome/browser/accessibility/browser_accessibility.cc @@ -8,9 +8,9 @@ #include "base/string_number_conversions.h" #include "chrome/browser/accessibility/browser_accessibility_manager.h" -#if defined(OS_LINUX) +#if defined(OS_POSIX) && !defined(OS_MACOSX) // There's no OS-specific implementation of BrowserAccessibilityManager -// on Linux, so just instantiate the base class. +// on Unix, so just instantiate the base class. // static BrowserAccessibility* BrowserAccessibility::Create() { return new BrowserAccessibility(); diff --git a/chrome/browser/accessibility/browser_accessibility_manager.cc b/chrome/browser/accessibility/browser_accessibility_manager.cc index f46e056..c52d0a2 100644 --- a/chrome/browser/accessibility/browser_accessibility_manager.cc +++ b/chrome/browser/accessibility/browser_accessibility_manager.cc @@ -21,9 +21,9 @@ BrowserAccessibility* BrowserAccessibilityFactory::Create() { // static int32 BrowserAccessibilityManager::next_child_id_ = -1; -#if defined(OS_LINUX) +#if defined(OS_POSIX) && !defined(OS_MACOSX) // There's no OS-specific implementation of BrowserAccessibilityManager -// on Linux, so just instantiate the base class. +// on Unix, so just instantiate the base class. // static BrowserAccessibilityManager* BrowserAccessibilityManager::Create( gfx::NativeView parent_view, diff --git a/chrome/browser/browser_main_posix.cc b/chrome/browser/browser_main_posix.cc index 49fcaf2..5b44c0c 100644 --- a/chrome/browser/browser_main_posix.cc +++ b/chrome/browser/browser_main_posix.cc @@ -21,7 +21,7 @@ #include "chrome/common/chrome_switches.h" #include "content/browser/browser_thread.h" -#if defined(OS_LINUX) && !defined(OS_CHROMEOS) +#if defined(TOOLKIT_USES_GTK) && !defined(OS_CHROMEOS) #include "chrome/browser/printing/print_dialog_gtk.h" #endif @@ -255,8 +255,8 @@ void BrowserMainPartsPosix::PostMainMessageLoopStart() { } } -#if defined(OS_LINUX) && !defined(OS_CHROMEOS) +#if defined(TOOLKIT_USES_GTK) && !defined(OS_CHROMEOS) printing::PrintingContextCairo::SetCreatePrintDialogFunction( &PrintDialogGtk::CreatePrintDialog); -#endif // defined(OS_LINUX) && !defined(OS_CHROMEOS) +#endif } diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index 9f9e316..451187c 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc @@ -53,7 +53,7 @@ #if defined(OS_LINUX) #include "base/linux_util.h" #include "chrome/browser/crash_handler_host_linux.h" -#endif // OS_LINUX +#endif #if defined(OS_WIN) #include "chrome/common/sandbox_policy.h" diff --git a/chrome/browser/chrome_content_browser_client.h b/chrome/browser/chrome_content_browser_client.h index 6b253d4..858c4d4 100644 --- a/chrome/browser/chrome_content_browser_client.h +++ b/chrome/browser/chrome_content_browser_client.h @@ -40,7 +40,7 @@ class ChromeContentBrowserClient : public content::ContentBrowserClient { int render_process_id, int render_view_id, net::CookieOptions* options); -#if defined(OS_LINUX) +#if defined(OS_POSIX) && !defined(OS_MACOSX) // Can return an optional fd for crash handling, otherwise returns -1. virtual int GetCrashSignalFD(const std::string& process_type); #endif diff --git a/chrome/browser/importer/firefox3_importer.cc b/chrome/browser/importer/firefox3_importer.cc index 0411dc7..1b12c97 100644 --- a/chrome/browser/importer/firefox3_importer.cc +++ b/chrome/browser/importer/firefox3_importer.cc @@ -53,7 +53,7 @@ struct Firefox3Importer::BookmarkItem { }; Firefox3Importer::Firefox3Importer() { -#if defined(OS_LINUX) +#if defined(OS_POSIX) && !defined(OS_MACOSX) DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); locale_ = g_browser_process->GetApplicationLocale(); #endif @@ -66,7 +66,7 @@ void Firefox3Importer::StartImport( const importer::SourceProfile& source_profile, uint16 items, ImporterBridge* bridge) { -#if defined(OS_LINUX) +#if defined(OS_POSIX) && !defined(OS_MACOSX) DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); #endif bridge_ = bridge; @@ -406,7 +406,7 @@ void Firefox3Importer::GetSearchEnginesXMLFiles( } while (s.Step() && !cancelled()); } -#if defined(OS_LINUX) +#if defined(OS_POSIX) && !defined(OS_MACOSX) // Ubuntu-flavored Firefox3 supports locale-specific search engines via // locale-named subdirectories. They fall back to en-US. // See http://crbug.com/53899 diff --git a/chrome/browser/importer/firefox3_importer.h b/chrome/browser/importer/firefox3_importer.h index cbf1690..0a605eb 100644 --- a/chrome/browser/importer/firefox3_importer.h +++ b/chrome/browser/importer/firefox3_importer.h @@ -82,7 +82,7 @@ class Firefox3Importer : public Importer { FilePath source_path_; FilePath app_path_; -#if defined(OS_LINUX) +#if defined(OS_POSIX) && !defined(OS_MACOSX) // Stored because we can only access it from the UI thread. Not usable // in Mac because no access from out-of-process import. std::string locale_; diff --git a/chrome/browser/memory_details.cc b/chrome/browser/memory_details.cc index 074e42d..e8fe40e 100644 --- a/chrome/browser/memory_details.cc +++ b/chrome/browser/memory_details.cc @@ -25,7 +25,7 @@ #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" -#if defined(OS_LINUX) +#if defined(OS_POSIX) && !defined(OS_MACOSX) #include "content/browser/zygote_host_linux.h" #include "content/browser/renderer_host/render_sandbox_host_linux.h" #endif @@ -109,7 +109,7 @@ void MemoryDetails::CollectChildInfoOnIOThread() { void MemoryDetails::CollectChildInfoOnUIThread() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); -#if defined(OS_LINUX) +#if defined(OS_POSIX) && !defined(OS_MACOSX) const pid_t zygote_pid = ZygoteHost::GetInstance()->pid(); const pid_t sandbox_helper_pid = RenderSandboxHostLinux::GetInstance()->pid(); #endif @@ -235,7 +235,7 @@ void MemoryDetails::CollectChildInfoOnUIThread() { } } -#if defined(OS_LINUX) +#if defined(OS_POSIX) && !defined(OS_MACOSX) if (process.pid == zygote_pid) { process.type = ChildProcessInfo::ZYGOTE_PROCESS; } else if (process.pid == sandbox_helper_pid) { diff --git a/chrome/browser/memory_purger.cc b/chrome/browser/memory_purger.cc index 241d0d0..48fd2146 100644 --- a/chrome/browser/memory_purger.cc +++ b/chrome/browser/memory_purger.cc @@ -135,7 +135,7 @@ void MemoryPurger::PurgeBrowser() { // * Purge AppCache memory. Not yet implemented sufficiently. // * Browser-side DatabaseTracker. Not implemented sufficiently. -#if (defined(OS_WIN) || defined(OS_LINUX)) && defined(USE_TCMALLOC) +#if !defined(OS_MACOSX) && defined(USE_TCMALLOC) // Tell tcmalloc to release any free pages it's still holding. // // TODO(pkasting): A lot of the above calls kick off actions on other threads. diff --git a/chrome/browser/notifications/balloon_collection_impl.h b/chrome/browser/notifications/balloon_collection_impl.h index 8a234e2..2b4af23 100644 --- a/chrome/browser/notifications/balloon_collection_impl.h +++ b/chrome/browser/notifications/balloon_collection_impl.h @@ -57,7 +57,7 @@ class BalloonCollectionImpl : public BalloonCollection virtual void WillProcessMessage(const MSG& event) {} virtual void DidProcessMessage(const MSG& event); #endif -#if defined(OS_LINUX) +#if defined(TOOLKIT_USES_GTK) virtual void WillProcessEvent(GdkEvent* event) {} virtual void DidProcessEvent(GdkEvent* event); #endif diff --git a/chrome/browser/prefs/pref_service_uitest.cc b/chrome/browser/prefs/pref_service_uitest.cc index 029fc75..c59923a 100644 --- a/chrome/browser/prefs/pref_service_uitest.cc +++ b/chrome/browser/prefs/pref_service_uitest.cc @@ -79,7 +79,7 @@ class PreferenceServiceTest : public UITest { ScopedTempDir temp_dir_; }; -#if !defined(OS_LINUX) +#if defined(OS_WIN) || defined(OS_MACOSX) // This test verifies that the window position from the prefs file is restored // when the app restores. This doesn't really make sense on Linux, where // the window manager might fight with you over positioning. However, we @@ -142,7 +142,7 @@ TEST_F(PreferenceServiceTest, PreservedWindowPlacementIsLoaded) { } #endif -#if !defined(OS_LINUX) +#if defined(OS_WIN) || defined(OS_MACOSX) TEST_F(PreferenceServiceTest, PreservedWindowPlacementIsMigrated) { // The window should open with the old reference profile, with window // placement values stored in Local State. diff --git a/chrome/browser/shell_integration_unittest.cc b/chrome/browser/shell_integration_unittest.cc index 3158f51..740e518 100644 --- a/chrome/browser/shell_integration_unittest.cc +++ b/chrome/browser/shell_integration_unittest.cc @@ -22,13 +22,13 @@ #if defined(OS_WIN) #include "chrome/installer/util/browser_distribution.h" -#elif defined(OS_LINUX) +#elif defined(OS_POSIX) && !defined(OS_MACOSX) #include "base/environment.h" -#endif // defined(OS_LINUX) +#endif #define FPL FILE_PATH_LITERAL -#if defined(OS_LINUX) +#if defined(OS_POSIX) && !defined(OS_MACOSX) namespace { // Provides mock environment variables values based on a stored map. diff --git a/chrome/browser/task_manager/task_manager_resource_providers.cc b/chrome/browser/task_manager/task_manager_resource_providers.cc index d67c1f03..0dba1f1 100644 --- a/chrome/browser/task_manager/task_manager_resource_providers.cc +++ b/chrome/browser/task_manager/task_manager_resource_providers.cc @@ -1351,7 +1351,7 @@ TaskManagerBrowserProcessResource::TaskManagerBrowserProcessResource() default_icon_ = IconUtil::CreateSkBitmapFromHICON(icon, icon_size); } } -#elif defined(OS_LINUX) +#elif defined(OS_POSIX) && !defined(OS_MACOSX) if (!default_icon_) { ResourceBundle& rb = ResourceBundle::GetSharedInstance(); default_icon_ = rb.GetBitmapNamed(IDR_PRODUCT_LOGO_16); diff --git a/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc b/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc index eea744e..f998f16 100644 --- a/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc +++ b/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc @@ -33,7 +33,7 @@ #include "ui/base/events.h" #include "ui/base/keycodes/keyboard_codes.h" -#if defined(OS_LINUX) +#if defined(TOOLKIT_USES_GTK) #include <gdk/gdk.h> #include <gtk/gtk.h> #endif @@ -112,7 +112,7 @@ const struct TestHistoryEntry { {"http://bar/", "Bar", kSearchText, 1, 0, false }, }; -#if defined(OS_LINUX) +#if defined(TOOLKIT_USES_GTK) // Returns the text stored in the PRIMARY clipboard. std::string GetPrimarySelectionText() { GtkClipboard* clipboard = gtk_clipboard_get(GDK_SELECTION_PRIMARY); @@ -1191,7 +1191,7 @@ IN_PROC_BROWSER_TEST_F(OmniboxViewTest, CtrlKeyPressedWithInlineAutocompleteTest(); } -#if defined(OS_LINUX) +#if defined(TOOLKIT_USES_GTK) // TODO(oshima): enable these tests for views-implmentation when // these featuers are supported. diff --git a/chrome/browser/ui/panels/panel_browser_frame_view.cc b/chrome/browser/ui/panels/panel_browser_frame_view.cc index bc8f3ba..0e0b764 100644 --- a/chrome/browser/ui/panels/panel_browser_frame_view.cc +++ b/chrome/browser/ui/panels/panel_browser_frame_view.cc @@ -26,7 +26,7 @@ #include "views/window/window.h" #include "views/window/window_shape.h" -#if defined(OS_LINUX) +#if !defined(OS_WIN) #include "views/window/hit_test.h" #endif diff --git a/chrome/browser/web_applications/web_app.cc b/chrome/browser/web_applications/web_app.cc index 31dd877..cbae635 100644 --- a/chrome/browser/web_applications/web_app.cc +++ b/chrome/browser/web_applications/web_app.cc @@ -23,9 +23,9 @@ #include "chrome/common/url_constants.h" #include "content/browser/browser_thread.h" -#if defined(OS_LINUX) +#if defined(OS_POSIX) && !defined(OS_MACOSX) #include "base/environment.h" -#endif // defined(OS_LINUX) +#endif #if defined(OS_WIN) #include "ui/gfx/icon_util.h" @@ -221,7 +221,7 @@ void CreateShortcutTask::Run() { bool CreateShortcutTask::CreateShortcut() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); -#if defined(OS_LINUX) +#if defined(OS_POSIX) && !defined(OS_MACOSX) scoped_ptr<base::Environment> env(base::Environment::Create()); std::string shortcut_template; diff --git a/chrome/common/chrome_paths.cc b/chrome/common/chrome_paths.cc index 1b3061f..a8d1dd8 100644 --- a/chrome/common/chrome_paths.cc +++ b/chrome/common/chrome_paths.cc @@ -172,7 +172,7 @@ bool PathProvider(int key, FilePath* result) { cur = cur.Append(FILE_PATH_LITERAL("inspector")); break; case chrome::DIR_APP_DICTIONARIES: -#if defined(OS_LINUX) || defined(OS_MACOSX) +#if defined(OS_POSIX) // We can't write into the EXE dir on Linux, so keep dictionaries // alongside the safe browsing database in the user data dir. // And we don't want to write into the bundle on the Mac, so push diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc index dbe024a..ef67240 100644 --- a/chrome/common/chrome_switches.cc +++ b/chrome/common/chrome_switches.cc @@ -1085,7 +1085,7 @@ const char kForceStubLibcros[] = "force-stub-libcros"; const char kEnableAdvancedFileSystem[] = "enable-advanced-fs"; #endif -#if defined(OS_LINUX) +#if defined(OS_POSIX) && !defined(OS_MACOSX) // Specify the amount the trackpad should scroll by. const char kScrollPixels[] = "scroll-pixels"; #endif diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h index 25ca5a2..9ba4393 100644 --- a/chrome/common/chrome_switches.h +++ b/chrome/common/chrome_switches.h @@ -302,7 +302,7 @@ extern const char kCompressSystemFeedback[]; extern const char kSkipChromeOSComponents[]; #endif -#if defined(OS_LINUX) +#if defined(OS_POSIX) && !defined(OS_MACOSX) extern const char kScrollPixels[]; #endif diff --git a/chrome/common/service_process_util_posix.cc b/chrome/common/service_process_util_posix.cc index 83a1edd..c815b3e 100644 --- a/chrome/common/service_process_util_posix.cc +++ b/chrome/common/service_process_util_posix.cc @@ -91,9 +91,6 @@ void ServiceProcessState::StateData::SignalReady(base::WaitableEvent* signal, DCHECK_EQ(old_action_.sa_handler, SIG_DFL); set_action_ = true; -#if defined(OS_LINUX) - initializing_lock_.reset(); -#endif // OS_LINUX #if defined(OS_MACOSX) *success = WatchExecutable(); if (!*success) { @@ -101,7 +98,9 @@ void ServiceProcessState::StateData::SignalReady(base::WaitableEvent* signal, signal->Signal(); return; } -#endif // OS_MACOSX +#elif defined(OS_POSIX) + initializing_lock_.reset(); +#endif // OS_POSIX signal->Signal(); } @@ -140,12 +139,12 @@ bool ServiceProcessState::SignalReady( CHECK(state_); scoped_ptr<Task> scoped_shutdown_task(shutdown_task); -#if defined(OS_LINUX) +#if defined(OS_POSIX) && !defined(OS_MACOSX) state_->running_lock_.reset(TakeServiceRunningLock(true)); if (state_->running_lock_.get() == NULL) { return false; } -#endif // OS_LINUX +#endif state_->shut_down_monitor_.reset( new ServiceProcessShutdownMonitor(scoped_shutdown_task.release())); if (pipe(state_->sockets_) < 0) { diff --git a/chrome/common/service_process_util_posix.h b/chrome/common/service_process_util_posix.h index a0e8c67..ff031b4 100644 --- a/chrome/common/service_process_util_posix.h +++ b/chrome/common/service_process_util_posix.h @@ -14,10 +14,10 @@ #include "base/message_loop.h" #include "base/message_pump_libevent.h" -#if defined(OS_LINUX) +#if defined(OS_POSIX) && !defined(OS_MACOSX) #include "chrome/common/multi_process_lock.h" MultiProcessLock* TakeServiceRunningLock(bool waiting); -#endif // OS_LINUX +#endif #if defined(OS_MACOSX) #include "base/files/file_path_watcher.h" @@ -72,10 +72,10 @@ struct ServiceProcessState::StateData base::mac::ScopedCFTypeRef<CFDictionaryRef> launchd_conf_; base::files::FilePathWatcher executable_watcher_; #endif // OS_MACOSX -#if defined(OS_LINUX) +#if defined(OS_POSIX) && !defined(OS_MACOSX) scoped_ptr<MultiProcessLock> initializing_lock_; scoped_ptr<MultiProcessLock> running_lock_; -#endif // OS_LINUX +#endif scoped_ptr<ServiceProcessShutdownMonitor> shut_down_monitor_; base::MessagePumpLibevent::FileDescriptorWatcher watcher_; int sockets_[2]; diff --git a/chrome/common/service_process_util_unittest.cc b/chrome/common/service_process_util_unittest.cc index 81ca377..89bd230 100644 --- a/chrome/common/service_process_util_unittest.cc +++ b/chrome/common/service_process_util_unittest.cc @@ -24,7 +24,7 @@ #include "base/win/win_util.h" #endif -#if defined(OS_LINUX) +#if defined(OS_POSIX) && !defined(OS_MACOSX) #include "chrome/common/auto_start_linux.h" #include <glib.h> #endif @@ -114,7 +114,7 @@ TEST_F(ServiceProcessStateTest, AutoRun) { UTF8ToWide(value_name), &value)); autorun_command_line.reset(new CommandLine(CommandLine::FromString(value))); -#elif defined(OS_LINUX) +#elif defined(OS_POSIX) && !defined(OS_MACOSX) #if defined(GOOGLE_CHROME_BUILD) std::string base_desktop_name = "google-chrome-service.desktop"; #else // CHROMIUM_BUILD @@ -143,7 +143,7 @@ TEST_F(ServiceProcessStateTest, AutoRun) { EXPECT_FALSE(base::win::ReadCommandFromAutoRun(HKEY_CURRENT_USER, UTF8ToWide(value_name), &value)); -#elif defined(OS_LINUX) +#elif defined(OS_POSIX) && !defined(OS_MACOSX) EXPECT_FALSE(AutoStart::GetAutostartFileValue( GetServiceProcessScopedName(base_desktop_name), "Exec", &exec_value)); #endif // defined(OS_WIN) diff --git a/chrome/renderer/chrome_render_process_observer.cc b/chrome/renderer/chrome_render_process_observer.cc index cfb98a7..fca6265 100644 --- a/chrome/renderer/chrome_render_process_observer.cc +++ b/chrome/renderer/chrome_render_process_observer.cc @@ -356,7 +356,7 @@ ChromeRenderProcessObserver::ChromeRenderProcessObserver() { } #endif -#if defined(OS_LINUX) +#if defined(OS_POSIX) && !defined(OS_MACOSX) // Remoting requires NSS to function properly. if (!command_line.HasSwitch(switches::kSingleProcess) && command_line.HasSwitch(switches::kEnableRemoting)) { @@ -479,7 +479,7 @@ void ChromeRenderProcessObserver::OnPurgeMemory() { while (!v8::V8::IdleNotification()) { } -#if (defined(OS_WIN) || defined(OS_LINUX)) && defined(USE_TCMALLOC) +#if !defined(OS_MACOSX) && defined(USE_TCMALLOC) // Tell tcmalloc to release any free pages it's still holding. MallocExtension::instance()->ReleaseFreeMemory(); #endif diff --git a/chrome/tools/build/linux/sed.sh b/chrome/tools/build/linux/sed.sh index 22615cb..4605f7d 100755 --- a/chrome/tools/build/linux/sed.sh +++ b/chrome/tools/build/linux/sed.sh @@ -1,6 +1,6 @@ -#!/bin/bash +#!/bin/sh -# Copyright (c) 2009 The Chromium Authors. All rights reserved. +# Copyright (c) 2011 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. |