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

Unified Diff: google_apis/gcm/engine/connection_event_tracker.cc

Issue 2628733004: Update ConnectionEventTracker to check if there is an in progress attempt. (Closed)
Patch Set: Rebase and fix nits Created 3 years, 11 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: google_apis/gcm/engine/connection_event_tracker.cc
diff --git a/google_apis/gcm/engine/connection_event_tracker.cc b/google_apis/gcm/engine/connection_event_tracker.cc
index 50a5ecdcc4c762400cd2316876da190991c49de4..f2be7c88b1e85d55c9acad98033db9b4a0c8f880 100644
--- a/google_apis/gcm/engine/connection_event_tracker.cc
+++ b/google_apis/gcm/engine/connection_event_tracker.cc
@@ -25,6 +25,10 @@ ConnectionEventTracker::~ConnectionEventTracker() {
completed_events_.size(), kMaxClientEvents + 1);
}
+bool ConnectionEventTracker::IsEventInProgress() const {
+ return current_event_.has_time_connection_started_ms();
+}
+
void ConnectionEventTracker::StartConnectionAttempt() {
// TODO(harkness): Can we dcheck here that there is not an in progress
// connection?
@@ -36,14 +40,15 @@ void ConnectionEventTracker::StartConnectionAttempt() {
}
void ConnectionEventTracker::EndConnectionAttempt() {
- // TODO(harkness): Modify tests so that we can put a DCHECK here.
+ DCHECK(IsEventInProgress());
+
if (completed_events_.size() == kMaxClientEvents) {
// Don't let the completed events grow beyond the max.
completed_events_.pop_front();
number_discarded_events_++;
}
- // Current event is now completed, so add it to our list of completed events.
+ // Current event is finished, so add it to our list of completed events.
current_event_.set_time_connection_ended_ms(base::Time::Now().ToJavaTime());
completed_events_.push_back(current_event_);
current_event_.Clear();
« no previous file with comments | « google_apis/gcm/engine/connection_event_tracker.h ('k') | google_apis/gcm/engine/connection_factory_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698