summaryrefslogtreecommitdiffstats
path: root/chrome/browser/sync/util
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/sync/util')
-rw-r--r--chrome/browser/sync/util/character_set_converters_unittest.cc8
-rw-r--r--chrome/browser/sync/util/compat_file.h2
-rw-r--r--chrome/browser/sync/util/compat_file_posix.cc4
-rw-r--r--chrome/browser/sync/util/event_sys-inl.h2
-rw-r--r--chrome/browser/sync/util/event_sys_unittest.cc8
-rw-r--r--chrome/browser/sync/util/highres_timer_unittest.cc15
-rw-r--r--chrome/browser/sync/util/path_helpers_unittest.cc6
-rw-r--r--chrome/browser/sync/util/query_helpers.cc8
-rw-r--r--chrome/browser/sync/util/sync_types.h2
-rw-r--r--chrome/browser/sync/util/user_settings.cc2
10 files changed, 23 insertions, 34 deletions
diff --git a/chrome/browser/sync/util/character_set_converters_unittest.cc b/chrome/browser/sync/util/character_set_converters_unittest.cc
index b1aa604..6274a1d 100644
--- a/chrome/browser/sync/util/character_set_converters_unittest.cc
+++ b/chrome/browser/sync/util/character_set_converters_unittest.cc
@@ -35,7 +35,7 @@ TEST_F(CharacterSetConverterTest, ASCIIConversionTest) {
ToPathString to_16(ascii);
ASSERT_TRUE(to_16.good());
ASSERT_TRUE(PathString(wide) == to_16.get_string16());
-#ifdef OS_WIN
+#if defined(OS_WIN)
// On Linux, PathString is already UTF8
ASSERT_EQ(string(ascii), static_cast<string>(ToUTF8(wide)));
#endif
@@ -44,7 +44,7 @@ TEST_F(CharacterSetConverterTest, ASCIIConversionTest) {
// ASSERT_TRUE(wide == ToPathString(utf8).get_string16());
}
-#ifdef OS_WIN
+#if defined(OS_WIN)
// On Linux, PathString is already UTF8
TEST_F(CharacterSetConverterTest, UnicodeConversionText) {
// Source data obtained by running od -b on files saved in utf-8 and unicode
@@ -78,7 +78,7 @@ TEST_F(CharacterSetConverterTest, UnicodeConversionText) {
ASSERT_TRUE(wide == to_16.get_string16());
ASSERT_EQ(string(utf8), reinterpret_cast<const string&>(ToUTF8(wide)));
}
-#endif
+#endif // defined(OS_WIN)
TEST_F(CharacterSetConverterTest, AppendUTF8Tests) {
PathString one = PSTR("one");
@@ -108,7 +108,7 @@ TEST_F(CharacterSetConverterTest, AppendPathStringTests) {
ASSERT_TRUE(out == PathString(PSTR("onetwothree")));
}
-#ifdef OS_WIN
+#if defined(OS_WIN)
namespace {
// See http://en.wikipedia.org/wiki/UTF-16 for an explanation of UTF16.
// For a test case we use the UTF-8 and UTF-16 encoding of char 119070
diff --git a/chrome/browser/sync/util/compat_file.h b/chrome/browser/sync/util/compat_file.h
index a2bbf78..011dafe 100644
--- a/chrome/browser/sync/util/compat_file.h
+++ b/chrome/browser/sync/util/compat_file.h
@@ -20,7 +20,7 @@ extern const PathChar* const kPathSeparator;
// Returns 0 on success, non-zero on failure.
int PathRemove(const PathString& path);
-#ifdef OS_WIN
+#if defined(OS_WIN)
inline int PathRemove(const PathString& path) {
return _wremove(path.c_str());
}
diff --git a/chrome/browser/sync/util/compat_file_posix.cc b/chrome/browser/sync/util/compat_file_posix.cc
index 62ba56f..f84a379e6 100644
--- a/chrome/browser/sync/util/compat_file_posix.cc
+++ b/chrome/browser/sync/util/compat_file_posix.cc
@@ -2,7 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#if !defined(POSIX)
+#include "build/build_config.h"
+
+#if !defined(OS_POSIX)
#error Compile this file on Mac OS X or Linux only.
#endif
diff --git a/chrome/browser/sync/util/event_sys-inl.h b/chrome/browser/sync/util/event_sys-inl.h
index c2f3b44..320a6f93 100644
--- a/chrome/browser/sync/util/event_sys-inl.h
+++ b/chrome/browser/sync/util/event_sys-inl.h
@@ -118,7 +118,7 @@ class EventChannel {
// Make sure all the listeners have been disconnected. Otherwise, they
// will try to call RemoveListener() at a later date.
-#ifdef DEBUG
+#if defined(DEBUG)
AutoLock lock(listeners_mutex_);
for (typename Listeners::iterator i = listeners_.begin();
i != listeners_.end(); ++i) {
diff --git a/chrome/browser/sync/util/event_sys_unittest.cc b/chrome/browser/sync/util/event_sys_unittest.cc
index c39ea9a..9afd64b 100644
--- a/chrome/browser/sync/util/event_sys_unittest.cc
+++ b/chrome/browser/sync/util/event_sys_unittest.cc
@@ -10,6 +10,7 @@
#include "base/basictypes.h"
#include "base/logging.h"
#include "base/message_loop.h"
+#include "base/platform_thread.h"
#include "base/port.h"
#include "build/build_config.h"
#include "chrome/browser/sync/util/event_sys-inl.h"
@@ -223,12 +224,7 @@ class ThreadTester : public EventListener<TestEvent>,
remove_event_mutex_.Release();
remove_event_.Broadcast();
- // Windows and posix use different functions to sleep.
-#ifdef OS_WIN
- Sleep(1);
-#else
- sleep(1);
-#endif
+ PlatformThread::Sleep(1);
for (size_t i = 0; i < threads_.size(); i++) {
if (threads_[i].completed)
diff --git a/chrome/browser/sync/util/highres_timer_unittest.cc b/chrome/browser/sync/util/highres_timer_unittest.cc
index 0d3a905..2257262 100644
--- a/chrome/browser/sync/util/highres_timer_unittest.cc
+++ b/chrome/browser/sync/util/highres_timer_unittest.cc
@@ -5,6 +5,7 @@
// High resolution timer unit tests.
#include "base/basictypes.h"
+#include "base/platform_thread.h"
#include "build/build_config.h"
#include "chrome/browser/sync/util/highres_timer.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -31,20 +32,10 @@ TEST(HighresTimer, DISABLED_SecondClock) {
HighresTimer timer;
EXPECT_TRUE(0 == timer.GetElapsedSec());
-#ifdef OS_WIN
- ::Sleep(250);
-#else
- struct timespec ts1 = {0, 250000000};
- nanosleep(&ts1, 0);
-#endif
+ PlatformThread::Sleep(250);
EXPECT_TRUE(0 == timer.GetElapsedSec());
EXPECT_TRUE(230 <= timer.GetElapsedMs());
EXPECT_TRUE(270 >= timer.GetElapsedMs());
-#ifdef OS_WIN
- ::Sleep(251);
-#else
- struct timespec ts2 = {0, 251000000};
- nanosleep(&ts2, 0);
-#endif
+ PlatformThread::Sleep(251);
EXPECT_TRUE(1 == timer.GetElapsedSec());
}
diff --git a/chrome/browser/sync/util/path_helpers_unittest.cc b/chrome/browser/sync/util/path_helpers_unittest.cc
index 827e2c3..62359e1 100644
--- a/chrome/browser/sync/util/path_helpers_unittest.cc
+++ b/chrome/browser/sync/util/path_helpers_unittest.cc
@@ -65,7 +65,7 @@ TEST(PathHelpersTest, PathStrutil) {
}
TEST(PathHelpersTest, SanitizePathComponent) {
-#ifdef OS_WIN
+#if defined(OS_WIN)
EXPECT_EQ(MakePathComponentOSLegal(L"bar"), L"");
EXPECT_EQ(MakePathComponentOSLegal(L"bar <"), L"bar");
EXPECT_EQ(MakePathComponentOSLegal(L"bar.<"), L"bar");
@@ -117,7 +117,7 @@ TEST(PathHelpersTest, SanitizePathComponent) {
EXPECT_EQ(MakePathComponentOSLegal(L"<.<"), L"~1");
EXPECT_EQ(MakePathComponentOSLegal(L"<.<txt"), L".txt");
EXPECT_EQ(MakePathComponentOSLegal(L"txt<.<"), L"txt");
-#else // OS_WIN
+#else // !defined(OS_WIN)
EXPECT_EQ(MakePathComponentOSLegal("bar"), "");
EXPECT_EQ(MakePathComponentOSLegal("b"), "");
@@ -126,7 +126,7 @@ TEST(PathHelpersTest, SanitizePathComponent) {
EXPECT_EQ(MakePathComponentOSLegal("/"), ":");
EXPECT_EQ(MakePathComponentOSLegal(":"), "");
-#endif // OS_WIN
+#endif // defined(OS_WIN)
}
} // namespace syncable
diff --git a/chrome/browser/sync/util/query_helpers.cc b/chrome/browser/sync/util/query_helpers.cc
index 34dc79f..c27a877 100644
--- a/chrome/browser/sync/util/query_helpers.cc
+++ b/chrome/browser/sync/util/query_helpers.cc
@@ -65,7 +65,7 @@ int SqliteOpen(PathString filename, sqlite3** db) {
(filename.c_str(), db);
LOG_IF(ERROR, SQLITE_OK != result) << "Error opening " << filename << ": "
<< result;
-#ifdef OS_WIN
+#if defined(OS_WIN)
if (SQLITE_OK == result) {
// Make sure we mark the db file as not indexed so since if any other app
// opens it, it can break our db locking.
@@ -76,12 +76,12 @@ int SqliteOpen(PathString filename, sqlite3** db) {
attrs = attrs | FILE_ATTRIBUTE_NOT_CONTENT_INDEXED;
SetFileAttributes(filename.c_str(), attrs);
}
-#endif // OS_WIN
+#endif // defined(OS_WIN)
// Be patient as we set pragmas.
sqlite3_busy_timeout(*db, numeric_limits<int>::max());
-#ifndef DISABLE_SQLITE_FULL_FSYNC
+#if !defined(DISABLE_SQLITE_FULL_FSYNC)
ExecOrDie(*db, "PRAGMA fullfsync = 1");
-#endif // DISABLE_SQLITE_FULL_FSYNC
+#endif // !defined(DISABLE_SQLITE_FULL_FSYNC)
ExecOrDie(*db, "PRAGMA synchronous = 2");
sqlite3_busy_timeout(*db, 0);
return SQLITE_OK;
diff --git a/chrome/browser/sync/util/sync_types.h b/chrome/browser/sync/util/sync_types.h
index 26469cc..71b9c42 100644
--- a/chrome/browser/sync/util/sync_types.h
+++ b/chrome/browser/sync/util/sync_types.h
@@ -13,7 +13,7 @@
#include "build/build_config.h"
// TODO(timsteele): Use base/file_path.h instead of PathString.
-#ifdef OS_WIN
+#if defined(OS_WIN)
#define PATHSTRING_IS_STD_STRING 0
typedef std::wstring PathString;
diff --git a/chrome/browser/sync/util/user_settings.cc b/chrome/browser/sync/util/user_settings.cc
index a8ab972..1c867a6 100644
--- a/chrome/browser/sync/util/user_settings.cc
+++ b/chrome/browser/sync/util/user_settings.cc
@@ -180,7 +180,7 @@ bool UserSettings::Init(const PathString& settings_path) {
}
ExecOrDie(dbhandle.get(), "COMMIT TRANSACTION");
}
-#ifdef OS_WIN
+#if defined(OS_WIN)
// Do not index this file. Scanning can occur every time we close the file,
// which causes long delays in SQLite's file locking.
const DWORD attrs = GetFileAttributes(settings_path.c_str());