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

Unified Diff: components/sync/engine_impl/get_updates_processor.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/engine_impl/get_updates_processor.cc
diff --git a/sync/engine/get_updates_processor.cc b/components/sync/engine_impl/get_updates_processor.cc
similarity index 86%
rename from sync/engine/get_updates_processor.cc
rename to components/sync/engine_impl/get_updates_processor.cc
index 82c590f988cd0ef1bbc032e820f14c50132ab338..cc77cd760d4a6c29c107d0babeb7aafde0c642b4 100644
--- a/sync/engine/get_updates_processor.cc
+++ b/components/sync/engine_impl/get_updates_processor.cc
@@ -2,23 +2,23 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "sync/engine/get_updates_processor.h"
+#include "components/sync/engine_impl/get_updates_processor.h"
#include <stddef.h>
#include <map>
#include "base/trace_event/trace_event.h"
-#include "sync/engine/get_updates_delegate.h"
-#include "sync/engine/syncer_proto_util.h"
-#include "sync/engine/update_handler.h"
-#include "sync/internal_api/public/events/get_updates_response_event.h"
-#include "sync/protocol/sync.pb.h"
-#include "sync/sessions/status_controller.h"
-#include "sync/sessions/sync_session.h"
-#include "sync/syncable/directory.h"
-#include "sync/syncable/nigori_handler.h"
-#include "sync/syncable/syncable_read_transaction.h"
+#include "components/sync/engine/events/get_updates_response_event.h"
+#include "components/sync/engine_impl/get_updates_delegate.h"
+#include "components/sync/engine_impl/syncer_proto_util.h"
+#include "components/sync/engine_impl/update_handler.h"
+#include "components/sync/protocol/sync.pb.h"
+#include "components/sync/sessions_impl/status_controller.h"
+#include "components/sync/sessions_impl/sync_session.h"
+#include "components/sync/syncable/directory.h"
+#include "components/sync/syncable/nigori_handler.h"
+#include "components/sync/syncable/syncable_read_transaction.h"
typedef std::vector<const sync_pb::SyncEntity*> SyncEntityList;
typedef std::map<syncer::ModelType, SyncEntityList> TypeSyncEntityMap;
@@ -36,7 +36,6 @@ bool ShouldRequestEncryptionKey(sessions::SyncSessionContext* context) {
return nigori_handler->NeedKeystoreKey(&trans);
}
-
SyncerError HandleGetEncryptionKeyResponse(
const sync_pb::ClientToServerResponse& update_response,
syncable::Directory* dir) {
@@ -48,13 +47,12 @@ SyncerError HandleGetEncryptionKeyResponse(
syncable::ReadTransaction trans(FROM_HERE, dir);
syncable::NigoriHandler* nigori_handler = dir->GetNigoriHandler();
success = nigori_handler->SetKeystoreKeys(
- update_response.get_updates().encryption_keys(),
- &trans);
+ update_response.get_updates().encryption_keys(), &trans);
DVLOG(1) << "GetUpdates returned "
<< update_response.get_updates().encryption_keys_size()
- << "encryption keys. Nigori keystore key "
- << (success ? "" : "not ") << "updated.";
+ << "encryption keys. Nigori keystore key " << (success ? "" : "not ")
+ << "updated.";
return (success ? SYNCER_OK : SERVER_RESPONSE_VALIDATION_FAILED);
}
@@ -66,8 +64,8 @@ void PartitionUpdatesByType(const sync_pb::GetUpdatesResponse& gu_response,
ModelTypeSet requested_types,
TypeSyncEntityMap* updates_by_type) {
int update_count = gu_response.entries().size();
- for (ModelTypeSet::Iterator it = requested_types.First();
- it.Good(); it.Inc()) {
+ for (ModelTypeSet::Iterator it = requested_types.First(); it.Good();
+ it.Inc()) {
updates_by_type->insert(std::make_pair(it.Get(), SyncEntityList()));
}
for (int i = 0; i < update_count; ++i) {
@@ -138,10 +136,9 @@ void PartitionContextMutationsByType(
// like the ShouldRequestEncryptionKey() status. This is kept separate from the
// other of the message-building functions to make the rest of the code easier
// to test.
-void InitDownloadUpdatesContext(
- sessions::SyncSession* session,
- bool create_mobile_bookmarks_folder,
- sync_pb::ClientToServerMessage* message) {
+void InitDownloadUpdatesContext(sessions::SyncSession* session,
+ bool create_mobile_bookmarks_folder,
+ sync_pb::ClientToServerMessage* message) {
message->set_share(session->context()->account_name());
message->set_message_contents(sync_pb::ClientToServerMessage::GET_UPDATES);
@@ -177,9 +174,7 @@ SyncerError GetUpdatesProcessor::DownloadUpdates(
TRACE_EVENT0("sync", "DownloadUpdates");
sync_pb::ClientToServerMessage message;
- InitDownloadUpdatesContext(session,
- create_mobile_bookmarks_folder,
- &message);
+ InitDownloadUpdatesContext(session, create_mobile_bookmarks_folder, &message);
PrepareGetUpdates(*request_types, &message);
SyncerError result = ExecuteDownloadUpdates(request_types, session, &message);
@@ -238,8 +233,8 @@ SyncerError GetUpdatesProcessor::ExecuteDownloadUpdates(
if (result == SERVER_RETURN_PARTIAL_FAILURE) {
request_types->RemoveAll(partial_failure_data_types);
} else if (result != SYNCER_OK) {
- GetUpdatesResponseEvent response_event(
- base::Time::Now(), update_response, result);
+ GetUpdatesResponseEvent response_event(base::Time::Now(), update_response,
+ result);
session->SendProtocolEvent(response_event);
// Sync authorization expires every 60 mintues, so SYNC_AUTH_ERROR will
@@ -254,9 +249,7 @@ SyncerError GetUpdatesProcessor::ExecuteDownloadUpdates(
}
DVLOG(1) << "GetUpdates returned "
- << update_response.get_updates().entries_size()
- << " updates.";
-
+ << update_response.get_updates().entries_size() << " updates.";
if (session->context()->debug_info_getter()) {
// Clear debug info now that we have successfully sent it to the server.
@@ -274,8 +267,8 @@ SyncerError GetUpdatesProcessor::ExecuteDownloadUpdates(
SyncerError process_result =
ProcessResponse(update_response.get_updates(), *request_types, status);
- GetUpdatesResponseEvent response_event(
- base::Time::Now(), update_response, process_result);
+ GetUpdatesResponseEvent response_event(base::Time::Now(), update_response,
+ process_result);
session->SendProtocolEvent(response_event);
DVLOG(1) << "GetUpdates result: " << process_result;
@@ -316,8 +309,7 @@ syncer::SyncerError GetUpdatesProcessor::ProcessGetUpdatesResponse(
DCHECK_EQ(gu_types.Size(), updates_by_type.size());
TypeToIndexMap progress_index_by_type;
- PartitionProgressMarkersByType(gu_response,
- gu_types,
+ PartitionProgressMarkersByType(gu_response, gu_types,
&progress_index_by_type);
if (gu_types.Size() != progress_index_by_type.size()) {
NOTREACHED() << "Missing progress markers in GetUpdates response.";
@@ -331,8 +323,8 @@ syncer::SyncerError GetUpdatesProcessor::ProcessGetUpdatesResponse(
TypeToIndexMap::iterator progress_marker_iter =
progress_index_by_type.begin();
TypeSyncEntityMap::iterator updates_iter = updates_by_type.begin();
- for (; (progress_marker_iter != progress_index_by_type.end()
- && updates_iter != updates_by_type.end());
+ for (; (progress_marker_iter != progress_index_by_type.end() &&
+ updates_iter != updates_by_type.end());
++progress_marker_iter, ++updates_iter) {
DCHECK_EQ(progress_marker_iter->first, updates_iter->first);
ModelType type = progress_marker_iter->first;
@@ -349,15 +341,12 @@ syncer::SyncerError GetUpdatesProcessor::ProcessGetUpdatesResponse(
syncer::SyncerError result =
update_handler_iter->second->ProcessGetUpdatesResponse(
gu_response.new_progress_marker(progress_marker_iter->second),
- context,
- updates_iter->second,
- status_controller);
+ context, updates_iter->second, status_controller);
if (result != syncer::SYNCER_OK)
return result;
} else {
- DLOG(WARNING)
- << "Ignoring received updates of a type we can't handle. "
- << "Type is: " << ModelTypeToString(type);
+ DLOG(WARNING) << "Ignoring received updates of a type we can't handle. "
+ << "Type is: " << ModelTypeToString(type);
continue;
}
}
« no previous file with comments | « components/sync/engine_impl/get_updates_processor.h ('k') | components/sync/engine_impl/get_updates_processor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698