diff options
author | nick@chromium.org <nick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-15 23:18:42 +0000 |
---|---|---|
committer | nick@chromium.org <nick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-15 23:18:42 +0000 |
commit | 1cf6e88214a5b8b7c565f4885276e896d9743ee6 (patch) | |
tree | 55910d2d341d62b1a3da7dc016ec0b10b631261c /chrome/browser/sync/syncable | |
parent | b01e756f392e1c7f284280b6b5ba73a71cc69fa7 (diff) | |
download | chromium_src-1cf6e88214a5b8b7c565f4885276e896d9743ee6.zip chromium_src-1cf6e88214a5b8b7c565f4885276e896d9743ee6.tar.gz chromium_src-1cf6e88214a5b8b7c565f4885276e896d9743ee6.tar.bz2 |
Build sync engine as part of the browser build.
As before, syncapi is built as a dynamic library, and only
on windows. The difference is that it's built from source,
rather than being pulled in as a binary.
Changes to sync engine code:
* Use OS_WIN instead of OS_WINDOWS (requires build_config.h).
* Rename platform-specific files to match the chrome convention.
This allows them to be excluded by rules that already exist
in chrome.gyp. The convention is either a /win/ directory,
or an _win.cc at the end of the file. Other valid platforms
are _mac, _linux, and _posix
Changes to DEPS:
* On Windows, pull in pthreads-win32.
Changes to chrome.gyp:
* Add new library targets for sync, notifier, sync_proto, and
syncapi.
Review URL: http://codereview.chromium.org/193103
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26295 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sync/syncable')
-rw-r--r-- | chrome/browser/sync/syncable/directory_backing_store.cc | 8 | ||||
-rw-r--r-- | chrome/browser/sync/syncable/syncable.cc | 14 | ||||
-rw-r--r-- | chrome/browser/sync/syncable/syncable.h | 4 | ||||
-rw-r--r-- | chrome/browser/sync/syncable/syncable_unittest.cc | 24 |
4 files changed, 28 insertions, 22 deletions
diff --git a/chrome/browser/sync/syncable/directory_backing_store.cc b/chrome/browser/sync/syncable/directory_backing_store.cc index 3735fff..68cc56b 100644 --- a/chrome/browser/sync/syncable/directory_backing_store.cc +++ b/chrome/browser/sync/syncable/directory_backing_store.cc @@ -4,6 +4,8 @@ #include "chrome/browser/sync/syncable/directory_backing_store.h" +#include "build/build_config.h" + #ifdef OS_MACOSX #include <CoreFoundation/CoreFoundation.h> #elif defined(OS_LINUX) @@ -67,7 +69,7 @@ static void PathNameMatch16WithEscape(sqlite3_context* context, } static void RegisterPathNameCollate(sqlite3* dbhandle) { -#ifdef OS_WINDOWS +#ifdef OS_WIN const int collate = SQLITE_UTF16; #else const int collate = SQLITE_UTF8; @@ -85,12 +87,12 @@ static void RegisterPathNameMatch(sqlite3* dbhandle) { // comparison on mac, so that would have to be fixed if // we really wanted to use PathNameMatch on mac/linux w/ the // same pattern strings as we do on windows. -#ifdef OS_WINDOWS +#ifdef OS_WIN CHECK(SQLITE_OK == sqlite3_create_function(dbhandle, "like", 2, SQLITE_ANY, NULL, &PathNameMatch16, NULL, NULL)); CHECK(SQLITE_OK == sqlite3_create_function(dbhandle, "like", 3, SQLITE_ANY, NULL, &PathNameMatch16WithEscape, NULL, NULL)); -#endif // OS_WINDOWS +#endif // OS_WIN } static inline bool IsSqliteErrorOurFault(int result) { diff --git a/chrome/browser/sync/syncable/syncable.cc b/chrome/browser/sync/syncable/syncable.cc index 23a7a2f..ef63f13 100644 --- a/chrome/browser/sync/syncable/syncable.cc +++ b/chrome/browser/sync/syncable/syncable.cc @@ -4,6 +4,8 @@ #include "chrome/browser/sync/syncable/syncable.h" +#include "build/build_config.h" + #include <sys/stat.h> #include <sys/types.h> #include <time.h> @@ -11,7 +13,7 @@ #include <CoreFoundation/CoreFoundation.h> #elif defined(OS_LINUX) #include <glib.h> -#elif defined(OS_WINDOWS) +#elif defined(OS_WIN) #include <shlwapi.h> // for PathMatchSpec #endif @@ -36,7 +38,7 @@ #include "chrome/browser/sync/syncable/syncable_changes_version.h" #include "chrome/browser/sync/syncable/syncable_columns.h" #include "chrome/browser/sync/util/character_set_converters.h" -#include "chrome/browser/sync/util/compat-file.h" +#include "chrome/browser/sync/util/compat_file.h" #include "chrome/browser/sync/util/crypto_helpers.h" #include "chrome/browser/sync/util/event_sys-inl.h" #include "chrome/browser/sync/util/fast_dump.h" @@ -67,7 +69,7 @@ using std::string; namespace syncable { int64 Now() { -#ifdef OS_WINDOWS +#ifdef OS_WIN FILETIME filetime; SYSTEMTIME systime; GetSystemTime(&systime); @@ -91,7 +93,7 @@ int64 Now() { // Callback for sqlite3 int ComparePathNames16(void*, int a_bytes, const void* a, int b_bytes, const void* b) { -#ifdef OS_WINDOWS +#ifdef OS_WIN DCHECK_EQ(0, a_bytes % 2); DCHECK_EQ(0, b_bytes % 2); int result = CompareString(LOCALE_INVARIANT, NORM_IGNORECASE, @@ -252,7 +254,7 @@ Directory::~Directory() { } BOOL PathNameMatch(const PathString& pathname, const PathString& pathspec) { -#ifdef OS_WINDOWS +#ifdef OS_WIN // Note that if we go Vista only this is easier: // http://msdn2.microsoft.com/en-us/library/ms628611.aspx @@ -1866,7 +1868,7 @@ void DBName::MakeNoncollidingForEntry(BaseTransaction* trans, PathString GetFullPath(BaseTransaction* trans, const Entry& e) { PathString result; -#ifdef STL_MSVC +#ifdef COMPILER_MSVC result.reserve(MAX_PATH); #endif ReverseAppend(e.Get(NAME), &result); diff --git a/chrome/browser/sync/syncable/syncable.h b/chrome/browser/sync/syncable/syncable.h index 8a7a123..1d343f9 100644 --- a/chrome/browser/sync/syncable/syncable.h +++ b/chrome/browser/sync/syncable/syncable.h @@ -21,8 +21,8 @@ #include "chrome/browser/sync/syncable/directory_event.h" #include "chrome/browser/sync/syncable/path_name_cmp.h" #include "chrome/browser/sync/syncable/syncable_id.h" -#include "chrome/browser/sync/util/compat-file.h" -#include "chrome/browser/sync/util/compat-pthread.h" +#include "chrome/browser/sync/util/compat_file.h" +#include "chrome/browser/sync/util/compat_pthread.h" #include "chrome/browser/sync/util/dbgq.h" #include "chrome/browser/sync/util/event_sys.h" #include "chrome/browser/sync/util/path_helpers.h" diff --git a/chrome/browser/sync/syncable/syncable_unittest.cc b/chrome/browser/sync/syncable/syncable_unittest.cc index 592c103..49424f9 100644 --- a/chrome/browser/sync/syncable/syncable_unittest.cc +++ b/chrome/browser/sync/syncable/syncable_unittest.cc @@ -4,6 +4,8 @@ #include "chrome/browser/sync/syncable/syncable.h" +#include "build/build_config.h" + #include <sys/types.h> #include <iostream> @@ -12,13 +14,13 @@ // TODO(ncarter): Winnow down the OS-specific includes from the test // file. -#if defined(OS_WINDOWS) +#if defined(OS_WIN) #include <tchar.h> #include <atlbase.h> #include <process.h> -#endif // defined(OS_WINDOWS) +#endif // defined(OS_WIN) -#if !defined(OS_WINDOWS) +#if !defined(OS_WIN) #define MAX_PATH PATH_MAX #include <strstream> #include <ostream> @@ -26,7 +28,7 @@ #include <sys/ipc.h> #include <sys/sem.h> #include <sys/times.h> -#endif // !defined(OS_WINDOWS) +#endif // !defined(OS_WIN) #include "base/at_exit.h" #include "base/logging.h" @@ -35,7 +37,7 @@ #include "chrome/browser/sync/syncable/directory_manager.h" #include "chrome/browser/sync/util/character_set_converters.h" #include "chrome/browser/sync/util/closure.h" -#include "chrome/browser/sync/util/compat-file.h" +#include "chrome/browser/sync/util/compat_file.h" #include "chrome/browser/sync/util/event_sys-inl.h" #include "chrome/browser/sync/util/path_helpers.h" #include "chrome/browser/sync/util/pthread_helpers.h" @@ -981,7 +983,7 @@ timespec operator + (const timespec& a, const timespec& b) { } void SleepMs(int milliseconds) { -#ifdef OS_WINDOWS +#ifdef OS_WIN Sleep(milliseconds); #else usleep(milliseconds * 1000); @@ -1134,7 +1136,7 @@ TEST(Syncable, ComparePathNames) { } } -#ifndef OS_WINDOWS +#ifndef OS_WIN // This table lists (to the best of my knowledge) every pair of characters // in unicode such that: // for all i: tolower(kUpperToLowerMap[i].upper) = kUpperToLowerMap[i].lower @@ -1474,10 +1476,10 @@ TEST(Syncable, ComparePathNames) { ADD_FAILURE() << msg.str(); } } -#endif // not defined OS_WINDOWS +#endif // not defined OS_WIN } -#ifdef OS_WINDOWS +#ifdef OS_WIN TEST(Syncable, PathNameMatch) { // basic stuff, not too many otherwise we're testing the os. EXPECT_TRUE(PathNameMatch(PSTR("bob"), PSTR("bob"))); @@ -1500,7 +1502,7 @@ TEST(Syncable, PathNameMatch) { // other whitespace should give no matches. EXPECT_FALSE(PathNameMatch(PSTR("bob"), PSTR("\tbob"))); } -#endif // OS_WINDOWS +#endif // OS_WIN } // namespace @@ -1532,7 +1534,7 @@ TEST_F(SyncableDirectoryTest, Bug1509232) { } // namespace syncable -#ifdef OS_WINDOWS +#ifdef OS_WIN class LocalModule : public CAtlExeModuleT<LocalModule> { }; LocalModule module_; |