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

Unified Diff: sync/engine/download.cc

Issue 61213009: Don't drop debug_info when posting to sync server fails (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed erroneous use of SYNC_EXPORT_PRIVATE from MockDebugInfoGetter. Created 7 years, 1 month 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
« no previous file with comments | « sync/engine/download.h ('k') | sync/engine/download_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/engine/download.cc
diff --git a/sync/engine/download.cc b/sync/engine/download.cc
index 53d36f5a4f4226c7e9c2f1712dd6a19ec0666672..7d00bebee7e38d7be7a713dfae3e5f026268a0e2 100644
--- a/sync/engine/download.cc
+++ b/sync/engine/download.cc
@@ -94,11 +94,6 @@ void InitDownloadUpdatesContext(
// (e.g. Bookmark URLs but not their containing folders).
get_updates->set_fetch_folders(true);
- sync_pb::DebugInfo* debug_info = message->mutable_debug_info();
- AppendClientDebugInfoIfNeeded(session->context()->debug_info_getter(),
- session->mutable_status_controller(),
- debug_info);
-
get_updates->set_create_mobile_bookmarks_folder(
create_mobile_bookmarks_folder);
bool need_encryption_key = ShouldRequestEncryptionKey(session->context());
@@ -344,6 +339,11 @@ SyncerError ExecuteDownloadUpdates(
StatusController* status = session->mutable_status_controller();
bool need_encryption_key = ShouldRequestEncryptionKey(session->context());
+ if (session->context()->debug_info_getter()) {
+ sync_pb::DebugInfo* debug_info = msg->mutable_debug_info();
+ CopyClientDebugInfo(session->context()->debug_info_getter(), debug_info);
+ }
+
SyncerError result = SyncerProtoUtil::PostClientToServerMessage(
msg,
&update_response,
@@ -366,6 +366,12 @@ SyncerError ExecuteDownloadUpdates(
<< update_response.get_updates().changes_remaining()
<< " updates left on server.";
+ if (session->context()->debug_info_getter()) {
+ // Clear debug info now that we have successfully sent it to the server.
+ DVLOG(1) << "Clearing client debug info.";
+ session->context()->debug_info_getter()->ClearDebugInfo();
+ }
+
if (need_encryption_key ||
update_response.get_updates().encryption_keys_size() > 0) {
syncable::Directory* dir = session->context()->directory();
@@ -392,20 +398,11 @@ SyncerError ExecuteDownloadUpdates(
}
}
-void AppendClientDebugInfoIfNeeded(
+void CopyClientDebugInfo(
sessions::DebugInfoGetter* debug_info_getter,
- StatusController* status,
sync_pb::DebugInfo* debug_info) {
- // We want to send the debug info only once per sync cycle. Check if it has
- // already been sent.
- if (!status->debug_info_sent()) {
- DVLOG(1) << "Sending client debug info ...";
- // Could be null in some unit tests.
- if (debug_info_getter) {
- debug_info_getter->GetAndClearDebugInfo(debug_info);
- }
- status->set_debug_info_sent();
- }
+ DVLOG(1) << "Copying client debug info to send.";
+ debug_info_getter->GetDebugInfo(debug_info);
}
} // namespace download
« no previous file with comments | « sync/engine/download.h ('k') | sync/engine/download_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698