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

Unified Diff: components/gcm_driver/gcm_client_impl.cc

Issue 2675293003: Push API: Don't wait for network when unsubscribing (Closed)
Patch Set: Created 3 years, 10 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: components/gcm_driver/gcm_client_impl.cc
diff --git a/components/gcm_driver/gcm_client_impl.cc b/components/gcm_driver/gcm_client_impl.cc
index a18b5850b5d8bb4e78dca77ee4628e696dc3f20d..aafa4ae6ce5625a0fe6731e9a604ac13f754bc6c 100644
--- a/components/gcm_driver/gcm_client_impl.cc
+++ b/components/gcm_driver/gcm_client_impl.cc
@@ -961,14 +961,19 @@ void GCMClientImpl::OnRegisterCompleted(
Result result;
PendingRegistrationRequests::const_iterator iter =
pending_registration_requests_.find(registration_info);
- if (iter == pending_registration_requests_.end())
+ if (iter == pending_registration_requests_.end()) {
result = UNKNOWN_ERROR;
- else if (status == RegistrationRequest::INVALID_SENDER)
+ } else if (status == RegistrationRequest::INVALID_SENDER) {
result = INVALID_PARAMETER;
- else if (registration_id.empty())
+ } else if (registration_id.empty()) {
+ // All other errors are currently treated as SERVER_ERROR (including cases
+ // where all retries fail because the device is offline, which might be
+ // expected to result in a NETWORK_ERROR). If this is later changed, update
+ // FakeGCMProfileService's offline simulation to match.
Peter Beverloo 2017/02/07 18:11:08 Here and later, can we shorten and generalize w/ t
johnme 2017/02/08 14:14:36 Done (no longer needs to reference FakeGCMProfileS
result = SERVER_ERROR;
- else
+ } else {
result = SUCCESS;
+ }
if (result == SUCCESS) {
// Cache it.
@@ -1114,7 +1119,10 @@ void GCMClientImpl::OnUnregisterCompleted(
result = INVALID_PARAMETER;
break;
default:
- // All other errors are treated as SERVER_ERROR.
+ // All other errors are currently treated as SERVER_ERROR (including cases
+ // where all retries fail because the device is offline, which might be
+ // expected to result in a NETWORK_ERROR). If this is later changed,
+ // update FakeGCMProfileService's offline simulation to match.
result = SERVER_ERROR;
break;
}

Powered by Google App Engine
This is Rietveld 408576698