diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-22 01:22:29 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-22 01:22:29 +0000 |
commit | 0a126223a953345b09464fcc95631a96fad35315 (patch) | |
tree | 1947a11e1e08dbb6d19eaf51ff5d58cac6d165ec /chrome/browser/sync | |
parent | 93811c13d691dcc8d21451b6816a030750d81fc8 (diff) | |
download | chromium_src-0a126223a953345b09464fcc95631a96fad35315.zip chromium_src-0a126223a953345b09464fcc95631a96fad35315.tar.gz chromium_src-0a126223a953345b09464fcc95631a96fad35315.tar.bz2 |
Convert LOG(INFO) to VLOG(1) - misc. chrome/browser/sync/*.
Also remove some "using"s, remove some extra {}s, and fix function argument wrapping to comply with the style guide.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/3975003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@63470 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sync')
7 files changed, 70 insertions, 69 deletions
diff --git a/chrome/browser/sync/notifier/chrome_system_resources_unittest.cc b/chrome/browser/sync/notifier/chrome_system_resources_unittest.cc index fa5f456..306a8b6 100644 --- a/chrome/browser/sync/notifier/chrome_system_resources_unittest.cc +++ b/chrome/browser/sync/notifier/chrome_system_resources_unittest.cc @@ -77,7 +77,7 @@ class ChromeSystemResourcesTest : public testing::Test { TEST_F(ChromeSystemResourcesTest, CurrentTime) { invalidation::Time current_time = chrome_system_resources_.current_time(); - LOG(INFO) << "current_time returned: " << current_time.ToInternalValue(); + VLOG(1) << "current_time returned: " << current_time.ToInternalValue(); } // Make sure Log() doesn't crash or leak. diff --git a/chrome/browser/sync/notifier/server_notifier_thread.cc b/chrome/browser/sync/notifier/server_notifier_thread.cc index 4c73445..53aadb0 100644 --- a/chrome/browser/sync/notifier/server_notifier_thread.cc +++ b/chrome/browser/sync/notifier/server_notifier_thread.cc @@ -61,8 +61,8 @@ void ServerNotifierThread::Logout() { void ServerNotifierThread::SendNotification( const OutgoingNotificationData& data) { DCHECK_EQ(MessageLoop::current(), parent_message_loop_); - NOTREACHED() << "Shouldn't send notifications if " - << "ServerNotifierThread is used"; + NOTREACHED() << "Shouldn't send notifications if ServerNotifierThread is " + "used"; } void ServerNotifierThread::OnInvalidate(syncable::ModelType model_type) { @@ -70,11 +70,8 @@ void ServerNotifierThread::OnInvalidate(syncable::ModelType model_type) { // TODO(akalin): This is a hack to make new sync data types work // with server-issued notifications. Remove this when it's not // needed anymore. - if (model_type == syncable::UNSPECIFIED) { - LOG(INFO) << "OnInvalidate: UNKNOWN"; - } else { - LOG(INFO) << "OnInvalidate: " << syncable::ModelTypeToString(model_type); - } + VLOG(1) << "OnInvalidate: " << ((model_type == syncable::UNSPECIFIED) ? + "UNKNOWN" : syncable::ModelTypeToString(model_type)); // TODO(akalin): Signal notification only for the invalidated types. // TODO(akalin): Fill this in with something meaningful. IncomingNotificationData notification_data; @@ -83,7 +80,7 @@ void ServerNotifierThread::OnInvalidate(syncable::ModelType model_type) { void ServerNotifierThread::OnInvalidateAll() { DCHECK_EQ(MessageLoop::current(), worker_message_loop()); - LOG(INFO) << "OnInvalidateAll"; + VLOG(1) << "OnInvalidateAll"; // TODO(akalin): Fill this in with something meaningful. IncomingNotificationData notification_data; observers_->Notify(&Observer::OnIncomingNotification, notification_data); diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc index 533ff06..cc0508b 100644 --- a/chrome/browser/sync/profile_sync_service.cc +++ b/chrome/browser/sync/profile_sync_service.cc @@ -242,11 +242,10 @@ ProfileSyncService::ClearServerDataState void ProfileSyncService::GetDataTypeControllerStates( browser_sync::DataTypeController::StateMap* state_map) const { - browser_sync::DataTypeController::TypeMap::const_iterator iter - = data_type_controllers_.begin(); - for ( ; iter != data_type_controllers_.end(); ++iter ) { + for (browser_sync::DataTypeController::TypeMap::const_iterator iter = + data_type_controllers_.begin(); iter != data_type_controllers_.end(); + ++iter) (*state_map)[iter->first] = iter->second.get()->state(); - } } void ProfileSyncService::InitSettings() { @@ -276,15 +275,14 @@ void ProfileSyncService::InitSettings() { notifier_options_.xmpp_host_port.set_host(value); notifier_options_.xmpp_host_port.set_port(notifier::kDefaultXmppPort); } - LOG(INFO) << "Using " << notifier_options_.xmpp_host_port.ToString() - << " for test sync notification server."; + VLOG(1) << "Using " << notifier_options_.xmpp_host_port.ToString() + << " for test sync notification server."; } notifier_options_.try_ssltcp_first = command_line.HasSwitch(switches::kSyncUseSslTcp); - if (notifier_options_.try_ssltcp_first) { - LOG(INFO) << "Trying SSL/TCP port before XMPP port for notifications."; - } + if (notifier_options_.try_ssltcp_first) + VLOG(1) << "Trying SSL/TCP port before XMPP port for notifications."; if (command_line.HasSwitch(switches::kSyncNotificationMethod)) { const std::string notification_method_str( diff --git a/chrome/browser/sync/profile_sync_service_autofill_unittest.cc b/chrome/browser/sync/profile_sync_service_autofill_unittest.cc index 536c5a8..6a7c862 100644 --- a/chrome/browser/sync/profile_sync_service_autofill_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_autofill_unittest.cc @@ -427,7 +427,7 @@ class FakeServerUpdater: public base::RefCountedThreadSafe<FakeServerUpdater> { server_parent_id); ASSERT_TRUE(item.PutPredecessor(new_predecessor)); } - LOG(INFO) << "FakeServerUpdater finishing."; + VLOG(1) << "FakeServerUpdater finishing."; is_finished_.Signal(); } @@ -1196,7 +1196,7 @@ TEST_F(ProfileSyncServiceAutofillTest, DISABLED_ServerChangeRace) { AutofillEntry syncapi_entry(MakeAutofillEntry("syncapi", "entry", 2)); ASSERT_TRUE(AddAutofillSyncNode(syncapi_entry)); - LOG(INFO) << "Syncapi update finished."; + VLOG(1) << "Syncapi update finished."; // If we reach here, it means syncapi succeeded and we didn't deadlock. Yay! // Signal FakeServerUpdater that it can complete. @@ -1212,7 +1212,7 @@ TEST_F(ProfileSyncServiceAutofillTest, DISABLED_ServerChangeRace) { EXPECT_EQ(3U, sync_entries.size()); EXPECT_EQ(0U, sync_profiles.size()); for (size_t i = 0; i < sync_entries.size(); i++) { - LOG(INFO) << "Entry " << i << ": " << sync_entries[i].key().name() << ", " - << sync_entries[i].key().value(); + VLOG(1) << "Entry " << i << ": " << sync_entries[i].key().name() + << ", " << sync_entries[i].key().value(); } } diff --git a/chrome/browser/sync/syncable/syncable.cc b/chrome/browser/sync/syncable/syncable.cc index 26d6f7b..99cc2ba 100644 --- a/chrome/browser/sync/syncable/syncable.cc +++ b/chrome/browser/sync/syncable/syncable.cc @@ -957,8 +957,9 @@ void Directory::CheckTreeInvariants(syncable::BaseTransaction* trans, ++entries_done; int64 elapsed_ms = check_timer.Elapsed().InMilliseconds(); if (elapsed_ms > max_ms) { - LOG(INFO) << "Cutting Invariant check short after " << elapsed_ms << "ms." - " Processed " << entries_done << "/" << handles.size() << " entries"; + VLOG(1) << "Cutting Invariant check short after " << elapsed_ms + << "ms. Processed " << entries_done << "/" << handles.size() + << " entries"; return; } } diff --git a/chrome/browser/sync/syncable/syncable_unittest.cc b/chrome/browser/sync/syncable/syncable_unittest.cc index e586da3..32a4cc3 100644 --- a/chrome/browser/sync/syncable/syncable_unittest.cc +++ b/chrome/browser/sync/syncable/syncable_unittest.cc @@ -38,9 +38,6 @@ #include "third_party/sqlite/sqlite3.h" using browser_sync::TestIdFactory; -using std::cout; -using std::endl; -using std::string; namespace syncable { @@ -90,7 +87,7 @@ TEST_F(SyncableGeneralTest, General) { int64 written_metahandle; const Id id = TestIdFactory::FromNumber(99); - string name = "Jeff"; + std::string name = "Jeff"; // Test simple read operations on an empty DB. { ReadTransaction rtrans(&dir, __FILE__, __LINE__); @@ -168,8 +165,8 @@ TEST_F(SyncableGeneralTest, ClientIndexRebuildsProperly) { int64 written_metahandle; TestIdFactory factory; const Id id = factory.NewServerId(); - string name = "cheesepuffs"; - string tag = "dietcoke"; + std::string name = "cheesepuffs"; + std::string tag = "dietcoke"; // Test creating a new meta entry. { @@ -205,7 +202,7 @@ TEST_F(SyncableGeneralTest, ClientIndexRebuildsProperly) { TEST_F(SyncableGeneralTest, ClientIndexRebuildsDeletedProperly) { TestIdFactory factory; const Id id = factory.NewServerId(); - string tag = "dietcoke"; + std::string tag = "dietcoke"; // Test creating a deleted, unsynced, server meta entry. { @@ -245,7 +242,7 @@ class TestUnsaveableDirectory : public Directory { public: class UnsaveableBackingStore : public DirectoryBackingStore { public: - UnsaveableBackingStore(const string& dir_name, + UnsaveableBackingStore(const std::string& dir_name, const FilePath& backing_filepath) : DirectoryBackingStore(dir_name, backing_filepath) { } virtual bool SaveChanges(const Directory::SaveChangesSnapshot& snapshot) { @@ -253,7 +250,8 @@ class TestUnsaveableDirectory : public Directory { } }; virtual DirectoryBackingStore* CreateBackingStore( - const string& dir_name, const FilePath& backing_filepath) { + const std::string& dir_name, + const FilePath& backing_filepath) { return new UnsaveableBackingStore(dir_name, backing_filepath); } }; @@ -335,15 +333,15 @@ class SyncableDirectoryTest : public testing::Test { FilePath file_path_; // Creates an empty entry and sets the ID field to the default kId. - void CreateEntry(const string& entryname) { + void CreateEntry(const std::string& entryname) { CreateEntry(entryname, kId); } // Creates an empty entry and sets the ID field to id. - void CreateEntry(const string& entryname, const int id) { + void CreateEntry(const std::string& entryname, const int id) { CreateEntry(entryname, TestIdFactory::FromNumber(id)); } - void CreateEntry(const string& entryname, Id id) { + void CreateEntry(const std::string& entryname, Id id) { WriteTransaction wtrans(dir_.get(), UNITTEST, __FILE__, __LINE__); MutableEntry me(&wtrans, CREATE, wtrans.root_id(), entryname); ASSERT_TRUE(me.good()); @@ -351,11 +349,13 @@ class SyncableDirectoryTest : public testing::Test { me.Put(IS_UNSYNCED, true); } - void ValidateEntry(BaseTransaction* trans, int64 id, bool check_name, - string name, int64 base_version, int64 server_version, bool is_del); - void CreateAndCheck(WriteTransaction* trans, int64 parent_id, int64 id, - string name, string server_name, int64 version, - bool set_server_fields, bool is_dir, bool add_to_lru, int64 *meta_handle); + void ValidateEntry(BaseTransaction* trans, + int64 id, + bool check_name, + const std::string& name, + int64 base_version, + int64 server_version, + bool is_del); }; TEST_F(SyncableDirectoryTest, TakeSnapshotGetsMetahandlesToPurge) { @@ -647,7 +647,7 @@ TEST_F(SyncableDirectoryTest, TestBasicLookupValidID) { } TEST_F(SyncableDirectoryTest, TestDelete) { - string name = "peanut butter jelly time"; + std::string name = "peanut butter jelly time"; WriteTransaction trans(dir_.get(), UNITTEST, __FILE__, __LINE__); MutableEntry e1(&trans, CREATE, trans.root_id(), name); ASSERT_TRUE(e1.good()); @@ -910,7 +910,7 @@ TEST_F(SyncableDirectoryTest, TestEntryIsInFolder) { int64 entry_handle; syncable::Id folder_id; syncable::Id entry_id; - string entry_name = "entry"; + std::string entry_name = "entry"; { WriteTransaction trans(dir_.get(), UNITTEST, __FILE__, __LINE__); @@ -942,7 +942,7 @@ TEST_F(SyncableDirectoryTest, TestEntryIsInFolder) { } TEST_F(SyncableDirectoryTest, TestParentIdIndexUpdate) { - string child_name = "child"; + std::string child_name = "child"; WriteTransaction wt(dir_.get(), UNITTEST, __FILE__, __LINE__); MutableEntry parent_folder(&wt, CREATE, wt.root_id(), "folder1"); @@ -970,8 +970,8 @@ TEST_F(SyncableDirectoryTest, TestParentIdIndexUpdate) { } TEST_F(SyncableDirectoryTest, TestNoReindexDeletedItems) { - string folder_name = "folder"; - string new_name = "new_name"; + std::string folder_name = "folder"; + std::string new_name = "new_name"; WriteTransaction trans(dir_.get(), UNITTEST, __FILE__, __LINE__); MutableEntry folder(&trans, CREATE, trans.root_id(), folder_name); @@ -1049,7 +1049,7 @@ TEST_F(SyncableDirectoryTest, TestSimpleFieldsPreservedDuringSaveChanges) { Id create_id; EntryKernel create_pre_save, update_pre_save; EntryKernel create_post_save, update_post_save; - string create_name = "Create"; + std::string create_name = "Create"; { WriteTransaction trans(dir_.get(), UNITTEST, __FILE__, __LINE__); @@ -1328,14 +1328,17 @@ TEST_F(SyncableDirectoryTest, GetModelType) { } // namespace -void SyncableDirectoryTest::ValidateEntry(BaseTransaction* trans, int64 id, - bool check_name, string name, int64 base_version, int64 server_version, - bool is_del) { +void SyncableDirectoryTest::ValidateEntry(BaseTransaction* trans, + int64 id, + bool check_name, + const std::string& name, + int64 base_version, + int64 server_version, + bool is_del) { Entry e(trans, GET_BY_ID, TestIdFactory::FromNumber(id)); ASSERT_TRUE(e.good()); - if (check_name) { + if (check_name) ASSERT_TRUE(name == e.Get(NON_UNIQUE_NAME)); - } ASSERT_TRUE(base_version == e.Get(BASE_VERSION)); ASSERT_TRUE(server_version == e.Get(SERVER_VERSION)); ASSERT_TRUE(is_del == e.Get(IS_DEL)); @@ -1405,7 +1408,7 @@ class ThreadBugDelegate : public PlatformThread::Delegate { // PlatformThread::Delegate methods: virtual void ThreadMain() { - const string dirname = "ThreadBug1"; + const std::string dirname = "ThreadBug1"; AutoLock scoped_lock(step_->mutex); while (step_->number < 3) { @@ -1476,7 +1479,7 @@ class DirectoryKernelStalenessBugDelegate : public ThreadBugDelegate { virtual void ThreadMain() { const char test_bytes[] = "test data"; - const string dirname = "DirectoryKernelStalenessBug"; + const std::string dirname = "DirectoryKernelStalenessBug"; AutoLock scoped_lock(step_->mutex); const Id jeff_id = TestIdFactory::FromNumber(100); @@ -1561,14 +1564,16 @@ TEST(SyncableDirectoryManager, DirectoryKernelStalenessBug) { class StressTransactionsDelegate : public PlatformThread::Delegate { public: - StressTransactionsDelegate(DirectoryManager* dm, string dirname, + StressTransactionsDelegate(DirectoryManager* dm, + const std::string& dirname, int thread_number) - : directory_manager_(dm), dirname_(dirname), + : directory_manager_(dm), + dirname_(dirname), thread_number_(thread_number) {} private: DirectoryManager* const directory_manager_; - string dirname_; + std::string dirname_; const int thread_number_; // PlatformThread::Delegate methods: @@ -1576,7 +1581,7 @@ class StressTransactionsDelegate : public PlatformThread::Delegate { ScopedDirLookup dir(directory_manager_, dirname_); CHECK(dir.good()); int entry_count = 0; - string path_name; + std::string path_name; for (int i = 0; i < 20; ++i) { const int rand_action = rand() % 10; @@ -1585,8 +1590,8 @@ class StressTransactionsDelegate : public PlatformThread::Delegate { CHECK(1 == CountEntriesWithName(&trans, trans.root_id(), path_name)); PlatformThread::Sleep(rand() % 10); } else { - string unique_name = StringPrintf("%d.%d", thread_number_, - entry_count++); + std::string unique_name = StringPrintf("%d.%d", thread_number_, + entry_count++); path_name.assign(unique_name.begin(), unique_name.end()); WriteTransaction trans(dir, UNITTEST, __FILE__, __LINE__); MutableEntry e(&trans, CREATE, trans.root_id(), path_name); @@ -1606,7 +1611,7 @@ class StressTransactionsDelegate : public PlatformThread::Delegate { TEST(SyncableDirectory, StressTransactions) { DirectoryManager dirman(FilePath(FILE_PATH_LITERAL("."))); - string dirname = "stress"; + std::string dirname = "stress"; file_util::Delete(dirman.GetSyncDataDatabasePath(), true); dirman.Open(dirname); @@ -1648,8 +1653,8 @@ TEST(Syncable, ComparePathNames) { { 'b', 'A', 1 }, { 'b', 'a', 1 } }; for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { - string a(1, tests[i].a); - string b(1, tests[i].b); + std::string a(1, tests[i].a); + std::string b(1, tests[i].b); const int result = ComparePathNames(a, b); if (result != tests[i].expected_result) { ADD_FAILURE() << "ComparePathNames(" << tests[i].a << ", " << tests[i].b diff --git a/chrome/browser/sync/util/user_settings_posix.cc b/chrome/browser/sync/util/user_settings_posix.cc index 71fda9f..6f480fe 100644 --- a/chrome/browser/sync/util/user_settings_posix.cc +++ b/chrome/browser/sync/util/user_settings_posix.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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. // @@ -17,8 +17,8 @@ void UserSettings::SetAuthTokenForService( const std::string& service_name, const std::string& long_lived_service_token) { - LOG(INFO) << "Saving auth token " << long_lived_service_token << " for " - << email << "for service " << service_name; + VLOG(1) << "Saving auth token " << long_lived_service_token + << " for " << email << "for service " << service_name; std::string encrypted_service_token; if (!Encryptor::EncryptString(long_lived_service_token, @@ -60,13 +60,13 @@ bool UserSettings::GetLastUserAndServiceToken(const std::string& service_name, } *username = query.column_string(0); - LOG(INFO) << "Found service token for:" << *username - << " @ " << service_name << " returning: " << *service_token; + VLOG(1) << "Found service token for:" << *username << " @ " << service_name + << " returning: " << *service_token; return true; } - LOG(INFO) << "Couldn't find service token for " << service_name; + VLOG(1) << "Couldn't find service token for " << service_name; return false; } |