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

Side by Side Diff: google_apis/gcm/engine/connection_event_tracker.cc

Issue 2567373002: Removed DCHECK in ConnectionLoginFailed which was being hit on iOS (Closed)
Patch Set: Created 4 years 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "google_apis/gcm/engine/connection_event_tracker.h" 5 #include "google_apis/gcm/engine/connection_event_tracker.h"
6 6
7 #include "base/time/time.h" 7 #include "base/time/time.h"
8 #include "net/base/network_change_notifier.h" 8 #include "net/base/network_change_notifier.h"
9 9
10 namespace { 10 namespace {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 // A completed connection means that the old client event data has now been 56 // A completed connection means that the old client event data has now been
57 // sent to GCM. Delete old data. 57 // sent to GCM. Delete old data.
58 completed_events_.clear(); 58 completed_events_.clear();
59 number_discarded_events_ = 0; 59 number_discarded_events_ = 0;
60 } 60 }
61 61
62 void ConnectionEventTracker::ConnectionLoginFailed() { 62 void ConnectionEventTracker::ConnectionLoginFailed() {
63 // A login failure would have originally been marked as a successful 63 // A login failure would have originally been marked as a successful
64 // connection, so now that it failed, that needs to be updated. 64 // connection, so now that it failed, that needs to be updated.
65 DCHECK_EQ(current_event_.type(), 65 // TODO(harkness): Add back DCHECK which was removed. See
66 mcs_proto::ClientEvent::SUCCESSFUL_CONNECTION); 66 // https://crbug.com/673706.
67 67
68 current_event_.set_type(mcs_proto::ClientEvent::FAILED_CONNECTION); 68 current_event_.set_type(mcs_proto::ClientEvent::FAILED_CONNECTION);
69 current_event_.clear_time_connection_established_ms(); 69 current_event_.clear_time_connection_established_ms();
70 current_event_.set_error_code(net::ERR_CONNECTION_RESET); 70 current_event_.set_error_code(net::ERR_CONNECTION_RESET);
71 } 71 }
72 72
73 void ConnectionEventTracker::ConnectionAttemptFailed(int error) { 73 void ConnectionEventTracker::ConnectionAttemptFailed(int error) {
74 DCHECK_NE(error, net::OK); 74 DCHECK_NE(error, net::OK);
75 75
76 current_event_.set_type(mcs_proto::ClientEvent::FAILED_CONNECTION); 76 current_event_.set_type(mcs_proto::ClientEvent::FAILED_CONNECTION);
77 current_event_.set_error_code(error); 77 current_event_.set_error_code(error);
78 } 78 }
79 79
80 void ConnectionEventTracker::WriteToLoginRequest( 80 void ConnectionEventTracker::WriteToLoginRequest(
81 mcs_proto::LoginRequest* request) { 81 mcs_proto::LoginRequest* request) {
82 DCHECK(request); 82 DCHECK(request);
83 83
84 // Add an event to represented the discarded events if needed. 84 // Add an event to represented the discarded events if needed.
85 if (number_discarded_events_ > 0) { 85 if (number_discarded_events_ > 0) {
86 mcs_proto::ClientEvent* event = request->add_client_event(); 86 mcs_proto::ClientEvent* event = request->add_client_event();
87 event->set_type(mcs_proto::ClientEvent::DISCARDED_EVENTS); 87 event->set_type(mcs_proto::ClientEvent::DISCARDED_EVENTS);
88 event->set_number_discarded_events(number_discarded_events_); 88 event->set_number_discarded_events(number_discarded_events_);
89 } 89 }
90 90
91 for (const mcs_proto::ClientEvent& event : completed_events_) 91 for (const mcs_proto::ClientEvent& event : completed_events_)
92 request->add_client_event()->CopyFrom(event); 92 request->add_client_event()->CopyFrom(event);
93 } 93 }
94 94
95 } // namespace gcm 95 } // namespace gcm
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698