OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_LEVELDB_LEVELDB_MOJO_PROXY_H_ | 5 #ifndef COMPONENTS_LEVELDB_LEVELDB_MOJO_PROXY_H_ |
6 #define COMPONENTS_LEVELDB_LEVELDB_MOJO_PROXY_H_ | 6 #define COMPONENTS_LEVELDB_LEVELDB_MOJO_PROXY_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
| 9 #include <memory> |
9 #include <string> | 10 #include <string> |
10 #include <utility> | 11 #include <utility> |
11 #include <vector> | 12 #include <vector> |
12 | 13 |
13 #include "base/callback_forward.h" | 14 #include "base/callback_forward.h" |
14 #include "base/files/file.h" | 15 #include "base/files/file.h" |
15 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
16 #include "base/memory/scoped_ptr.h" | |
17 #include "base/synchronization/waitable_event.h" | 17 #include "base/synchronization/waitable_event.h" |
18 #include "base/threading/thread.h" | 18 #include "base/threading/thread.h" |
19 #include "components/filesystem/public/interfaces/directory.mojom.h" | 19 #include "components/filesystem/public/interfaces/directory.mojom.h" |
20 | 20 |
21 namespace leveldb { | 21 namespace leveldb { |
22 | 22 |
23 // A proxy for thread safe access to Mojo objects from multiple threads. | 23 // A proxy for thread safe access to Mojo objects from multiple threads. |
24 // | 24 // |
25 // MojoEnv is an object passed to the LevelDB implementation which can be | 25 // MojoEnv is an object passed to the LevelDB implementation which can be |
26 // called from multiple threads. Mojo pipes are bound to a single | 26 // called from multiple threads. Mojo pipes are bound to a single |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 uint64_t* file_size, | 137 uint64_t* file_size, |
138 filesystem::FileError* out_error); | 138 filesystem::FileError* out_error); |
139 void RenameFileImpl(OpaqueDir* dir, | 139 void RenameFileImpl(OpaqueDir* dir, |
140 const std::string& old_path, | 140 const std::string& old_path, |
141 const std::string& new_path, | 141 const std::string& new_path, |
142 filesystem::FileError* out_error); | 142 filesystem::FileError* out_error); |
143 void LockFileImpl(OpaqueDir* dir, | 143 void LockFileImpl(OpaqueDir* dir, |
144 const std::string& path, | 144 const std::string& path, |
145 filesystem::FileError* out_error, | 145 filesystem::FileError* out_error, |
146 OpaqueLock** out_lock); | 146 OpaqueLock** out_lock); |
147 void UnlockFileImpl(scoped_ptr<OpaqueLock> lock, | 147 void UnlockFileImpl(std::unique_ptr<OpaqueLock> lock, |
148 filesystem::FileError* out_error); | 148 filesystem::FileError* out_error); |
149 | 149 |
150 // The task runner which represents the thread that all mojo objects are | 150 // The task runner which represents the thread that all mojo objects are |
151 // bound to. | 151 // bound to. |
152 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 152 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
153 | 153 |
154 int outstanding_opaque_dirs_; | 154 int outstanding_opaque_dirs_; |
155 | 155 |
156 DISALLOW_COPY_AND_ASSIGN(LevelDBMojoProxy); | 156 DISALLOW_COPY_AND_ASSIGN(LevelDBMojoProxy); |
157 }; | 157 }; |
158 | 158 |
159 } // namespace leveldb | 159 } // namespace leveldb |
160 | 160 |
161 #endif // COMPONENTS_LEVELDB_LEVELDB_MOJO_PROXY_H_ | 161 #endif // COMPONENTS_LEVELDB_LEVELDB_MOJO_PROXY_H_ |
OLD | NEW |