| 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 <memory> | 
| 10 #include <string> | 10 #include <string> | 
| 11 #include <utility> | 11 #include <utility> | 
| 12 #include <vector> | 12 #include <vector> | 
| 13 | 13 | 
| 14 #include "base/callback_forward.h" | 14 #include "base/callback_forward.h" | 
| 15 #include "base/files/file.h" | 15 #include "base/files/file.h" | 
| 16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" | 
| 17 #include "base/synchronization/waitable_event.h" | 17 #include "base/synchronization/waitable_event.h" | 
| 18 #include "base/threading/thread.h" |  | 
| 19 #include "components/filesystem/public/interfaces/directory.mojom.h" | 18 #include "components/filesystem/public/interfaces/directory.mojom.h" | 
| 20 | 19 | 
|  | 20 namespace base { | 
|  | 21 class SingleThreadTaskRunner; | 
|  | 22 } | 
|  | 23 | 
| 21 namespace leveldb { | 24 namespace leveldb { | 
| 22 | 25 | 
| 23 // A proxy for thread safe access to Mojo objects from multiple threads. | 26 // A proxy for thread safe access to Mojo objects from multiple threads. | 
| 24 // | 27 // | 
| 25 // MojoEnv is an object passed to the LevelDB implementation which can be | 28 // MojoEnv is an object passed to the LevelDB implementation which can be | 
| 26 // called from multiple threads. Mojo pipes are bound to a single | 29 // called from multiple threads. Mojo pipes are bound to a single | 
| 27 // thread. Because of this mismatch, we create a proxy object which will | 30 // thread. Because of this mismatch, we create a proxy object which will | 
| 28 // redirect calls to the thread which owns the Mojo pipe, sends and receives | 31 // redirect calls to the thread which owns the Mojo pipe, sends and receives | 
| 29 // messages. | 32 // messages. | 
| 30 // | 33 // | 
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 154   scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 157   scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 
| 155 | 158 | 
| 156   int outstanding_opaque_dirs_; | 159   int outstanding_opaque_dirs_; | 
| 157 | 160 | 
| 158   DISALLOW_COPY_AND_ASSIGN(LevelDBMojoProxy); | 161   DISALLOW_COPY_AND_ASSIGN(LevelDBMojoProxy); | 
| 159 }; | 162 }; | 
| 160 | 163 | 
| 161 }  // namespace leveldb | 164 }  // namespace leveldb | 
| 162 | 165 | 
| 163 #endif  // COMPONENTS_LEVELDB_LEVELDB_MOJO_PROXY_H_ | 166 #endif  // COMPONENTS_LEVELDB_LEVELDB_MOJO_PROXY_H_ | 
| OLD | NEW | 
|---|