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

Unified Diff: chrome/browser/sync/engine/download_updates_command.cc

Issue 8189003: Send important client side event information to the server. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: committing. Created 9 years, 2 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: chrome/browser/sync/engine/download_updates_command.cc
diff --git a/chrome/browser/sync/engine/download_updates_command.cc b/chrome/browser/sync/engine/download_updates_command.cc
index 7677989210cb691c5fe38a06dea474419a67a0e1..5ca2290e1c6b7c15b7b4ef84a1cc1f0a39559d6e 100644
--- a/chrome/browser/sync/engine/download_updates_command.cc
+++ b/chrome/browser/sync/engine/download_updates_command.cc
@@ -16,6 +16,8 @@
using syncable::ScopedDirLookup;
+using sync_pb::DebugInfo;
+
namespace browser_sync {
using sessions::StatusController;
using sessions::SyncSession;
@@ -83,6 +85,10 @@ void DownloadUpdatesCommand::ExecuteImpl(SyncSession* session) {
SyncerProtoUtil::AddRequestBirthday(dir, &client_to_server_message);
+ DebugInfo* debug_info = client_to_server_message.mutable_debug_info();
+
+ AppendClientDebugInfoIfNeeded(session, debug_info);
+
bool ok = SyncerProtoUtil::PostClientToServerMessage(
client_to_server_message,
&update_response,
@@ -126,4 +132,21 @@ void DownloadUpdatesCommand::SetRequestedTypes(
DCHECK_LT(0, requested_type_count) << "Doing GetUpdates with empty filter.";
}
+void DownloadUpdatesCommand::AppendClientDebugInfoIfNeeded(
+ sessions::SyncSession* session,
+ DebugInfo* debug_info) {
+ // We want to send the debug info only once per sync cycle. Check if it has
+ // already been sent.
+ if (!session->status_controller()->debug_info_sent()) {
+ VLOG(1) << "Sending client debug info ...";
+ // could be null in some unit tests.
+ if (session->context()->debug_info_getter()) {
+ session->context()->debug_info_getter()->GetAndClearDebugInfo(
+ debug_info);
+ }
+ session->status_controller()->set_debug_info_sent();
+ }
+}
+
+
} // namespace browser_sync
« no previous file with comments | « chrome/browser/sync/engine/download_updates_command.h ('k') | chrome/browser/sync/engine/download_updates_command_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698