diff options
author | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-20 17:25:41 +0000 |
---|---|---|
committer | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-20 17:25:41 +0000 |
commit | d45f0d9764d93d8f89564a5df7fa505c6a87a6fe (patch) | |
tree | 89ce4ea823cf922e6955dafcfb275459589cef0a /sync/api | |
parent | 73e5d26041b0a22e16e383e84a8177930c9fd055 (diff) | |
download | chromium_src-d45f0d9764d93d8f89564a5df7fa505c6a87a6fe.zip chromium_src-d45f0d9764d93d8f89564a5df7fa505c6a87a6fe.tar.gz chromium_src-d45f0d9764d93d8f89564a5df7fa505c6a87a6fe.tar.bz2 |
[Sync] Remove unneeded 'using syncer::' lines and 'syncer::' scopings
Since (almost) everything in sync/ is now in the 'syncer' namespace,
all of these are redundant.
Clean up indentation.
Put sync_{client,listen_notifications} into syncer namespace.
BUG=128060
TEST=
Review URL: https://chromiumcodereview.appspot.com/10795018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@147675 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync/api')
-rw-r--r-- | sync/api/fake_syncable_service.cc | 9 | ||||
-rw-r--r-- | sync/api/fake_syncable_service.h | 8 | ||||
-rw-r--r-- | sync/api/sync_change.cc | 4 | ||||
-rw-r--r-- | sync/api/sync_change_unittest.cc | 14 | ||||
-rw-r--r-- | sync/api/sync_data.cc | 21 | ||||
-rw-r--r-- | sync/api/sync_data.h | 11 | ||||
-rw-r--r-- | sync/api/sync_error.cc | 14 | ||||
-rw-r--r-- | sync/api/sync_error.h | 10 | ||||
-rw-r--r-- | sync/api/sync_error_unittest.cc | 17 | ||||
-rw-r--r-- | sync/api/syncable_service.h | 6 |
10 files changed, 54 insertions, 60 deletions
diff --git a/sync/api/fake_syncable_service.cc b/sync/api/fake_syncable_service.cc index 078201b..731b24d 100644 --- a/sync/api/fake_syncable_service.cc +++ b/sync/api/fake_syncable_service.cc @@ -11,7 +11,7 @@ namespace syncer { FakeSyncableService::FakeSyncableService() : syncing_(false), - type_(syncer::UNSPECIFIED) {} + type_(UNSPECIFIED) {} FakeSyncableService::~FakeSyncableService() {} @@ -31,7 +31,7 @@ bool FakeSyncableService::syncing() const { // SyncableService implementation. SyncError FakeSyncableService::MergeDataAndStartSyncing( - syncer::ModelType type, + ModelType type, const SyncDataList& initial_sync_data, scoped_ptr<SyncChangeProcessor> sync_processor, scoped_ptr<SyncErrorFactory> sync_error_factory) { @@ -43,13 +43,12 @@ SyncError FakeSyncableService::MergeDataAndStartSyncing( return merge_data_and_start_syncing_error_; } -void FakeSyncableService::StopSyncing(syncer::ModelType type) { +void FakeSyncableService::StopSyncing(ModelType type) { syncing_ = false; sync_processor_.reset(); } -SyncDataList FakeSyncableService::GetAllSyncData( - syncer::ModelType type) const { +SyncDataList FakeSyncableService::GetAllSyncData(ModelType type) const { return SyncDataList(); } diff --git a/sync/api/fake_syncable_service.h b/sync/api/fake_syncable_service.h index 483325a..5a501ae 100644 --- a/sync/api/fake_syncable_service.h +++ b/sync/api/fake_syncable_service.h @@ -28,12 +28,12 @@ class FakeSyncableService : public SyncableService { // SyncableService implementation. virtual SyncError MergeDataAndStartSyncing( - syncer::ModelType type, + ModelType type, const SyncDataList& initial_sync_data, scoped_ptr<SyncChangeProcessor> sync_processor, scoped_ptr<SyncErrorFactory> sync_error_factory) OVERRIDE; - virtual void StopSyncing(syncer::ModelType type) OVERRIDE; - virtual SyncDataList GetAllSyncData(syncer::ModelType type) const OVERRIDE; + virtual void StopSyncing(ModelType type) OVERRIDE; + virtual SyncDataList GetAllSyncData(ModelType type) const OVERRIDE; virtual SyncError ProcessSyncChanges( const tracked_objects::Location& from_here, const SyncChangeList& change_list) OVERRIDE; @@ -43,7 +43,7 @@ class FakeSyncableService : public SyncableService { SyncError merge_data_and_start_syncing_error_; SyncError process_sync_changes_error_; bool syncing_; - syncer::ModelType type_; + ModelType type_; }; } // namespace syncer diff --git a/sync/api/sync_change.cc b/sync/api/sync_change.cc index ee1cdea..a9b9199 100644 --- a/sync/api/sync_change.cc +++ b/sync/api/sync_change.cc @@ -29,11 +29,11 @@ bool SyncChange::IsValid() const { // Data from the syncer must always have valid specifics. if (!sync_data_.IsLocal()) - return syncer::IsRealDataType(sync_data_.GetDataType()); + return IsRealDataType(sync_data_.GetDataType()); // Local changes must always have a tag and specify a valid datatype. if (sync_data_.GetTag().empty() || - !syncer::IsRealDataType(sync_data_.GetDataType())) { + !IsRealDataType(sync_data_.GetDataType())) { return false; } diff --git a/sync/api/sync_change_unittest.cc b/sync/api/sync_change_unittest.cc index f5aab08..b989e41 100644 --- a/sync/api/sync_change_unittest.cc +++ b/sync/api/sync_change_unittest.cc @@ -27,10 +27,10 @@ TEST_F(SyncChangeTest, LocalDelete) { std::string tag = "client_tag"; SyncChange e(FROM_HERE, change_type, - SyncData::CreateLocalDelete(tag, syncer::PREFERENCES)); + SyncData::CreateLocalDelete(tag, PREFERENCES)); EXPECT_EQ(change_type, e.change_type()); EXPECT_EQ(tag, e.sync_data().GetTag()); - EXPECT_EQ(syncer::PREFERENCES, e.sync_data().GetDataType()); + EXPECT_EQ(PREFERENCES, e.sync_data().GetDataType()); } TEST_F(SyncChangeTest, LocalUpdate) { @@ -46,7 +46,7 @@ TEST_F(SyncChangeTest, LocalUpdate) { EXPECT_EQ(change_type, e.change_type()); EXPECT_EQ(tag, e.sync_data().GetTag()); EXPECT_EQ(title, e.sync_data().GetTitle()); - EXPECT_EQ(syncer::PREFERENCES, e.sync_data().GetDataType()); + EXPECT_EQ(PREFERENCES, e.sync_data().GetDataType()); scoped_ptr<DictionaryValue> ref_spec(EntitySpecificsToValue(specifics)); scoped_ptr<DictionaryValue> e_spec(EntitySpecificsToValue( e.sync_data().GetSpecifics())); @@ -66,7 +66,7 @@ TEST_F(SyncChangeTest, LocalAdd) { EXPECT_EQ(change_type, e.change_type()); EXPECT_EQ(tag, e.sync_data().GetTag()); EXPECT_EQ(title, e.sync_data().GetTitle()); - EXPECT_EQ(syncer::PREFERENCES, e.sync_data().GetDataType()); + EXPECT_EQ(PREFERENCES, e.sync_data().GetDataType()); scoped_ptr<DictionaryValue> ref_spec(EntitySpecificsToValue(specifics)); scoped_ptr<DictionaryValue> e_spec(EntitySpecificsToValue( e.sync_data().GetSpecifics())); @@ -109,7 +109,7 @@ TEST_F(SyncChangeTest, SyncerChanges) { // Verify update. SyncChange e = change_list[0]; EXPECT_EQ(SyncChange::ACTION_UPDATE, e.change_type()); - EXPECT_EQ(syncer::PREFERENCES, e.sync_data().GetDataType()); + EXPECT_EQ(PREFERENCES, e.sync_data().GetDataType()); scoped_ptr<DictionaryValue> ref_spec(EntitySpecificsToValue( update_specifics)); scoped_ptr<DictionaryValue> e_spec(EntitySpecificsToValue( @@ -119,7 +119,7 @@ TEST_F(SyncChangeTest, SyncerChanges) { // Verify add. e = change_list[1]; EXPECT_EQ(SyncChange::ACTION_ADD, e.change_type()); - EXPECT_EQ(syncer::PREFERENCES, e.sync_data().GetDataType()); + EXPECT_EQ(PREFERENCES, e.sync_data().GetDataType()); ref_spec.reset(EntitySpecificsToValue(add_specifics)); e_spec.reset(EntitySpecificsToValue(e.sync_data().GetSpecifics())); EXPECT_TRUE(ref_spec->Equals(e_spec.get())); @@ -127,7 +127,7 @@ TEST_F(SyncChangeTest, SyncerChanges) { // Verify delete. e = change_list[2]; EXPECT_EQ(SyncChange::ACTION_DELETE, e.change_type()); - EXPECT_EQ(syncer::PREFERENCES, e.sync_data().GetDataType()); + EXPECT_EQ(PREFERENCES, e.sync_data().GetDataType()); ref_spec.reset(EntitySpecificsToValue(delete_specifics)); e_spec.reset(EntitySpecificsToValue(e.sync_data().GetSpecifics())); EXPECT_TRUE(ref_spec->Equals(e_spec.get())); diff --git a/sync/api/sync_data.cc b/sync/api/sync_data.cc index a2a4191..b9e2ca9 100644 --- a/sync/api/sync_data.cc +++ b/sync/api/sync_data.cc @@ -44,7 +44,7 @@ void SyncData::ImmutableSyncEntityTraits::Swap(sync_pb::SyncEntity* t1, SyncData::SyncData() : is_valid_(false), - id_(syncer::kInvalidId) {} + id_(kInvalidId) {} SyncData::SyncData(int64 id, sync_pb::SyncEntity* entity) : is_valid_(true), @@ -56,9 +56,9 @@ SyncData::~SyncData() {} // Static. SyncData SyncData::CreateLocalDelete( const std::string& sync_tag, - syncer::ModelType datatype) { + ModelType datatype) { sync_pb::EntitySpecifics specifics; - syncer::AddDefaultFieldValue(datatype, &specifics); + AddDefaultFieldValue(datatype, &specifics); return CreateLocalData(sync_tag, "", specifics); } @@ -71,13 +71,13 @@ SyncData SyncData::CreateLocalData( entity.set_client_defined_unique_tag(sync_tag); entity.set_non_unique_name(non_unique_title); entity.mutable_specifics()->CopyFrom(specifics); - return SyncData(syncer::kInvalidId, &entity); + return SyncData(kInvalidId, &entity); } // Static. SyncData SyncData::CreateRemoteData( int64 id, const sync_pb::EntitySpecifics& specifics) { - DCHECK_NE(id, syncer::kInvalidId); + DCHECK_NE(id, kInvalidId); sync_pb::SyncEntity entity; entity.mutable_specifics()->CopyFrom(specifics); return SyncData(id, &entity); @@ -91,8 +91,8 @@ const sync_pb::EntitySpecifics& SyncData::GetSpecifics() const { return immutable_entity_.Get().specifics(); } -syncer::ModelType SyncData::GetDataType() const { - return syncer::GetModelTypeFromSpecifics(GetSpecifics()); +ModelType SyncData::GetDataType() const { + return GetModelTypeFromSpecifics(GetSpecifics()); } const std::string& SyncData::GetTag() const { @@ -112,17 +112,16 @@ int64 SyncData::GetRemoteId() const { } bool SyncData::IsLocal() const { - return id_ == syncer::kInvalidId; + return id_ == kInvalidId; } std::string SyncData::ToString() const { if (!IsValid()) return "<Invalid SyncData>"; - std::string type = syncer::ModelTypeToString(GetDataType()); + std::string type = ModelTypeToString(GetDataType()); std::string specifics; - scoped_ptr<DictionaryValue> value( - syncer::EntitySpecificsToValue(GetSpecifics())); + scoped_ptr<DictionaryValue> value(EntitySpecificsToValue(GetSpecifics())); base::JSONWriter::WriteWithOptions(value.get(), base::JSONWriter::OPTIONS_PRETTY_PRINT, &specifics); diff --git a/sync/api/sync_data.h b/sync/api/sync_data.h index 3bad3ae..b88e0e7 100644 --- a/sync/api/sync_data.h +++ b/sync/api/sync_data.h @@ -20,8 +20,6 @@ class SyncEntity; namespace syncer { -typedef syncer::ModelType SyncDataType; - // A light-weight container for immutable sync data. Pass-by-value and storage // in STL containers are supported and encouraged if helpful. class SyncData { @@ -43,7 +41,7 @@ class SyncData { // overwritten if the datatype is encrypted. static SyncData CreateLocalDelete( const std::string& sync_tag, - syncer::ModelType datatype); + ModelType datatype); static SyncData CreateLocalData( const std::string& sync_tag, const std::string& non_unique_title, @@ -59,7 +57,7 @@ class SyncData { // Return the datatype we're holding information about. Derived from the sync // datatype specifics. - SyncDataType GetDataType() const; + ModelType GetDataType() const; // Return the current sync datatype specifics. const sync_pb::EntitySpecifics& GetSpecifics() const; @@ -99,8 +97,7 @@ class SyncData { static void Swap(sync_pb::SyncEntity* t1, sync_pb::SyncEntity* t2); }; - typedef syncer::Immutable< - sync_pb::SyncEntity, ImmutableSyncEntityTraits> + typedef Immutable<sync_pb::SyncEntity, ImmutableSyncEntityTraits> ImmutableSyncEntity; // Clears |entity|. @@ -109,7 +106,7 @@ class SyncData { // Whether this SyncData holds valid data. bool is_valid_; - // Equal to syncer::kInvalidId iff this is local. + // Equal to kInvalidId iff this is local. int64 id_; // The actual shared sync entity being held. diff --git a/sync/api/sync_error.cc b/sync/api/sync_error.cc index 307f339..1209040 100644 --- a/sync/api/sync_error.cc +++ b/sync/api/sync_error.cc @@ -18,7 +18,7 @@ SyncError::SyncError() { SyncError::SyncError(const tracked_objects::Location& location, const std::string& message, - syncer::ModelType type) { + ModelType type) { Init(location, message, type); PrintLogError(); } @@ -51,19 +51,19 @@ void SyncError::Copy(const SyncError& other) { void SyncError::Clear() { location_.reset(); message_ = std::string(); - type_ = syncer::UNSPECIFIED; + type_ = UNSPECIFIED; } void SyncError::Reset(const tracked_objects::Location& location, const std::string& message, - syncer::ModelType type) { + ModelType type) { Init(location, message, type); PrintLogError(); } void SyncError::Init(const tracked_objects::Location& location, const std::string& message, - syncer::ModelType type) { + ModelType type) { location_.reset(new tracked_objects::Location(location)); message_ = message; type_ = type; @@ -84,7 +84,7 @@ const std::string& SyncError::message() const { return message_; } -syncer::ModelType SyncError::type() const { +ModelType SyncError::type() const { CHECK(IsSet()); return type_; } @@ -93,7 +93,7 @@ std::string SyncError::ToString() const { if (!IsSet()) { return std::string(); } - return location_->ToString() + ", " + syncer::ModelTypeToString(type_) + + return location_->ToString() + ", " + ModelTypeToString(type_) + ", Sync Error: " + message_; } @@ -102,7 +102,7 @@ void SyncError::PrintLogError() const { location_->line_number(), logging::LOG_ERROR).stream(), LOG_IS_ON(ERROR)) - << syncer::ModelTypeToString(type_) << ", Sync Error: " << message_; + << ModelTypeToString(type_) << ", Sync Error: " << message_; } void PrintTo(const SyncError& sync_error, std::ostream* os) { diff --git a/sync/api/sync_error.h b/sync/api/sync_error.h index 532b90c..c674993 100644 --- a/sync/api/sync_error.h +++ b/sync/api/sync_error.h @@ -32,7 +32,7 @@ class SyncError { // Will print the new error to LOG(ERROR). SyncError(const tracked_objects::Location& location, const std::string& message, - syncer::ModelType type); + ModelType type); // Copy and assign via deep copy. SyncError(const SyncError& other); @@ -45,7 +45,7 @@ class SyncError { // Will print the new error to LOG(ERROR). void Reset(const tracked_objects::Location& location, const std::string& message, - syncer::ModelType type); + ModelType type); // Whether this is a valid error or not. bool IsSet() const; @@ -53,7 +53,7 @@ class SyncError { // These must only be called if IsSet() is true. const tracked_objects::Location& location() const; const std::string& message() const; - syncer::ModelType type() const; + ModelType type() const; // Returns empty string is IsSet() is false. std::string ToString() const; @@ -69,7 +69,7 @@ class SyncError { // is called, IsSet() will return true. void Init(const tracked_objects::Location& location, const std::string& message, - syncer::ModelType type); + ModelType type); // Reset the error to it's default (unset) values. void Clear(); @@ -77,7 +77,7 @@ class SyncError { // scoped_ptr is necessary because Location objects aren't assignable. scoped_ptr<tracked_objects::Location> location_; std::string message_; - syncer::ModelType type_; + ModelType type_; }; // gmock printer helper. diff --git a/sync/api/sync_error_unittest.cc b/sync/api/sync_error_unittest.cc index d14409f..71a24f1 100644 --- a/sync/api/sync_error_unittest.cc +++ b/sync/api/sync_error_unittest.cc @@ -11,11 +11,10 @@ namespace syncer { -using std::string; -using syncer::ModelType; - namespace { +using std::string; + typedef testing::Test SyncErrorTest; TEST_F(SyncErrorTest, Unset) { @@ -26,7 +25,7 @@ TEST_F(SyncErrorTest, Unset) { TEST_F(SyncErrorTest, Default) { tracked_objects::Location location = FROM_HERE; std::string msg = "test"; - ModelType type = syncer::PREFERENCES; + ModelType type = PREFERENCES; SyncError error(location, msg, type); ASSERT_TRUE(error.IsSet()); EXPECT_EQ(location.line_number(), error.location().line_number()); @@ -37,7 +36,7 @@ TEST_F(SyncErrorTest, Default) { TEST_F(SyncErrorTest, Reset) { tracked_objects::Location location = FROM_HERE; std::string msg = "test"; - ModelType type = syncer::PREFERENCES; + ModelType type = PREFERENCES; SyncError error; EXPECT_FALSE(error.IsSet()); @@ -50,7 +49,7 @@ TEST_F(SyncErrorTest, Reset) { tracked_objects::Location location2 = FROM_HERE; std::string msg2 = "test"; - ModelType type2 = syncer::PREFERENCES; + ModelType type2 = PREFERENCES; error.Reset(location2, msg2, type2); ASSERT_TRUE(error.IsSet()); EXPECT_EQ(location2.line_number(), error.location().line_number()); @@ -61,7 +60,7 @@ TEST_F(SyncErrorTest, Reset) { TEST_F(SyncErrorTest, Copy) { tracked_objects::Location location = FROM_HERE; std::string msg = "test"; - ModelType type = syncer::PREFERENCES; + ModelType type = PREFERENCES; SyncError error1; EXPECT_FALSE(error1.IsSet()); @@ -89,7 +88,7 @@ TEST_F(SyncErrorTest, Copy) { TEST_F(SyncErrorTest, Assign) { tracked_objects::Location location = FROM_HERE; std::string msg = "test"; - ModelType type = syncer::PREFERENCES; + ModelType type = PREFERENCES; SyncError error1; EXPECT_FALSE(error1.IsSet()); @@ -116,7 +115,7 @@ TEST_F(SyncErrorTest, Assign) { TEST_F(SyncErrorTest, ToString) { tracked_objects::Location location = FROM_HERE; std::string msg = "test"; - ModelType type = syncer::PREFERENCES; + ModelType type = PREFERENCES; std::string expected = "Preferences, Sync Error: test"; SyncError error(location, msg, type); EXPECT_TRUE(error.IsSet()); diff --git a/sync/api/syncable_service.h b/sync/api/syncable_service.h index 6118a91..5f84d85 100644 --- a/sync/api/syncable_service.h +++ b/sync/api/syncable_service.h @@ -37,18 +37,18 @@ class SyncableService : public SyncChangeProcessor, // encountered, and a filled SyncError (IsSet() == true) // otherwise. virtual SyncError MergeDataAndStartSyncing( - syncer::ModelType type, + ModelType type, const SyncDataList& initial_sync_data, scoped_ptr<SyncChangeProcessor> sync_processor, scoped_ptr<SyncErrorFactory> error_handler) = 0; // Stop syncing the specified type and reset state. - virtual void StopSyncing(syncer::ModelType type) = 0; + virtual void StopSyncing(ModelType type) = 0; // Fills a list of SyncData from the local data. This should create an up // to date representation of the SyncableService's view of that datatype, and // should match/be a subset of the server's view of that datatype. - virtual SyncDataList GetAllSyncData(syncer::ModelType type) const = 0; + virtual SyncDataList GetAllSyncData(ModelType type) const = 0; // SyncChangeProcessor interface. // Process a list of new SyncChanges and update the local data as necessary. |