OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/gcm_driver/gcm_client_impl.h" | 5 #include "components/gcm_driver/gcm_client_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
805 LOG(ERROR) << "Failed to destroy GCM store"; | 805 LOG(ERROR) << "Failed to destroy GCM store"; |
806 RecordResetStoreErrorToUMA(DESTROYING_STORE_FAILED); | 806 RecordResetStoreErrorToUMA(DESTROYING_STORE_FAILED); |
807 state_ = UNINITIALIZED; | 807 state_ = UNINITIALIZED; |
808 return; | 808 return; |
809 } | 809 } |
810 | 810 |
811 state_ = INITIALIZED; | 811 state_ = INITIALIZED; |
812 } | 812 } |
813 | 813 |
814 void GCMClientImpl::ResetStoreCallback(bool success) { | 814 void GCMClientImpl::ResetStoreCallback(bool success) { |
| 815 // Even an incomplete reset may invalidate registrations, and this might be |
| 816 // the only opportunity to notify the delegate. For example a partial reset |
| 817 // that deletes the "CURRENT" file will cause GCMStoreImpl to consider the DB |
| 818 // to no longer exist, in which case the next load will simply create a new |
| 819 // store rather than resetting it. |
| 820 delegate_->OnStoreReset(); |
| 821 |
815 if (!success) { | 822 if (!success) { |
816 LOG(ERROR) << "Failed to reset GCM store"; | 823 LOG(ERROR) << "Failed to reset GCM store"; |
817 RecordResetStoreErrorToUMA(DESTROYING_STORE_FAILED); | 824 RecordResetStoreErrorToUMA(DESTROYING_STORE_FAILED); |
818 state_ = UNINITIALIZED; | 825 state_ = UNINITIALIZED; |
819 return; | 826 return; |
820 } | 827 } |
821 | 828 |
822 state_ = INITIALIZED; | 829 state_ = INITIALIZED; |
823 Start(start_mode_); | 830 Start(start_mode_); |
824 } | 831 } |
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1433 bool GCMClientImpl::HasStandaloneRegisteredApp() const { | 1440 bool GCMClientImpl::HasStandaloneRegisteredApp() const { |
1434 if (registrations_.empty()) | 1441 if (registrations_.empty()) |
1435 return false; | 1442 return false; |
1436 // Note that account mapper is not counted as a standalone app since it is | 1443 // Note that account mapper is not counted as a standalone app since it is |
1437 // automatically started when other app uses GCM. | 1444 // automatically started when other app uses GCM. |
1438 return registrations_.size() > 1 || | 1445 return registrations_.size() > 1 || |
1439 !ExistsGCMRegistrationInMap(registrations_, kGCMAccountMapperAppId); | 1446 !ExistsGCMRegistrationInMap(registrations_, kGCMAccountMapperAppId); |
1440 } | 1447 } |
1441 | 1448 |
1442 } // namespace gcm | 1449 } // namespace gcm |
OLD | NEW |