| 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 #ifndef GOOGLE_APIS_GCM_ENGINE_GCM_STORE_IMPL_H_ | 5 #ifndef GOOGLE_APIS_GCM_ENGINE_GCM_STORE_IMPL_H_ |
| 6 #define GOOGLE_APIS_GCM_ENGINE_GCM_STORE_IMPL_H_ | 6 #define GOOGLE_APIS_GCM_ENGINE_GCM_STORE_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 // Sets the account information related to device to account mapping. | 88 // Sets the account information related to device to account mapping. |
| 89 void AddAccountMapping(const AccountMapping& account_mapping, | 89 void AddAccountMapping(const AccountMapping& account_mapping, |
| 90 const UpdateCallback& callback) override; | 90 const UpdateCallback& callback) override; |
| 91 void RemoveAccountMapping(const std::string& account_id, | 91 void RemoveAccountMapping(const std::string& account_id, |
| 92 const UpdateCallback& callback) override; | 92 const UpdateCallback& callback) override; |
| 93 | 93 |
| 94 // Sets last token fetch time. | 94 // Sets last token fetch time. |
| 95 void SetLastTokenFetchTime(const base::Time& time, | 95 void SetLastTokenFetchTime(const base::Time& time, |
| 96 const UpdateCallback& callback) override; | 96 const UpdateCallback& callback) override; |
| 97 | 97 |
| 98 // Injects a value to database. Only to be used for testing. |
| 99 void SetValueForTesting(const std::string& key, |
| 100 const std::string& value, |
| 101 const UpdateCallback& callback); |
| 102 |
| 98 private: | 103 private: |
| 99 typedef std::map<std::string, int> AppIdToMessageCountMap; | 104 typedef std::map<std::string, int> AppIdToMessageCountMap; |
| 100 | 105 |
| 101 // Continuation to update the per-app message counts after a load. | 106 // Continuation to update the per-app message counts after a load. |
| 102 void LoadContinuation(const LoadCallback& callback, | 107 void LoadContinuation(const LoadCallback& callback, |
| 103 scoped_ptr<LoadResult> result); | 108 scoped_ptr<LoadResult> result); |
| 104 | 109 |
| 105 // Continuation to update the per-app message counts when adding messages. | 110 // Continuation to update the per-app message counts when adding messages. |
| 106 // In particular, if a message fails to add, the message count is decremented. | 111 // In particular, if a message fails to add, the message count is decremented. |
| 107 void AddOutgoingMessageContinuation(const UpdateCallback& callback, | 112 void AddOutgoingMessageContinuation(const UpdateCallback& callback, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 126 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; | 131 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; |
| 127 | 132 |
| 128 base::WeakPtrFactory<GCMStoreImpl> weak_ptr_factory_; | 133 base::WeakPtrFactory<GCMStoreImpl> weak_ptr_factory_; |
| 129 | 134 |
| 130 DISALLOW_COPY_AND_ASSIGN(GCMStoreImpl); | 135 DISALLOW_COPY_AND_ASSIGN(GCMStoreImpl); |
| 131 }; | 136 }; |
| 132 | 137 |
| 133 } // namespace gcm | 138 } // namespace gcm |
| 134 | 139 |
| 135 #endif // GOOGLE_APIS_GCM_ENGINE_GCM_STORE_IMPL_H_ | 140 #endif // GOOGLE_APIS_GCM_ENGINE_GCM_STORE_IMPL_H_ |
| OLD | NEW |