| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/sync/engine_impl/get_updates_processor.h" | 5 #include "components/sync/engine_impl/get_updates_processor.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 for (int i = 0; i < update_count; ++i) { | 69 for (int i = 0; i < update_count; ++i) { |
| 70 const sync_pb::SyncEntity& update = gu_response.entries(i); | 70 const sync_pb::SyncEntity& update = gu_response.entries(i); |
| 71 ModelType type = GetModelType(update); | 71 ModelType type = GetModelType(update); |
| 72 if (!IsRealDataType(type)) { | 72 if (!IsRealDataType(type)) { |
| 73 NOTREACHED() << "Received update with invalid type."; | 73 NOTREACHED() << "Received update with invalid type."; |
| 74 continue; | 74 continue; |
| 75 } | 75 } |
| 76 | 76 |
| 77 TypeSyncEntityMap::iterator it = updates_by_type->find(type); | 77 TypeSyncEntityMap::iterator it = updates_by_type->find(type); |
| 78 if (it == updates_by_type->end()) { | 78 if (it == updates_by_type->end()) { |
| 79 DLOG(WARNING) | 79 DLOG(WARNING) << "Received update for unexpected type, or the type is " |
| 80 << "Received update for unexpected type or the type is throttled:" | 80 "throttled or failed with partial failure:" |
| 81 << ModelTypeToString(type); | 81 << ModelTypeToString(type); |
| 82 continue; | 82 continue; |
| 83 } | 83 } |
| 84 | 84 |
| 85 it->second.push_back(&update); | 85 it->second.push_back(&update); |
| 86 } | 86 } |
| 87 } | 87 } |
| 88 | 88 |
| 89 // Builds a map of ModelTypes to indices to progress markers in the given | 89 // Builds a map of ModelTypes to indices to progress markers in the given |
| 90 // |gu_response| message. The map is returned in the |index_map| parameter. | 90 // |gu_response| message. The map is returned in the |index_map| parameter. |
| 91 void PartitionProgressMarkersByType( | 91 void PartitionProgressMarkersByType( |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 *(delegate_.GetNetworkRequestEvent(base::Time::Now(), *msg))); | 220 *(delegate_.GetNetworkRequestEvent(base::Time::Now(), *msg))); |
| 221 | 221 |
| 222 ModelTypeSet partial_failure_data_types; | 222 ModelTypeSet partial_failure_data_types; |
| 223 | 223 |
| 224 SyncerError result = SyncerProtoUtil::PostClientToServerMessage( | 224 SyncerError result = SyncerProtoUtil::PostClientToServerMessage( |
| 225 msg, &update_response, cycle, &partial_failure_data_types); | 225 msg, &update_response, cycle, &partial_failure_data_types); |
| 226 | 226 |
| 227 DVLOG(2) << SyncerProtoUtil::ClientToServerResponseDebugString( | 227 DVLOG(2) << SyncerProtoUtil::ClientToServerResponseDebugString( |
| 228 update_response); | 228 update_response); |
| 229 | 229 |
| 230 if (result == SERVER_RETURN_PARTIAL_FAILURE) { | 230 if (!partial_failure_data_types.Empty()) { |
| 231 request_types->RemoveAll(partial_failure_data_types); | 231 request_types->RemoveAll(partial_failure_data_types); |
| 232 } else if (result != SYNCER_OK) { | 232 } |
| 233 |
| 234 if (result != SYNCER_OK) { |
| 233 GetUpdatesResponseEvent response_event(base::Time::Now(), update_response, | 235 GetUpdatesResponseEvent response_event(base::Time::Now(), update_response, |
| 234 result); | 236 result); |
| 235 cycle->SendProtocolEvent(response_event); | 237 cycle->SendProtocolEvent(response_event); |
| 236 | 238 |
| 237 // Sync authorization expires every 60 mintues, so SYNC_AUTH_ERROR will | 239 // Sync authorization expires every 60 mintues, so SYNC_AUTH_ERROR will |
| 238 // appear every 60 minutes, and then sync services will refresh the | 240 // appear every 60 minutes, and then sync services will refresh the |
| 239 // authorization. Therefore SYNC_AUTH_ERROR is excluded here to reduce the | 241 // authorization. Therefore SYNC_AUTH_ERROR is excluded here to reduce the |
| 240 // ERROR messages in the log. | 242 // ERROR messages in the log. |
| 241 if (result != SYNC_AUTH_ERROR) { | 243 if (result != SYNC_AUTH_ERROR) { |
| 242 LOG(ERROR) << "PostClientToServerMessage() failed during GetUpdates"; | 244 LOG(ERROR) << "PostClientToServerMessage() failed during GetUpdates"; |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 } | 362 } |
| 361 | 363 |
| 362 void GetUpdatesProcessor::CopyClientDebugInfo( | 364 void GetUpdatesProcessor::CopyClientDebugInfo( |
| 363 DebugInfoGetter* debug_info_getter, | 365 DebugInfoGetter* debug_info_getter, |
| 364 sync_pb::DebugInfo* debug_info) { | 366 sync_pb::DebugInfo* debug_info) { |
| 365 DVLOG(1) << "Copying client debug info to send."; | 367 DVLOG(1) << "Copying client debug info to send."; |
| 366 debug_info_getter->GetDebugInfo(debug_info); | 368 debug_info_getter->GetDebugInfo(debug_info); |
| 367 } | 369 } |
| 368 | 370 |
| 369 } // namespace syncer | 371 } // namespace syncer |
| OLD | NEW |