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

Unified Diff: sync/internal_api/debug_info_event_listener.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
Index: sync/internal_api/debug_info_event_listener.cc
diff --git a/sync/internal_api/debug_info_event_listener.cc b/sync/internal_api/debug_info_event_listener.cc
index 7875ed92b48db3f3e5e561c1f7add3e19abf9ea0..f46c4ee2ef9ff54ff2443342a2ace1d13aa090bb 100644
--- a/sync/internal_api/debug_info_event_listener.cc
+++ b/sync/internal_api/debug_info_event_listener.cc
@@ -144,22 +144,28 @@ void DebugInfoEventListener::OnIncomingNotification(
AddEventToQueue(event_info);
}
-void DebugInfoEventListener::GetAndClearDebugInfo(
- sync_pb::DebugInfo* debug_info) {
+void DebugInfoEventListener::GetDebugInfo(sync_pb::DebugInfo* debug_info) {
DCHECK(thread_checker_.CalledOnValidThread());
DCHECK_LE(events_.size(), kMaxEntries);
- while (!events_.empty()) {
+
+ for (DebugEventInfoQueue::const_iterator iter = events_.begin();
+ iter != events_.end();
+ ++iter) {
sync_pb::DebugEventInfo* event_info = debug_info->add_events();
- const sync_pb::DebugEventInfo& debug_event_info = events_.front();
- event_info->CopyFrom(debug_event_info);
- events_.pop();
+ event_info->CopyFrom(*iter);
}
debug_info->set_events_dropped(events_dropped_);
debug_info->set_cryptographer_ready(cryptographer_ready_);
debug_info->set_cryptographer_has_pending_keys(
cryptographer_has_pending_keys_);
+}
+
+void DebugInfoEventListener::ClearDebugInfo() {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK_LE(events_.size(), kMaxEntries);
+ events_.clear();
events_dropped_ = false;
}
@@ -255,10 +261,10 @@ void DebugInfoEventListener::AddEventToQueue(
DVLOG(1) << "DebugInfoEventListener::AddEventToQueue Dropping an old event "
<< "because of full queue";
- events_.pop();
+ events_.pop_front();
events_dropped_ = true;
}
- events_.push(event_info);
+ events_.push_back(event_info);
}
} // namespace syncer
« no previous file with comments | « sync/internal_api/debug_info_event_listener.h ('k') | sync/internal_api/debug_info_event_listener_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698