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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 int64 serial_number, | 67 int64 serial_number, |
68 const UpdateCallback& callback) OVERRIDE; | 68 const UpdateCallback& callback) OVERRIDE; |
69 virtual void RemoveUserSerialNumber(const std::string& username, | 69 virtual void RemoveUserSerialNumber(const std::string& username, |
70 const UpdateCallback& callback) OVERRIDE; | 70 const UpdateCallback& callback) OVERRIDE; |
71 | 71 |
72 private: | 72 private: |
73 typedef std::map<std::string, int> AppIdToMessageCountMap; | 73 typedef std::map<std::string, int> AppIdToMessageCountMap; |
74 | 74 |
75 // Continuation to update the per-app message counts after a load. | 75 // Continuation to update the per-app message counts after a load. |
76 void LoadContinuation(const LoadCallback& callback, | 76 void LoadContinuation(const LoadCallback& callback, |
77 const LoadResult& result); | 77 scoped_ptr<LoadResult> result); |
78 | 78 |
79 // Continuation to update the per-app message counts when adding messages. | 79 // Continuation to update the per-app message counts when adding messages. |
80 // In particular, if a message fails to add, the message count is decremented. | 80 // In particular, if a message fails to add, the message count is decremented. |
81 void AddOutgoingMessageContinuation(const UpdateCallback& callback, | 81 void AddOutgoingMessageContinuation(const UpdateCallback& callback, |
82 const std::string& app_id, | 82 const std::string& app_id, |
83 bool success); | 83 bool success); |
84 | 84 |
85 // Continuation to update the per-app message counts when removing messages. | 85 // Continuation to update the per-app message counts when removing messages. |
86 // Note: if doing a read-then-write when removing messages proves expensive, | 86 // Note: if doing a read-then-write when removing messages proves expensive, |
87 // an in-memory mapping of persisted message id to app could be maintained | 87 // an in-memory mapping of persisted message id to app could be maintained |
(...skipping 12 matching lines...) Expand all Loading... |
100 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; | 100 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; |
101 | 101 |
102 base::WeakPtrFactory<GCMStoreImpl> weak_ptr_factory_; | 102 base::WeakPtrFactory<GCMStoreImpl> weak_ptr_factory_; |
103 | 103 |
104 DISALLOW_COPY_AND_ASSIGN(GCMStoreImpl); | 104 DISALLOW_COPY_AND_ASSIGN(GCMStoreImpl); |
105 }; | 105 }; |
106 | 106 |
107 } // namespace gcm | 107 } // namespace gcm |
108 | 108 |
109 #endif // GOOGLE_APIS_GCM_ENGINE_GCM_STORE_IMPL_H_ | 109 #endif // GOOGLE_APIS_GCM_ENGINE_GCM_STORE_IMPL_H_ |
OLD | NEW |