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 "google_apis/gcm/engine/gcm_store_impl.h" | 5 #include "google_apis/gcm/engine/gcm_store_impl.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
720 blocking_task_runner_->PostTask( | 720 blocking_task_runner_->PostTask( |
721 FROM_HERE, | 721 FROM_HERE, |
722 base::Bind(&GCMStoreImpl::Backend::Load, | 722 base::Bind(&GCMStoreImpl::Backend::Load, |
723 backend_, | 723 backend_, |
724 base::Bind(&GCMStoreImpl::LoadContinuation, | 724 base::Bind(&GCMStoreImpl::LoadContinuation, |
725 weak_ptr_factory_.GetWeakPtr(), | 725 weak_ptr_factory_.GetWeakPtr(), |
726 callback))); | 726 callback))); |
727 } | 727 } |
728 | 728 |
729 void GCMStoreImpl::Close() { | 729 void GCMStoreImpl::Close() { |
| 730 weak_ptr_factory_.InvalidateWeakPtrs(); |
| 731 app_message_counts_.clear(); |
730 blocking_task_runner_->PostTask( | 732 blocking_task_runner_->PostTask( |
731 FROM_HERE, | 733 FROM_HERE, |
732 base::Bind(&GCMStoreImpl::Backend::Close, backend_)); | 734 base::Bind(&GCMStoreImpl::Backend::Close, backend_)); |
733 } | 735 } |
734 | 736 |
735 void GCMStoreImpl::Destroy(const UpdateCallback& callback) { | 737 void GCMStoreImpl::Destroy(const UpdateCallback& callback) { |
736 blocking_task_runner_->PostTask( | 738 blocking_task_runner_->PostTask( |
737 FROM_HERE, | 739 FROM_HERE, |
738 base::Bind(&GCMStoreImpl::Backend::Destroy, backend_, callback)); | 740 base::Bind(&GCMStoreImpl::Backend::Destroy, backend_, callback)); |
739 } | 741 } |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
945 removed_message_counts.begin(); | 947 removed_message_counts.begin(); |
946 iter != removed_message_counts.end(); ++iter) { | 948 iter != removed_message_counts.end(); ++iter) { |
947 DCHECK_NE(app_message_counts_.count(iter->first), 0U); | 949 DCHECK_NE(app_message_counts_.count(iter->first), 0U); |
948 app_message_counts_[iter->first] -= iter->second; | 950 app_message_counts_[iter->first] -= iter->second; |
949 DCHECK_GE(app_message_counts_[iter->first], 0); | 951 DCHECK_GE(app_message_counts_[iter->first], 0); |
950 } | 952 } |
951 callback.Run(true); | 953 callback.Run(true); |
952 } | 954 } |
953 | 955 |
954 } // namespace gcm | 956 } // namespace gcm |
OLD | NEW |