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

Side by Side Diff: components/sync/model_impl/model_type_store_backend.h

Issue 2689773002: [Sync] Replace typedef with using. (Closed)
Patch Set: [Sync] Replace typedef with using. Created 3 years, 10 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 COMPONENTS_SYNC_MODEL_IMPL_MODEL_TYPE_STORE_BACKEND_H_ 5 #ifndef COMPONENTS_SYNC_MODEL_IMPL_MODEL_TYPE_STORE_BACKEND_H_
6 #define COMPONENTS_SYNC_MODEL_IMPL_MODEL_TYPE_STORE_BACKEND_H_ 6 #define COMPONENTS_SYNC_MODEL_IMPL_MODEL_TYPE_STORE_BACKEND_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <unordered_map> 10 #include <unordered_map>
(...skipping 10 matching lines...) Expand all
21 } // namespace leveldb 21 } // namespace leveldb
22 22
23 namespace syncer { 23 namespace syncer {
24 24
25 // ModelTypeStoreBackend handles operations with leveldb. It is oblivious of the 25 // ModelTypeStoreBackend handles operations with leveldb. It is oblivious of the
26 // fact that it is called from separate thread (with the exception of ctor), 26 // fact that it is called from separate thread (with the exception of ctor),
27 // meaning it shouldn't deal with callbacks and task_runners. 27 // meaning it shouldn't deal with callbacks and task_runners.
28 class ModelTypeStoreBackend 28 class ModelTypeStoreBackend
29 : public base::RefCountedThreadSafe<ModelTypeStoreBackend> { 29 : public base::RefCountedThreadSafe<ModelTypeStoreBackend> {
30 public: 30 public:
31 typedef std::unordered_map<std::string, ModelTypeStoreBackend*> BackendMap; 31 using BackendMap = std::unordered_map<std::string, ModelTypeStoreBackend*>;
32 32
33 // Helper function to create in memory environment for leveldb. 33 // Helper function to create in memory environment for leveldb.
34 static std::unique_ptr<leveldb::Env> CreateInMemoryEnv(); 34 static std::unique_ptr<leveldb::Env> CreateInMemoryEnv();
35 35
36 // GetOrCreateBackend will check if |backend_map_| has a backend with same 36 // GetOrCreateBackend will check if |backend_map_| has a backend with same
37 // |path|. If |backend_map_| has one, wrap that backend to scoped_refptr and 37 // |path|. If |backend_map_| has one, wrap that backend to scoped_refptr and
38 // return. If |backend_map_| does not have, create a backend and store it into 38 // return. If |backend_map_| does not have, create a backend and store it into
39 // |backend_map_|. 39 // |backend_map_|.
40 static scoped_refptr<ModelTypeStoreBackend> GetOrCreateBackend( 40 static scoped_refptr<ModelTypeStoreBackend> GetOrCreateBackend(
41 const std::string& path, 41 const std::string& path,
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 116
117 // Macro wrapped mutex to guard against concurrent calls in debug builds. 117 // Macro wrapped mutex to guard against concurrent calls in debug builds.
118 DFAKE_MUTEX(push_pop_); 118 DFAKE_MUTEX(push_pop_);
119 119
120 DISALLOW_COPY_AND_ASSIGN(ModelTypeStoreBackend); 120 DISALLOW_COPY_AND_ASSIGN(ModelTypeStoreBackend);
121 }; 121 };
122 122
123 } // namespace syncer 123 } // namespace syncer
124 124
125 #endif // COMPONENTS_SYNC_MODEL_IMPL_MODEL_TYPE_STORE_BACKEND_H_ 125 #endif // COMPONENTS_SYNC_MODEL_IMPL_MODEL_TYPE_STORE_BACKEND_H_
OLDNEW
« no previous file with comments | « components/sync/model_impl/attachments/task_queue.h ('k') | components/sync/syncable/change_record.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698