Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(873)

Unified Diff: components/sync/syncable/syncable_enum_conversions.cc

Issue 2130453004: [Sync] Move //sync to //components/sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/sync/syncable/syncable_enum_conversions.cc
diff --git a/sync/syncable/syncable_enum_conversions.cc b/components/sync/syncable/syncable_enum_conversions.cc
similarity index 59%
rename from sync/syncable/syncable_enum_conversions.cc
rename to components/sync/syncable/syncable_enum_conversions.cc
index c74b170450c1088f5ae9aa8dd0b6429eaa690235..cd3f663ae329c76c6ef89333901e5789d788c3f7 100644
--- a/sync/syncable/syncable_enum_conversions.cc
+++ b/components/sync/syncable/syncable_enum_conversions.cc
@@ -4,7 +4,7 @@
// Keep this file in sync with entry_kernel.h.
-#include "sync/syncable/syncable_enum_conversions.h"
+#include "components/sync/syncable/syncable_enum_conversions.h"
#include "base/logging.h"
@@ -13,134 +13,132 @@ namespace syncable {
// We can't tokenize expected_min/expected_max since it can be a
// general expression.
-#define ASSERT_ENUM_BOUNDS(enum_min, enum_max, expected_min, expected_max) \
- static_assert(static_cast<int>(enum_min) == \
- static_cast<int>(expected_min), \
- #enum_min " not " #expected_min); \
- static_assert(static_cast<int>(enum_max) == \
- static_cast<int>(expected_max), \
+#define ASSERT_ENUM_BOUNDS(enum_min, enum_max, expected_min, expected_max) \
+ static_assert(static_cast<int>(enum_min) == static_cast<int>(expected_min), \
+ #enum_min " not " #expected_min); \
+ static_assert(static_cast<int>(enum_max) == static_cast<int>(expected_max), \
#enum_max " not " #expected_max);
-#define ENUM_CASE(enum_value) case enum_value: return #enum_value
+#define ENUM_CASE(enum_value) \
+ case enum_value: \
+ return #enum_value
const char* GetMetahandleFieldString(MetahandleField metahandle_field) {
- ASSERT_ENUM_BOUNDS(META_HANDLE, META_HANDLE,
- INT64_FIELDS_BEGIN, BASE_VERSION - 1);
- switch (metahandle_field) {
- ENUM_CASE(META_HANDLE);
- }
+ ASSERT_ENUM_BOUNDS(META_HANDLE, META_HANDLE, INT64_FIELDS_BEGIN,
+ BASE_VERSION - 1);
+ switch (metahandle_field) { ENUM_CASE(META_HANDLE); }
NOTREACHED();
return "";
}
const char* GetBaseVersionString(BaseVersion base_version) {
- ASSERT_ENUM_BOUNDS(BASE_VERSION, BASE_VERSION,
- META_HANDLE + 1, SERVER_VERSION - 1);
- switch (base_version) {
- ENUM_CASE(BASE_VERSION);
- }
+ ASSERT_ENUM_BOUNDS(BASE_VERSION, BASE_VERSION, META_HANDLE + 1,
+ SERVER_VERSION - 1);
+ switch (base_version) { ENUM_CASE(BASE_VERSION); }
NOTREACHED();
return "";
}
const char* GetInt64FieldString(Int64Field int64_field) {
- ASSERT_ENUM_BOUNDS(SERVER_VERSION, TRANSACTION_VERSION,
- BASE_VERSION + 1, INT64_FIELDS_END - 1);
+ ASSERT_ENUM_BOUNDS(SERVER_VERSION, TRANSACTION_VERSION, BASE_VERSION + 1,
+ INT64_FIELDS_END - 1);
switch (int64_field) {
ENUM_CASE(SERVER_VERSION);
ENUM_CASE(LOCAL_EXTERNAL_ID);
ENUM_CASE(TRANSACTION_VERSION);
- case INT64_FIELDS_END: break;
+ case INT64_FIELDS_END:
+ break;
}
NOTREACHED();
return "";
}
const char* GetTimeFieldString(TimeField time_field) {
- ASSERT_ENUM_BOUNDS(MTIME, SERVER_CTIME,
- TIME_FIELDS_BEGIN, TIME_FIELDS_END - 1);
+ ASSERT_ENUM_BOUNDS(MTIME, SERVER_CTIME, TIME_FIELDS_BEGIN,
+ TIME_FIELDS_END - 1);
switch (time_field) {
ENUM_CASE(MTIME);
ENUM_CASE(SERVER_MTIME);
ENUM_CASE(CTIME);
ENUM_CASE(SERVER_CTIME);
- case TIME_FIELDS_END: break;
+ case TIME_FIELDS_END:
+ break;
}
NOTREACHED();
return "";
}
const char* GetIdFieldString(IdField id_field) {
- ASSERT_ENUM_BOUNDS(ID, SERVER_PARENT_ID,
- ID_FIELDS_BEGIN, ID_FIELDS_END - 1);
+ ASSERT_ENUM_BOUNDS(ID, SERVER_PARENT_ID, ID_FIELDS_BEGIN, ID_FIELDS_END - 1);
switch (id_field) {
ENUM_CASE(ID);
ENUM_CASE(PARENT_ID);
ENUM_CASE(SERVER_PARENT_ID);
- case ID_FIELDS_END: break;
+ case ID_FIELDS_END:
+ break;
}
NOTREACHED();
return "";
}
const char* GetIndexedBitFieldString(IndexedBitField indexed_bit_field) {
- ASSERT_ENUM_BOUNDS(IS_UNSYNCED, IS_UNAPPLIED_UPDATE,
- BIT_FIELDS_BEGIN, INDEXED_BIT_FIELDS_END - 1);
+ ASSERT_ENUM_BOUNDS(IS_UNSYNCED, IS_UNAPPLIED_UPDATE, BIT_FIELDS_BEGIN,
+ INDEXED_BIT_FIELDS_END - 1);
switch (indexed_bit_field) {
ENUM_CASE(IS_UNSYNCED);
ENUM_CASE(IS_UNAPPLIED_UPDATE);
- case INDEXED_BIT_FIELDS_END: break;
+ case INDEXED_BIT_FIELDS_END:
+ break;
}
NOTREACHED();
return "";
}
const char* GetIsDelFieldString(IsDelField is_del_field) {
- ASSERT_ENUM_BOUNDS(IS_DEL, IS_DEL,
- INDEXED_BIT_FIELDS_END, IS_DIR - 1);
- switch (is_del_field) {
- ENUM_CASE(IS_DEL);
- }
+ ASSERT_ENUM_BOUNDS(IS_DEL, IS_DEL, INDEXED_BIT_FIELDS_END, IS_DIR - 1);
+ switch (is_del_field) { ENUM_CASE(IS_DEL); }
NOTREACHED();
return "";
}
const char* GetBitFieldString(BitField bit_field) {
- ASSERT_ENUM_BOUNDS(IS_DIR, SERVER_IS_DEL,
- IS_DEL + 1, BIT_FIELDS_END - 1);
+ ASSERT_ENUM_BOUNDS(IS_DIR, SERVER_IS_DEL, IS_DEL + 1, BIT_FIELDS_END - 1);
switch (bit_field) {
ENUM_CASE(IS_DIR);
ENUM_CASE(SERVER_IS_DIR);
ENUM_CASE(SERVER_IS_DEL);
- case BIT_FIELDS_END: break;
+ case BIT_FIELDS_END:
+ break;
}
NOTREACHED();
return "";
}
const char* GetStringFieldString(StringField string_field) {
- ASSERT_ENUM_BOUNDS(NON_UNIQUE_NAME, UNIQUE_BOOKMARK_TAG,
- STRING_FIELDS_BEGIN, STRING_FIELDS_END - 1);
+ ASSERT_ENUM_BOUNDS(NON_UNIQUE_NAME, UNIQUE_BOOKMARK_TAG, STRING_FIELDS_BEGIN,
+ STRING_FIELDS_END - 1);
switch (string_field) {
ENUM_CASE(NON_UNIQUE_NAME);
ENUM_CASE(SERVER_NON_UNIQUE_NAME);
ENUM_CASE(UNIQUE_SERVER_TAG);
ENUM_CASE(UNIQUE_CLIENT_TAG);
ENUM_CASE(UNIQUE_BOOKMARK_TAG);
- case STRING_FIELDS_END: break;
+ case STRING_FIELDS_END:
+ break;
}
NOTREACHED();
return "";
}
const char* GetProtoFieldString(ProtoField proto_field) {
- ASSERT_ENUM_BOUNDS(SPECIFICS, BASE_SERVER_SPECIFICS,
- PROTO_FIELDS_BEGIN, PROTO_FIELDS_END - 1);
+ ASSERT_ENUM_BOUNDS(SPECIFICS, BASE_SERVER_SPECIFICS, PROTO_FIELDS_BEGIN,
+ PROTO_FIELDS_END - 1);
switch (proto_field) {
ENUM_CASE(SPECIFICS);
ENUM_CASE(SERVER_SPECIFICS);
ENUM_CASE(BASE_SERVER_SPECIFICS);
- case PROTO_FIELDS_END: break;
+ case PROTO_FIELDS_END:
+ break;
}
NOTREACHED();
return "";
@@ -153,7 +151,8 @@ const char* GetUniquePositionFieldString(UniquePositionField position_field) {
switch (position_field) {
ENUM_CASE(SERVER_UNIQUE_POSITION);
ENUM_CASE(UNIQUE_POSITION);
- case UNIQUE_POSITION_FIELDS_END: break;
+ case UNIQUE_POSITION_FIELDS_END:
+ break;
}
NOTREACHED();
return "";
@@ -161,26 +160,26 @@ const char* GetUniquePositionFieldString(UniquePositionField position_field) {
const char* GetAttachmentMetadataFieldString(
AttachmentMetadataField attachment_metadata_field) {
- ASSERT_ENUM_BOUNDS(ATTACHMENT_METADATA,
- SERVER_ATTACHMENT_METADATA,
+ ASSERT_ENUM_BOUNDS(ATTACHMENT_METADATA, SERVER_ATTACHMENT_METADATA,
ATTACHMENT_METADATA_FIELDS_BEGIN,
ATTACHMENT_METADATA_FIELDS_END - 1);
switch (attachment_metadata_field) {
ENUM_CASE(ATTACHMENT_METADATA);
ENUM_CASE(SERVER_ATTACHMENT_METADATA);
- case ATTACHMENT_METADATA_FIELDS_END: break;
+ case ATTACHMENT_METADATA_FIELDS_END:
+ break;
}
NOTREACHED();
return "";
}
const char* GetBitTempString(BitTemp bit_temp) {
- ASSERT_ENUM_BOUNDS(SYNCING, DIRTY_SYNC,
- BIT_TEMPS_BEGIN, BIT_TEMPS_END - 1);
+ ASSERT_ENUM_BOUNDS(SYNCING, DIRTY_SYNC, BIT_TEMPS_BEGIN, BIT_TEMPS_END - 1);
switch (bit_temp) {
ENUM_CASE(SYNCING);
ENUM_CASE(DIRTY_SYNC);
- case BIT_TEMPS_END: break;
+ case BIT_TEMPS_END:
+ break;
}
NOTREACHED();
return "";
« no previous file with comments | « components/sync/syncable/syncable_enum_conversions.h ('k') | components/sync/syncable/syncable_enum_conversions_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698