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

Side by Side Diff: google_apis/gcm/engine/gcm_store_impl.h

Issue 1873663002: Convert //google_apis from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 unified diff | Download patch
OLDNEW
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 <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 11 matching lines...) Expand all
22 22
23 class Encryptor; 23 class Encryptor;
24 24
25 // An implementation of GCM Store that uses LevelDB for persistence. 25 // An implementation of GCM Store that uses LevelDB for persistence.
26 // It performs all blocking operations on the blocking task runner, and posts 26 // It performs all blocking operations on the blocking task runner, and posts
27 // all callbacks to the thread on which the GCMStoreImpl is created. 27 // all callbacks to the thread on which the GCMStoreImpl is created.
28 class GCM_EXPORT GCMStoreImpl : public GCMStore { 28 class GCM_EXPORT GCMStoreImpl : public GCMStore {
29 public: 29 public:
30 GCMStoreImpl(const base::FilePath& path, 30 GCMStoreImpl(const base::FilePath& path,
31 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner, 31 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner,
32 scoped_ptr<Encryptor> encryptor); 32 std::unique_ptr<Encryptor> encryptor);
33 ~GCMStoreImpl() override; 33 ~GCMStoreImpl() override;
34 34
35 // Load the directory and pass the initial state back to caller. 35 // Load the directory and pass the initial state back to caller.
36 void Load(StoreOpenMode open_mode, const LoadCallback& callback) override; 36 void Load(StoreOpenMode open_mode, const LoadCallback& callback) override;
37 37
38 // Closes the GCM store. 38 // Closes the GCM store.
39 void Close() override; 39 void Close() override;
40 40
41 // Clears the GCM store of all data and destroys any LevelDB files associated 41 // Clears the GCM store of all data and destroys any LevelDB files associated
42 // with this store. 42 // with this store.
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 // Injects a value to database. Only to be used for testing. 114 // Injects a value to database. Only to be used for testing.
115 void SetValueForTesting(const std::string& key, 115 void SetValueForTesting(const std::string& key,
116 const std::string& value, 116 const std::string& value,
117 const UpdateCallback& callback); 117 const UpdateCallback& callback);
118 118
119 private: 119 private:
120 typedef std::map<std::string, int> AppIdToMessageCountMap; 120 typedef std::map<std::string, int> AppIdToMessageCountMap;
121 121
122 // Continuation to update the per-app message counts after a load. 122 // Continuation to update the per-app message counts after a load.
123 void LoadContinuation(const LoadCallback& callback, 123 void LoadContinuation(const LoadCallback& callback,
124 scoped_ptr<LoadResult> result); 124 std::unique_ptr<LoadResult> result);
125 125
126 // Continuation to update the per-app message counts when adding messages. 126 // Continuation to update the per-app message counts when adding messages.
127 // In particular, if a message fails to add, the message count is decremented. 127 // In particular, if a message fails to add, the message count is decremented.
128 void AddOutgoingMessageContinuation(const UpdateCallback& callback, 128 void AddOutgoingMessageContinuation(const UpdateCallback& callback,
129 const std::string& app_id, 129 const std::string& app_id,
130 bool success); 130 bool success);
131 131
132 // Continuation to update the per-app message counts when removing messages. 132 // Continuation to update the per-app message counts when removing messages.
133 // Note: if doing a read-then-write when removing messages proves expensive, 133 // Note: if doing a read-then-write when removing messages proves expensive,
134 // an in-memory mapping of persisted message id to app could be maintained 134 // an in-memory mapping of persisted message id to app could be maintained
(...skipping 12 matching lines...) Expand all
147 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; 147 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;
148 148
149 base::WeakPtrFactory<GCMStoreImpl> weak_ptr_factory_; 149 base::WeakPtrFactory<GCMStoreImpl> weak_ptr_factory_;
150 150
151 DISALLOW_COPY_AND_ASSIGN(GCMStoreImpl); 151 DISALLOW_COPY_AND_ASSIGN(GCMStoreImpl);
152 }; 152 };
153 153
154 } // namespace gcm 154 } // namespace gcm
155 155
156 #endif // GOOGLE_APIS_GCM_ENGINE_GCM_STORE_IMPL_H_ 156 #endif // GOOGLE_APIS_GCM_ENGINE_GCM_STORE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698